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
30
votes
3 answers

PostGIS - convert multipolygon to single polygon

Is it possible to import a shape file containing multipolygons into single polygon in PostGIS? Whenever I try importing a shape file of a polygon, it is stored as a multipolygon (as opposed to a single polygon) in a geom column. Thus, I am unable to…
user3012604
29
votes
11 answers

GeoDjango on Windows: "Could not find the GDAL library" / "OSError: [WinError 126] The specified module could not be found"

I've been trying to setup my windows computer such that I can have a local postgreSQL with PostGIS extension. With this installed I hope to be able to create a project with geodjango locally before putting it in the cloud. I have been working with…
Yorian
  • 2,002
  • 5
  • 34
  • 60
29
votes
1 answer

How to choose between MongoDB and PostgreSQL for GIS?

I'm trying to find some information on this topic but most articles I'm finding are 3+ years old. I am also fairly new to this side of things and not sure who to ask. For my particular use case, I'm not a database expert at all but I've used…
a person
  • 1,518
  • 3
  • 17
  • 26
29
votes
1 answer

Setting up PostGis on Amazon RDS

Ok, so I am fairly new to RDS and AWS, but I can't for the life of me, get my database that I created on my laptop, onto amazon RDS, I did move it to my test VPS and also my desktop machine, with no problems at all, here is what I have tried so…
Crooksey
  • 908
  • 3
  • 11
  • 22
29
votes
3 answers

Psycopg2 Insert Into Table with Placeholders

This might be a rather silly question but what am I doing wrong here? It creates the table but the INSERT INTO doesn't work, I guess I'm doing something wrong with the placeholders? conn = psycopg2.connect("dbname=postgres user=postgres") cur =…
Timothy Dalton
  • 1,290
  • 2
  • 17
  • 24
29
votes
4 answers

Two closest points on boundary of Postgis geometry

I have a table geofences which stores geometry of polygon. I also have a point A which is inside the geometry. What I have to do is find the two closest points from point A that lie on the surface of the polygon geometry. Function in…
Satish Sharma
  • 3,284
  • 9
  • 38
  • 51
28
votes
3 answers

Distance between 2 POINTs in Postgis in srid 4326 in metres

This is probably a simple question, but I'm not very good at PostGIS and don't fully grok all of this. Basically I have a table (nodes) with a POINT column (point). I have created an index on this column create index nodes__points on nodes using…
Amandasaurus
  • 58,203
  • 71
  • 188
  • 248
27
votes
5 answers

Postgis / Geodjango: Cannot determine PostGIS version for database

I'm attempting to launch a GeoDjango app. I've installed Postgres & PostGIS using brew on Lion. I created a database using template_postgis: createdb -T template_postgis test. When I run python manage.py syncdb, I get the following…
Matt Hampel
  • 5,088
  • 12
  • 52
  • 78
27
votes
5 answers

PostgreSQL ERROR: 42P01: relation "[Table]" does not exist

I'm having this strange problem using PostgreSQL 9.3 with tables that are created using qoutes. For instance, if I create a table using qoutes: create table "TEST" ("Col1" bigint); the table is properly created and I can see that the quotes are…
Rahul Vijay Dawda
  • 1,123
  • 3
  • 14
  • 36
26
votes
4 answers

PostgreSQL upgrade on Amazon RDS blocked by PostGIS version

I'm trying to upgrade my RDS instance from 9.5.4 to 9.6.1, and I'm getting blocked by an error about the PostGIS version needing to be upgraded first. Database instance is in a state that cannot be upgraded: PreUpgrade checks failed: The instance…
25
votes
2 answers

Find n Nearest Neighbors for given Point using PostGIS?

I am trying to solve the problem of finding the n nearest neighbors using PostGIS: Starting Point: Table geoname with geonames (from geonames.org) containing latitude/longitude (WSG-84) Added a GeometryColumn geom with srid=4326 and…
Scholle
  • 1,521
  • 2
  • 23
  • 44
25
votes
6 answers

Map a PostGIS geometry point field with Hibernate on Spring Boot

In my PostgreSQL 9.3 + PostGIS 2.1.5 I have a table PLACE with a column coordinates of type Geometry(Point,26910). I want to map it to Place entity in my Spring Boot 1.1.9 web application, which uses Hibernate 4.0.0 + . Place is available with a…
bluish
  • 26,356
  • 27
  • 122
  • 180
24
votes
1 answer

How can I query the postgres Point type from clojureql?

How can I query the postgres Point type from clojureql? I wish to use the PostGIS functionality but clojureql does not seem to include this.
yazz.com
  • 57,320
  • 66
  • 234
  • 385
23
votes
2 answers

postgres array_agg ERROR: cannot accumulate arrays of different dimensionality

I have a parcels table in postgresql in which the zoning and zoning_description columns are array_agg cast over to text. the new.universities table has 9 rows and I need to return 9 rows in the output. The purpose of this query is to find all the…
ziggy
  • 1,488
  • 5
  • 23
  • 51
23
votes
3 answers

psycopg2 and SQL injection security

I am writing a class to be used as part of a much larger modeling algorithm. My part does spatial analysis to calculate distances from certain points to other points. There are a variety of conditions involving number of returned distances, cutoff…
wfgeo
  • 2,716
  • 4
  • 30
  • 51