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
10
votes
1 answer

postgis-2.0.so: undefined symbol: GETSTRUCT

when i use pg_upgrade check upgrade postgresql 9.0 beta2 to postgresql 9.3 beta1. error occure below : uptest@db-172-16-3-33-> cat loadable_libraries.txt Could not load library "$libdir/postgis-2.0" ERROR: could not load library…
digoal
  • 101
  • 1
  • 7
10
votes
1 answer

Insert Point (Geometry) value in PostgreSQL with JDBC

Please give me code example to insert records containing SQL statement: insert into TABLE (id, value1, value2, point, value3) values (1,'A', 'M', POINT (13.45646, 56.61782),5); in JDBC/Postgresql code. If anyone has solution of PreparedStatement…
Adnan Ali
  • 103
  • 1
  • 1
  • 4
9
votes
3 answers

Convert regular Postgres Database into a spatial database

I have looked everywhere but most tutorials are for creating a spatial database. Is it possible to convert a regular Postgresql db into a spatial one? I will be using this for GeoDjango.
dannyroa
  • 5,501
  • 6
  • 41
  • 59
9
votes
1 answer

GeoDjango distance queries returning incorrect results

I just got GeoDjango up and running on my development machine. Problem is that I can't get a distance query to work correctly. No matter what SRID I use, the distance results are totally off. Here's an example. >>> from django.contrib.gis.measure…
Dan Loewenherz
  • 10,879
  • 7
  • 50
  • 81
9
votes
1 answer

How to fix geojson to satisfy the needs of a mongodb 2dsphere index

I have ~400K documents in a mongo collection, all with geometry of type:Polygon. It is not possible to add a 2dsphere index to the data as it currently stands because the geometry apparently has self-intersections. In the past we had a hacky…
dan-man
  • 2,949
  • 2
  • 25
  • 44
9
votes
1 answer

Problem with a column name contains a colon in PostgreSQL

I downloaded the shape data from OSM. I have imported data from Shapefile into PostgreSQL without any problem but I got an error when I do the select statement. Select addr:city From location; Error: syntax error at or near ":" The problem is…
Vorleak Chy
  • 649
  • 9
  • 13
9
votes
3 answers

ST_DWithin does not use index with non-literal argument

I am using PostreSQL 9.3 w/ PostGIS 2.1.8 on Amazon RDS. I have a table named project_location, which defines "geo-fences" (each one is essentially a coordinate and radius). The geo-fence is stored using a geometry column named "location" and a…
Mike
  • 1,031
  • 14
  • 36
9
votes
1 answer

SQL joins, "there is an entry for table but it cannot be referenced"

I have a SQL query which is failing, giving me the error: "There is an entry for table but it cannot be referenced from this part of the query" Going through the query, I need both all 3 tables, but only trips and boats have a matching ID to join…
hselbie
  • 1,749
  • 9
  • 24
  • 40
9
votes
1 answer

Geoserver ERROR: function postgis_lib_version()

in geoserver whene i need to creat a new data store after to creat new workspace, i have this error Error creating data store, check the parameters. Error message: Unable to obtain connection: ERROR: function postgis_lib_version() does not exist…
oustyle
  • 103
  • 1
  • 10
9
votes
2 answers

PostGis clustering with other aggregate

I would like to compute cluster of points and, for each cluster to get the sum of a specific attribute (let say, the sum of the score of each point in the cluster) I already managed to build clusters using ST_ClusterWithin but I cannot compute the…
Chris
  • 2,744
  • 3
  • 24
  • 39
9
votes
3 answers

Data migration from MS SQL to PostgreSQL using SQLAlchemy

TL;DR I want to migrate data from a MS SQL Server + ArcSDE to a PostgreSQL + PostGIS, ideally using SQLAlchemy. I am using SQLAlchemy 1.0.11 to migrate an existing database from MS SQL 2012 to PostgreSQL 9.2 (upgrade to 9.5 planned). I've been…
iled
  • 2,142
  • 3
  • 31
  • 43
9
votes
2 answers

ActiveRecord Subquery Inner Join

I am trying to convert a "raw" PostGIS SQL query into a Rails ActiveRecord query. My goal is to convert two sequential ActiveRecord queries (each taking ~1ms) into a single ActiveRecord query taking (~1ms). Using the SQL below with…
Ryan
  • 6,432
  • 7
  • 40
  • 54
9
votes
2 answers

how to calculate percentile in postgres

I Have table called timings where we are storing 1 million response timings for load testing , now we need to divide this data into 100 groups i.e. - first 500 records as one group and so on , and calculate percentile of each group , rather than…
sshet
  • 1,152
  • 1
  • 6
  • 15
9
votes
1 answer

Scripting PostGIS setup on Amazon RDS Postgres

I am trying to script the setup of PostGIS on my Amazon RDS Postgres instance. Here is the commands I am running: create extension postgis; create extension fuzzystrmatch; create extension postgis_tiger_geocoder; create extension…
Adam Duro
  • 882
  • 1
  • 9
  • 21
9
votes
2 answers

Geoalchemy2 query all users within X meteres

I have an app that takes an address string, sends it to Google Maps API and gets lat/long co-ordinates, I then want to show the all users within X meteres of this point (there lat/long is stored in my database), I then want to filter the result to…
Crooksey
  • 908
  • 3
  • 11
  • 22