19 #include "pg_local_proto.h"
21 static PGresult *build_stmt(
const struct Plus_head *,
50 res = build_stmt(&(Map->
plus), pg_info, lines, n_lines);
54 for (i = 0; i < n_lines; i++) {
69 PGresult *build_stmt(
const struct Plus_head *plus,
75 char *stmt, *stmt_id, buf_id[128];
83 stmt_id = (
char *)
G_malloc(stmt_id_size);
86 for (i = 0; i < n_lines; i++) {
87 if (strlen(stmt_id) + 100 > stmt_id_size) {
89 stmt_id = (
char *)
G_realloc(stmt_id, stmt_id_size);
92 BLine = plus->
Line[line];
95 sprintf(buf_id,
"%d", (
int)BLine->
offset);
96 strcat(stmt_id, buf_id);
104 "SELECT geom FROM \"%s\".edge_data AS t "
105 "JOIN (SELECT id, row_number() over() AS id_sorter FROM "
106 "(SELECT UNNEST(ARRAY[%s]) AS id) AS y) x ON "
107 "t.edge_id in (%s) AND x.id = t.edge_id "
108 "ORDER BY x.id_sorter",
113 res = PQexec(pg_info->
conn, stmt);
116 if (!res || PQresultStatus(res) != PGRES_TUPLES_OK ||
117 PQntuples(res) != n_lines) {
int Vect__get_area_points_pg(struct Map_info *Map, const plus_t *lines, int n_lines, struct line_pnts *APoints)
Get area boundary points (PostGIS Topology)
void G_free(void *)
Free allocated memory.
int G_asprintf(char **, const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
void Vect_reset_line(struct line_pnts *)
Reset line.
int Vect_append_points(struct line_pnts *, const struct line_pnts *, int)
Appends points to the end of a line.
#define GV_FORWARD
Line direction indicator forward/backward.
SF_FeatureType Vect__cache_feature_pg(const char *data, int skip_polygon, int force_type, struct Format_info_cache *cache, struct feat_parts *fparts)
Read geometry from HEX data.
struct Format_info fInfo
Format info for non-native formats.
struct Plus_head plus
Plus info (topology, version, ...)
off_t offset
Offset in coor file for line.
Basic topology-related info.
struct P_line ** Line
Array of vector geometries.
Feature geometry info - coordinates.
int n_points
Number of points.