Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [postgis]

PostGIS is a database extension for PostgreSQL providing additional spatial types, indexes, functions, and aggregates.

0
votes
1answer
17 views

How to run multiple ST_DWITHINs/ ST_INTERSECTS within a single WHERE clause

PostgreSQL 11, on Windows 10. I'm working with a post-gis enabled database. I want to UPDATE a large polygon table (100,000+ rows) WHERE the geometry of that host table intersects the geometry of ...
0
votes
0answers
14 views

Postgres: Create table when 2 tables share a common value

I want to create a new table, taking all the columns from table1 and only taking the rows from table1 where it shares a common attribute. So far I have: CREATE TABLE schema1.table3 AS SELECT topo.id ...
0
votes
1answer
17 views

Postgres: CREATE TABLE based on common values of 2 other tables [closed]

I want to create a new table (newtable) taking all the columns and taking all the rows from table1 only WHERE a value in table 1 = the same value in another table (table2). I've come up with ...
0
votes
3answers
73 views

How to SELECT “closest” rows from another table?

I have two tables, map1 and map2, there are multiple possible combinations between the columns map1.id1 and map2.id2. I have tried the below query: SELECT map1.id1, map2.id2, MIN(...
0
votes
0answers
10 views

How to optimise PostgreSQL planning time

I have a small query using postgresql 9.6.11 and postgis 2.3.1+dfsg-2 select ST_Transform(ST_SetSRID(ST_Point(671699.9999988,6585300.5001232),32633),3006); that is slower than I like for where it is ...
0
votes
0answers
57 views

How to properly find duplicate rows with spatial and temporal criteria

I have a table with historical rows indicating the positions in which ocean samples were taken. From this table, I would like to find duplicates based on spatial and temporal criteria. Thus, the ...
0
votes
0answers
24 views

cannot have more than 2^32-1 subtransactions in a transaction

I'm trying to run this but after 10 hours I get the error "cannot have more than 2^32-1 subtransactions in a transaction". What is your advice for getting around this issue? I'm hesitant to split up ...
0
votes
0answers
42 views

Cache lookup failed for function 1 while activating PostGIS

I'm using PostgreSQL 10.5 on a remote server (Debian). I created a database inside then I attempted to enable PostGIS but it wasn't successful. I had this error : cache lookup failed for function 1. ...
0
votes
0answers
17 views

Postgis KNN in Postgres 9.5

I'm trying to use the Postgis KNN functionality as described here: https://postgis.net/docs/geometry_distance_knn.html I have one table with all point geometries. The table has many samples, and in ...
0
votes
0answers
16 views

Is the result of ST_Union defined?

With MariaDB 10.1, I get a simplified LINESTRING when I provide two lines can be joined. SELECT ST_AsText(geom) FROM ( SELECT ST_Union( LineString(Point(0,0),Point(1,1)), LineString(Point(1,...
-2
votes
1answer
62 views

Can PostGIS or Oracle Spatial and Graph scale to hundreds of terabytes of data, or should I use a NoSQL option like DynamoDB? [closed]

I'm going to have a very large data set (a few hundred terabytes big eventually), but it is very well structured, relatively simple data involving lat, long points (which is why I want some GIS ...
1
vote
1answer
35 views

Google Cloud SQL lacks raster2pgsql

Google Cloud SQL supports the PostGIS extension, but I haven't seen any documentation regarding how to work with raster data on it. To load raster data into a table, we have to use raster2pgsql driver....
0
votes
1answer
47 views

Error with pg_upgrade and PostGIS

I have a PostgreSQL 9.2 setup (with Postgis) and am trying to upgrade it to 9.6. When performing the pg_upgrade, I get the following error: ERROR: could not find function "geography_analyze" in ...
2
votes
1answer
31 views

How to “group” based on consecutive occurrences of an element in a column in postgres

I have a table that, when ordered, describes a path by point descriptions in each row. A column tells whether a row is a special (stop) point within that path and is empty otherwise. The path starts ...
1
vote
1answer
93 views

ERROR: invalid GeoJson representation

the GeoJSON Spec show, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }, "properties": { "name": "Dinagat Islands" } } But when I wrap that in ...
2
votes
1answer
42 views

How to insert into table multiple geometry rows from function JSON param?

My table: CREATE TABLE Points ( id integer NOT NULL DEFAULT nextval('point_id_seq'::regclass), info character varying(20) NOT NULL, my_point geometry(Point,4326), CONSTRAINT ...
0
votes
0answers
50 views

no performance improvement with pgpool query result caching

I'm trying to add query result caching to a PostGIS database that's frequently hit with the same (expensive) spatial queries. Looks like pgpool-II is currently the only well-developed solution. ...
1
vote
1answer
769 views

could not load library “/usr/pgsql-10/lib/postgis-2.5.so”: /usr/pgsql-10/lib/postgis-2.5.so: undefined symbol: GEOSFrechetDistanceDensify

I have installed postgresql 10 on centos 7.4 and installed postgis2.5 few months back. The installation was successful and Iam able to use postgis. All of a sudden Iam getting the following error. ...
1
vote
2answers
75 views

Joining relations based on distance between geometry columns?

I have two tables: User(id) Region(id, userID, origin Geometry('point'), radius)) User has a one-to-one relationship with Region. I want to query all users that have a region that contains a point (...
0
votes
1answer
23 views

How does PostGIS make its data types compatable with Postgres?

How did Postgres extend to accommodate PostGIS data types? I am trying to create a spatial system. All the code is written in C++. I do not want to create separate data type in Postgres using CREATE ...
0
votes
1answer
408 views

Improve performance of this query finding nearby locations

I am trying to execute this SQL, but the query is really slow (almost 2 hours), It's actually querying 1 million records (property_ids), that's why it's slow. But can someone suggest me a strategy to ...
1
vote
2answers
497 views

Undefined symbol when migrating to Postgres 11 [closed]

After upgrading Postgres 10 to version 11, by using pg_upgrade, I get this error: could not load library "$libdir/postgis-2.4": ERROR: could not load library "/usr/pgsql-11/lib/postgis-2.4.so": /...
0
votes
1answer
14 views

Finding road segements which are not split at intersection.(Query Optimization )

I have a query in which I am trying to find the road segments which intersect but are not splitted at intersection,I have also created gist index on geom column. Here is postgerSQL srcipt SELECT a.id ...
1
vote
1answer
14 views

Import Postgres 8.3 database in Postgres 10.5 [closed]

I have a database in Postgres 8.3 (and PostGIS 4.2), which I need to import in Postgres 10.5. I am a DB newbie and would appreciate any pointers to get started. Would you recommend a particular book ...
0
votes
1answer
25 views

select query on postgis not working for specific fields [closed]

So I have what seems to be a really weird problem. I have imported a table from QGIS into a postgresql + postgis database. I simply want to select a few columns from that, but I can't. whats funny ...
0
votes
1answer
124 views

Problem migrating PostGIS

I need to migrate Postgres 9.3 + PostGIS 2.1 to Postgres 10. I'm using CentOS 7.X Using pg_upgrade it should be quite straightforward, but the problem is PostGIS. Postgres 9.3 has PostGIS 2.1 ...
1
vote
1answer
73 views

Postgresql bad planning with multicolumn gist and search with empty results

I'm having an issue with a multicolumn index (integer, geom), where geom are PostGIS points, and the integer is a point aggregator with business meaning. I do searches by boxes in the geom column, ...
2
votes
1answer
1k views

Dynamically define a RETURN table (column type, name) for subsequent loop

I would like to execute ST_Intersection(clipper_geom, clipped_geom) on number of rows coming from a table. https://postgis.net/docs/ST_Intersection.html https://postgis.net/docs/ST_Intersects.html ...
1
vote
1answer
46 views

Automating Redshift data dump to a PostgreSQL DB every hour

GIS analyst with minimal experience of this back-end stuff but a big task at hand. I have a redshift database that changes multiple times a day. I want to use this "live" data to make web maps and I ...
2
votes
1answer
125 views

PostgreSQL Geo Spatial Query is slow

After given up with MySQL i have tried Elasticsearch and now wan't to see if I could go with PostgreSQL/PostGIS that could allow me to go with PostgreSQL only. I need to fetch records from a Table ...
1
vote
0answers
27 views

How to make use of indexes with inner join in Postgis?

I got 2 sets of points in 2 separate tables. Table_a got 100k points and table_b got 300k of points. I trying to find nearest points in relation find me any point from table_b that is within 50 meters ...
2
votes
2answers
57 views

How to verify that at least one point fall into a polygon with Postgis?

I have two tables where table A has a geometry (4326) column that contains surfaces (~20M). A second table B has ~ 500K points (4326). What I want to do is "flagging" (adding a boolean column) every ...
3
votes
2answers
112 views

Joining tables based on time and distance: PostGIS with PostgreSQL?

I have a table with several thousand rows that contains time and position data. Rows with the same group_id have the same timestamp. Lets call this table "Small": Small Table: id event_time ...
1
vote
1answer
38 views

In PostGIS, how do I swap the lat/log of invalid points, like MySQL ST_SwapXY?

MySQL has a function ST_SwapXY which swaps the x and y values (long, and lat). A function, like ST_SetSRID, that's useful if you import data incorrectly. Accepts an argument in internal geometry ...
1
vote
0answers
45 views

Improve the performance of ST_Within boundary lookups in PostGIS

I'm trying to improve the performance of a georeferencing feature in our application. For every address in our system, we need to store which of several boundary types it is located within (local ...
1
vote
2answers
139 views

Slony Replication in PostgreSQL

Objective : Set up two DB server if first server down then second can be up and running provided condition is that at evening time both server need to sync. with each other I am new in DBA and we are ...
0
votes
0answers
21 views

Rename a schema that contains an extension used by another schema

How can you rename a schema containing an extension without breaking tables in other schemas that rely on this extension (PostGIS)? I'm trying to temporarily rename a schema "dest" to "public" in ...
1
vote
2answers
89 views

error query did explode the postgres database

I had some problems last month. I had a bad query in Postgres (PostGIS) of a user launched during the night. This query took all the memory and I had 0% of free disk. Fortunately, I restored the ...
0
votes
1answer
141 views

Nearest neighbours (KNN) from a selected point

I have a small point dataset, I perform the following I get the 10 KNN from the coordinate. How do I first select a point from the dataset and with that select the 10 nearest neighbours (not including ...
0
votes
2answers
193 views

How can I manage an exception generated by Postgis?

I am running the following query on Postgres 10.3/Postgis 2.4: create table table_c as ( select A.*, B.area_name, B.id from table_a A left join table_b B on ST_Contains(A.geom, B.geom)...
2
votes
2answers
414 views

Support for libprotobuf-c on Amazon RDS

I created a PostgreSQL 10 instance on Amazon RDS with the PostGIS 2.4 extension in my database enabled. I want to test the performance of Amazon RDS as a dynamic vector-tile server. This hinges on ...
2
votes
1answer
107 views

For Postgres, efficiently get points within X distance of point Y?

I have this table as below in Postgres: create table locations ( id serial not null constraint games_pkey primary key, name varchar, location point, ) ; I want to ...
0
votes
1answer
41 views

How to delete constraint inside a trigger function

I have read a lot about it, but being new to Postgres, I am at a loss. The trigger is : CREATE TRIGGER foopolygon BEFORE INSERT OR UPDATE OR DELETE ON polygon FOR EACH ROW EXECUTE PROCEDURE maj_foo(...
0
votes
1answer
27 views

Create a check constraint across multiple schemas in PostGIS [closed]

I'm a little new to this so apologies up front if my vocabulary is incorrect. I'm trying to create a check constraint that determines whether a new point is located within an existing polygon. The ...
1
vote
2answers
30 views

How to update a point table when a polygon table is modified

I am trying to create a function that update table A (point) when table B (polygon) is modified. The reference to B must be changed in A. I can't get it to work. There are no overlaps in the polygons. ...
1
vote
1answer
57 views

Joining temporal and spatial data

I have two tables in psql that I am trying to join based on certain attributes - they are very large - 17 M rows and 2.7 M rows respectively mydb=> SELECT reltuples::bigint AS estimate FROM ...
2
votes
1answer
983 views

Installing PostGIS in a different schema causes topology extension to not find geometry type

I have a sql dump of the schema of an existing database that is working correctly. When I try to load this into a new, empty database psql new_db < dump.sql, I get the following error: ERROR: ...
1
vote
2answers
76 views

Can't get this PostgreSQL query to run faster

I'm running PostgreSQL 9.6 with PostGIS 2.3.3 I'm trying to make this rather critical query go faster (looking for users within 1000 meters of a location), but I'm having troubles setting up the ...
1
vote
1answer
34 views

PostgreSQL/PostGIS ERROR: Third argument must be a POINT

I have a table mytable structured as follows: id nv_bez parent_rv lfd_nr hierarch_bez snr geom 1 NV064764 None 1 NV064764_1 1 ...
0
votes
0answers
715 views

postgresql increase work_mem for query

I have a geometrically intensive query that takes about 7+ to run. My database is only used by me and is not shared with anybody else. I have been reading up about the idea to increase the work_mem to ...