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
0 answers

Using Python Subprocess to call raster2pgsql

I have a command that uses Popen from Python's subprocess module to call the raster2pgsql command for postgis. Here is what I've got: curl_url = "https://....." command = """raster2pgsql -F -I -C -s 26916 -t auto -R "/vsicurl/{}" table_name |…
huski1018
  • 11
  • 2
1
vote
1 answer

ST_Intersects returns true for non-intersecting geography

Here's my geography data: select 'SRID=4326;MULTIPOLYGON (((105.67151103718783 26.882512088629863, 115.99865947468783 31.74650295647645, 116.37219463093783 43.48451247459262, 147.02954326375033 62.362161196046245, -177.2690102030465…
1
vote
1 answer

Jooq Multiset generates sql query with Postgis geometry coordinates instead of hex value

I am using the multiset constructor to fetch a related set of locations of an event. The location table uses the geometry Postgis type so I can abstract it if it's a Point, Line or Area, saving it as a hex representation. This is the table…
1
vote
0 answers

Transform coordinates with PostGIS based on Proj4 transformation text

I am working on a project where I have to transform coordinates expressed in LUREF (LUxemburg REference System/Frame) to WGS84 (Lat/long) by using the bundle PostGIS of Postgres database. The Proj4 texts for the different CRS are the following…
1
vote
1 answer

How to save WKT to postgres column with geometry data type using typeorm?

I have a table with a geom column which has the datatype of geometry. I need to save data into this table and the request being sent has the type wkt for this column. Currently there are some existing rows in the table with data in this…
Kaisin Li
  • 514
  • 3
  • 7
  • 21
1
vote
2 answers

Is there ST_Intersects alternative that allows two(or more) polygons to share sides

I am using ST_Intersects to check if two polygons intersect. Relevant part of my query is: SELECT entity_number FROM coordinates WHERE ST_INTERSECTS($1, location) It works well to determine if one polygon crosses the other's surface: I expected…
ABDULLOKH MUKHAMMADJONOV
  • 4,249
  • 3
  • 22
  • 40
1
vote
2 answers

Do Geometry/Geography points imply a direction?

Is the line LINESTRING(1 1, 2 2) the same as LINESTRING(2 2, 1 1) ? I would think the answer is not, if there is some directionality implied -- for example, a flight-route from Los Angeles to New York would be different than going from New York to…
David542
  • 104,438
  • 178
  • 489
  • 842
1
vote
1 answer

How can i write a postgres function that loops over array of arrays and concatenates all values into a string

I am trying to write a postgres function that takes an array of arrays (e.g.…
ABDULLOKH MUKHAMMADJONOV
  • 4,249
  • 3
  • 22
  • 40
1
vote
2 answers

save geometry type data with timestamp in postgresql

I want to save LineString like the below in Postgresql {"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"style": {"color": "#19f3e7", "weight": 2}}, "geometry": {"type": "LineString", "coordinates": [[50.998085021972656,…
MSepehr
  • 890
  • 2
  • 13
  • 36
1
vote
1 answer

STUnion an entire column in jOOQ

I'd like to apply the PostGIS ST_Union operation on all Geometries in a column. The equivalent SQL would look something like this: select ST_Union(region) from region_geometries where ST_Contains(point); However, kOOQs implementation of stUnion…
PunDefeated
  • 566
  • 5
  • 18
1
vote
3 answers

POSTGIS Optimize query

I have a table with a column "multip" type GEOMETRY which contains a multipolygon. Each multipolygon contains several polygons. My table is very large (12 millions records). I need a fast query on my table which extracts all lines of my table which…
SG92
  • 21
  • 3
1
vote
0 answers

django-tenants postgis with multischema

How can i install postgis extension for 2 shema? shema_1 and shema_2, my commands: CREATE SCHEMA IF NOT EXISTS shema_1 AUTHORIZATION admin; CREATE SCHEMA IF NOT EXISTS shema_2 AUTHORIZATION admin; SET search_path = shema_1, shema_2, public; CREATE…
Kirill
  • 43
  • 4
1
vote
1 answer

Using dijkstra in Postgres with a table containing source and target node IDs

I'm very new to this - trying to use dijkstra to find distances and routes between a list of around 10,000 people's addresses and their chosen facility. I have a small subquery (below) deriving the node ids (source and target) for every person. I…
1
vote
0 answers

Cannot run the correct version of docker postgis container

I am trying to use a postgis plugin that will only run on postgis version 3.1/3.2. After trying to deprecate the version on my local computer (and failing), I am now trying to run postgis 3.1 on a container instead. However, only the latest version…
EllieBevs
  • 11
  • 2
1
vote
1 answer

Postgis ST_Split to split linestring into multiple smaller linestrings based on node locations

I have 2 tables, one with linestrings and an array of id values, and the other points with the before listed id values. I want to perform a slice at the node locations associated with the linestrings and add those newly cut linestring pieces to a…
evan
  • 169
  • 3
  • 12