Questions tagged [postgis]
PostGIS is a database extension for PostgreSQL providing additional spatial types, indexes, functions, and aggregates.
239
questions
0
votes
0answers
27 views
Order of tables affects the use of index
I'm trying to optimize a large set of queries, and I don't understand why the order of tables in the WHERE clause makes such a big difference (3x).
I thought that the query planner didn't care about ...
0
votes
0answers
8 views
fetch elements between bounds in postgis
I have a table 'locations' in postgresql:
name (character varying(24))
geography (geography)
I insert data like this:
INSERT INTO locations (name, geography) VALUES ($1, ST.MakePoint($2,$3)::...
0
votes
1answer
25 views
How to fix double-encoded UTF8 characters in postgres
I have a dataset (shapefile) with the same problem as the post below:
https://stackoverflow.com/questions/11436594/how-to-fix-double-encoded-utf8-characters-in-an-utf-8-table
"A previous LOAD ...
0
votes
1answer
26 views
Geospatial join using ST_Contains or ST_Within seems slow, with costly query and bad estimate
Problem
I have two tables, one which which includes a point column and the other which includes a boundary (table definitions below). I want to select rows from the first column where the point is ...
0
votes
1answer
23 views
What is the format of raw geometry column in PostGIS?
It doesn't seem to be a WKB, since it's basically a string, so what is it?
0
votes
4answers
41 views
Postgis reporting a point is 1216m away from itself using ST_Distance [closed]
I have a table containing a geometry column in 4236 projection. I take the ST_X and ST_Y values from one row, and create a point from them. I then transform the point and the original geometry column ...
0
votes
0answers
7 views
How to manage datas from specific world areas (i.e. several CRS) in Postgis?
Until now, I used to store spatial data concerning the French metropolitan territory in a PostGis database. The reference coordinate system chosen is 2154 RGF93/Lambert93.
Very soon, I will have to ...
3
votes
0answers
50 views
Postgis ST_Intersects behaves erratically
I am using Postgres 13.0 on a Mac, with Postgis 3.0. I encountered a problem where ST_Intersects produces the wrong result, and after narrowing it down, I arrived at the following:
With the following ...
0
votes
1answer
35 views
cumulatively calculate the distance along a line
I am using Postgis to:
calculate the cumulative distance in metres along the line
store the cumulative distance in "m"
I have a table with points on this line and each row holds lat and ...
1
vote
0answers
18 views
Expected function to return very few rows, but returns all rows
I am creating a Postgres/postgis function that is suppose to cut an input-geometry according to a 'hard-coded' table's geometry. The hard-coded table is called j.borders and its geometry attribute is ...
0
votes
1answer
32 views
only use extended join-clause if some variable is TRUE [closed]
I am working with Postgis (extension to postgres) where there are several different geometry-types, i.e. 'polygons', 'points' 'linestrings', and multi-variants of these.
I am trying to create a ...
1
vote
1answer
39 views
PostgreSQL - trying to speed up query responses from view that has join and group by
I have these two tables:
precipitaion: store precipitation data at daily (freq = 'daily') and hourly (freq = 'hourly') frequencies for 7 months so far (I receive regular updates).
Column | ...
0
votes
1answer
17 views
remove postgres server from local machine
I know this is a real beginner question. But nevertheless I'm really confused:/
I wanted to have a clean installation of postgres on my ubuntu laptop. So I tried to delete everything related to ...
0
votes
2answers
232 views
Slow planning time on PostgreSQL 12.4
I have a database with Openstreetmap location data, and in particular there is a polygon table with around 500 million rows.
I created indexes on all of my queries consisting of using gist(way) where ...
0
votes
1answer
48 views
Unable to import shapefile into PostGisDatabase - problem of connection
I have been trying to import/load a shapefile into a PostGis database without any success despite many trials and searching an answer in the documentation.
Configuration
I'm running Windows 64 bits ...
2
votes
1answer
25 views
Is there a reason I should not set my default data location to google drive when setting up PostgreSQL?
I'm brand new to working with databases and am setting up a PostgreSQL database which will be used for personal projects. I'm setting it up with the postgis extension and will use both for some basic ...
0
votes
0answers
137 views
Installation of PostGIS extension not working on a docker image (seems not found by further commands)
Context
I have a PostgreSQL code for installing the PostGIS extension which is working great on my machine but which doesn't work on a docker image. I cannot understand why.
Here are the ...
0
votes
0answers
9 views
Losing connection to the server when using PG Routing function pgr_alphaShapes
I am running PG Routing v. 3.0 on Postgresql 12.2 and the pgr_alphaShapes function is giving me a lot of trouble. Following the documentation here, I passed a geometry and a spoon radius.
SELECT *
...
0
votes
2answers
59 views
How to get the type of geometry column in postgres?
I need to determine the type of geometry column and doing it with the following query:
SELECT type
FROM geometry_columns
WHERE f_table_schema = 'public'
AND f_table_name = 'table_name'
...
1
vote
1answer
30 views
Create 7 day rolling average in PostGIS for each feature
I have a timeseries dataset that looks like this:
uid | geom | date | count |
-------------------------------------
1 | FeatureA | 2016-02-01 | 1 |
2 | FeatureA | 2016-02-02 | 2 ...
0
votes
0answers
25 views
Can't get PostGIS to show points on map - no button to activate map?
PostgreSQL 12 and PostGIS 3.0.1 on Windows 10, using PGAdmin4. I'm totally new to PGAdmin4 having recently come from PostgreSQL 9 / PGAdmin III - frankly, I don't like it but I'm trying.
For the ...
0
votes
0answers
10 views
Library that can generate random geospatial data in GeoJSON
Is there a library that can help to quickly generate random geospatial features in GeoJSON format (preferably, but can be anything), based on the parameters that we pass in. For example - generate ...
2
votes
1answer
47 views
Best indexing strategy for spatial join and ranged lookup
Context
We have two tables (not the real tables used in the examples below. They are from a toy DB im using for testing):
Incidents_2 (Columns of interest are a geom, and a reported_at (int8))
...
0
votes
0answers
17 views
PostGIS buffer in miles not lat/long degrees
I am trying to take two points, add a buffer around them (in meters), draw a line between them, draw a buffer around that, and then query whether items are inside the area of the circles expanded line ...
0
votes
1answer
52 views
PostGIS trigger is fired without error, but the action seems not executed
Context
I have set up a trigger on a PostgreSQL (+Postgis) table containing observation points.
This trigger must compute a new geometry for each inserted or updated point. This new geometry must be ...
0
votes
1answer
34 views
Aggregating data by group and time gaps
I've got a postgresql+postgis database filled with GPS data:
CREATE TABLE "my_table" (
"id" serial NOT NULL PRIMARY KEY,
"gps_id" text NOT NULL,
"lat" numeric NOT NULL,
"lon" ...
0
votes
1answer
579 views
'ERROR: could not access file “$libdir/postgis-2.5”: No such file or directory' [closed]
Dealing with PostGIS has been a nightmare from day one. Every single time I have to touch it in any way, or update PostgreSQL, it turns into a broken mess. The only reason I use it is because I need ...
0
votes
1answer
162 views
How do I check if PostGIS is installed in my PostgreSQL?
I'm trying to check whether or not the PostGIS extension is installed, as a PG query. I'm unable to find this info out.
1
vote
0answers
84 views
Installing Postgis and PGRouting via pgenv
We have a product where our production environment uses Docker and has no issue with installing things like postgis and pgrouting.
However, we have multiple remote developers and many of them (...
1
vote
1answer
26 views
Would it be worthwhile to use the PostGIS extension for custom planets?
I need to be able to store latitude and longitude in several different tables. My understanding is that PostGIS has a geography column type that does this.
However, I'm not storing coordinates on ...
0
votes
1answer
32 views
Query table based on column value
I've those tables on my PostGIS db.
poi_list
+----+------+-----------------+---------------+--------------------+
| id | nr | source_layer | source_column | source_id |
+----+------+----...
0
votes
1answer
19 views
Why does PostGIS create an ugly table in my database called “spatial_ref_sys”?
I need to use PostGIS, and do use it, but it bothers me that it created this ugly "spatial_ref_sys" table in my database, in the main (public) schema, where I keep all my own tables. It looks ugly.
...
0
votes
1answer
339 views
Are there limitations on using pg_dump on a materialized view such that the data won't be included in the results?
I have a database, call it maps, which contains 2 schemas, a & b. In each schema I have a number of tables: a.t1, a.t2, b.t1, b.t2 (plus others). The column sets on each of these tables is ...
0
votes
1answer
23 views
group several columns together in materialized view
For statistical reasons, I need to group several ids in a single column of a materialized view.
This should form a list of ids from other tables with an info. Further processing will be done on this ...
0
votes
1answer
14 views
Restrict access to my PostgresSQL/ Post GIS database used through QGIS
We have a small network of users accessing our QGIS data stored on a PostGIS database (in 3 schemas) which sits on my local drive in my computer. This drive is then shared with the others. Due to the ...
0
votes
2answers
64 views
How to use pg_restore in database with different postgis installation (postgis schema location)?
I have database1 where postgis is installed in the public schema.
And database2 where postgis is located in a schema called postgis.
When I dump database1.schema1, schema1.table1 references its geom ...
0
votes
3answers
20 views
query two point values from a table then insert a new record after creating a line from the two points
I am running postgres: 9.5.19
I have already point values as separate records in a table. I want to create a new record which represents a line geom derived from the two points above. I have lots of ...
0
votes
1answer
31 views
Postgres/PostGIS is returning data from a table that doesn't exist (I'm a newbie — show me why I am wrong)
I am following a tutorial for PostGIS. I have uploaded all the example datasets (all shapefiles) into a PostgreSQL database, although I have modified the names so they do not all match the names of ...
0
votes
1answer
67 views
Multiple versions of PostGIS and PgRouting on CentOS 7
I'm trying to install multiple versions of PostGis and PgRouting in the same instance of PostgreSQL v9.6, using CentOS 7.5.
I've been fighting with dependencies and shared libraries, to make all ...
0
votes
1answer
17 views
Store lat lon in addition to the geography data type?
It's my first time using Postgis, I have been doing some reading on using it. I have added a geography data type to my table, but the values are stored in a binary format. Is it good practice to also ...
0
votes
0answers
53 views
Query to reduce column length
I'm new to PostgreSQL so sorry if I haven't explained myself clearly!
I've used the below query to find out the max character length of each column in my table. I now want to be able to shorten each ...
0
votes
1answer
45 views
How can I find the longest record (in characters) for each column in a table in PostgreSQL
I couldn't find the answer to this on here so sorry if repeated. I'm looking to query a table to find the longest record in characters for each column in a specific table.
I have a table which is ...
0
votes
1answer
50 views
Indexes for combined time and location data
I have a multi-TB table with geolocation data for a certain item id and timestamp.
It is partitioned by time with a partition for every month (~500GB), and clustered (including the partitions) on the ...
2
votes
1answer
1k views
RDS: permission denied for relation spatial_ref_sys when copying
I am copying tables using ogr2ogr from Oracle to PostGIS. When I run try to load these I get,
ERROR 1: ERROR: permission denied for relation spatial_ref_sys when copying <table>@AWS
0
votes
0answers
36 views
Storing earth observation derived attributes for polygons
I want to generate a number of vegetation related indices (NDVI, NDTI, etc., min/max/avg/std (pixel values)) from earth observation data for a large number of polygons during the entire growing season,...
0
votes
1answer
25 views
How to move a PostgresSQL/ PostGIS to another drive
Firstly I'd like to say I know little about databases (GIS background) and I might have bluffed it all so far.
But we wanted to set up a database for use with QGIS.
My understanding was that the ...
0
votes
1answer
32 views
Three WHERE slow query down
I have a table adjacency, which stores information about connected lines and their angle to each other is build by
CREATE TABLE public.adjacency
(
currentedge integer,
currentgeom geometry(...
1
vote
0answers
113 views
Querying foreign table with SP-GiST index results in “ERROR: cache lookup failed for type 0” [duplicate]
I'm using PostgreSQL 11.3 (compiled by Visual C++ build 1914, 64-bit) and I want to access a table in another Postgres database using postgres_fdw but since the original table has an SP-GiST index on ...
0
votes
2answers
1k views
Psycopg2 Errors on SQL statement when trying to copy data from CSV file into PostgreSQL database
I am not a developer or PostgreSQL DB admin, so this may be basic questions.
Logistics: Windows 10 server / pgAdmin 4 / Postgres 10 / Python 2.7.13
I'm using a python script to ingest external data, ...
0
votes
1answer
24 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 ...