Questions tagged [postgis]

Use this tag for PostGIS, which is a spatial database extension for PostgreSQL. Before using this tag, please consider whether your question might be a better fit for the Geographic Information Systems Stack Exchange site (e.g. if it's more about configuration or geodetic principles than about actual programming).

PostGIS is an open source extension for PostgreSQL that adds support for geographic objects. In effect, PostGIS "spatially enables" the PostgreSQL server, allowing it to be used for geographic information systems (GIS), much like ESRI's SDE or Oracle's Spatial extension. PostGIS follows the OpenGIS "Simple Features Specification for SQL" and has been certified as compliant with the "Types and Functions" profile.

PostGIS questions also on-topic for the Geographic Information Systems Stack Exchange site.

PostGIS has been developed by Refractions Research as a project in open source spatial database technology and is released under the GNU General Public License.

Features

  • Geometry types for points, linestrings, polygons, multipoints, multilinestrings, multipolygons and geometrycollections.
  • Spatial predicates for determining the interactions of geometries using the 3x3 Egenhofer matrix (provided by the GEOS software library).
  • Spatial operators for determining geospatial measurements like area, distance, length and perimeter.
  • Spatial operators for determining geospatial set operations, like union, difference, symmetric difference and buffers (provided by GEOS).
  • R-tree-over-GiST (Generalised Search Tree) spatial indexes for high speed spatial querying.
  • Index selectivity support, to provide high performance query plans for mixed spatial/non-spatial queries.

Tutorials:

4548 questions
1
vote
2 answers

I changed Postgis Schema Name in QGIS, now my geometry column is corrupted, how do I fix

I changed name of PostGIS2.5 Schema from public to supervisor using QGIS 3.2.4; after that I discovered that my data was now unable to display geometry. If you check the geometry column in pgAdmin4, it now reads "supervisor.geometry" instead of…
1
vote
1 answer

PostgreSQL(PostGIS): Calling ST_Intersects for result of WITH clause

I have a set of linked tables. Last of them has geometry column. I need to get data from this set of tables by some criteria (including geometry intersection). The idea is to apply intersection analysis on the last step to speed up query. So I do…
Stranger_tm
  • 47
  • 1
  • 8
1
vote
1 answer

django.db.utils.NotSupportedError: extension "postgis" is not available

I'm running django 3.2 on Ubuntu 22.04 LTS with the following database engine in settings.py: 'ENGINE' :'django.contrib.gis.db.backends.postgis' My webserver runs through docker. This is my docker file : FROM python:3.8.14 RUN apt-get -y update…
Earthling
  • 83
  • 3
  • 13
1
vote
1 answer

How to convert latitude/longitude into central position of grid?

I want to take a lat/long and convert it into the center point of a grid with squares of size X/miles^2. Is there an easy way to accomplish this? For example divide earth into a grid of 1 square mile rectangles, any lat/lot found within a specific…
Åke Gregertsen
  • 185
  • 2
  • 7
1
vote
1 answer

PostGIS ST_asGeoJSON on specific columns and not all the row columns

I have a table with hundred of columns. I would like to write a single SELECT to get the GeoJSON string returning ONLY specific columns values (geometry and some others fields, but not all the columns values). If I run: SELECT ST_AsGeoJSON(d.*) FROM…
kiks73
  • 3,718
  • 3
  • 25
  • 52
1
vote
1 answer

Lua config throwing error in metamethods?

getting the following error when attempting to load data into pgsql database with osm2pgsql: ERROR: Failed to execute Lua function 'osm2pgsql.process_node': test.lua:183: unknown field 'as_point' stack traceback: [C]: in function 'error' …
evan
  • 169
  • 3
  • 12
1
vote
2 answers

How do i insert a Point / MultiPolygon in postgres ( using postgis ) with Spring data JPA?

I created a map using leaflet and i'm trying to send point / multipolygon drawns to my postgres database using spring data JPA. The server initially receives a string geoJSON ( converted to org.locationtech.jts.geom.MultiPolygon and…
1
vote
1 answer

Sum of points attributes inside intersection of two polygons

I have a three different tables: Polygons1 Name1 Geom Name... POLYGON.. Cell 3 Cell 4 Polygons2 Name2 Geom Name... POLYGON.. Cell 3 Cell 4 Points ID Num Geom ID... 54 POINT... Cell 3 33 I want to find…
Dasa
  • 13
  • 2
1
vote
0 answers

Postgis geom IN clause

I have a situation where I need to find which of my geodataframe geometries already exists on my postgis table. For that I was thinking in use something like a IN clause for my sql. But I don't know how to use a IN clause in my where condition with…
1
vote
1 answer

Supabase client (JS): filtering by distance

In supabase Javascript client is it possible to do a distance filter? If possible, I'd like to avoid implementing server-side logic. // Define the distance threshold in meters (50km = 50000m) const distanceThreshold = 50000 const targetLatitude =…
Fedro Zen
  • 11
  • 2
1
vote
1 answer

Issues with pgrouting createtopology() and rows_where condition

I am attempting to run createtopology on a database where tags match certain conditions with a jsonb datacolumn but the command fails on the rows_where condition and I don't know why. The Database is setup under the schema 'berlin' and has tables…
evan
  • 169
  • 3
  • 12
1
vote
1 answer

PostgreSQL server doesn't release memory until connection from PHP/Laravel client is closed

I have a daemon written in PHP/Laravel that connects to a PostgreSQL database using PDO and executes jobs from a queue. A job typically takes 30 minutes to run. It consists of several PostgreSQL queries with PostGIS. With every SQL query server…
V. Rzhavy
  • 31
  • 7
1
vote
3 answers

PostGIS table with large geometry column performance

The routed_way table has a column named way where the path of a vehicle is stored. The length of these paths can vary greatly, with some being short and others containing millions of points. Although the table only has thousands of rows, there are…
kolisko
  • 1,548
  • 3
  • 17
  • 22
1
vote
1 answer

Spring 6 PostGIS integration

I have been trying to port an existing application using PostGIS from Spring 5 to Spring 6. I get an error saying that org.hibernate.spatial.dialect.postgis.PostgisDialect is not more available: Task :packages:discover-app-back-api:bootRun…
Olivier Sofia
1
vote
0 answers

ERROR: null values cannot be formatted as an SQL identifier Where: PL/pgSQL function inline_code_block line 17 at EXECUTE

I'm trying this script, in ? passed GeoJson DO $$ DECLARE lib_table_name text; lib_table_id text; geom geometry; BEGIN SELECT point_node_libs.lib_type, point_node_libs.lib_type_id, nodes.geometry INTO…
1 2 3
99
100