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
23
votes
2 answers

How to insert a PostGIS GEOMETRY Point in Sequelize ORM?

I am trying to insert a row in a table that has a geometry column in Sequelize.js ORM. I have latitude, longitude and altitude and need to convert it to a point first so I can Insert it as a geometry. The PostGIS stored procedure that does the…
Muhamed Krlić
  • 1,462
  • 2
  • 16
  • 25
23
votes
2 answers

Drop all functions from Postgres database

I have a database with an old broken version of PostGIS installed in it. I would like to easily drop all functions in the database (they're all from PostGIS). Is there a simple way to do this? Even simply extracting a list of function names would be…
Jim Mitchener
  • 8,835
  • 7
  • 40
  • 56
22
votes
1 answer

Error Saving geodjango PointField

I have a geo model with a PointField property. Everything works perfectly locally, but when I try to save an instance on the server, I get the following error: django.db.utils.DatabaseError: invalid byte sequence for encoding "UTF8": 0x00 I dug…
matthewwithanm
  • 3,733
  • 2
  • 21
  • 27
22
votes
5 answers

PostGIS Error: type "geography" does not exist

I just upgraded my development machine to Windows 7 and am therefore reinstalling PostgreSQL and PostGIS. I used the Postgres Plus installer, as recommended on the Postgres website, and followed this tutorial for installation. I created a database…
Steph
  • 2,135
  • 6
  • 31
  • 44
22
votes
1 answer

How to change SRID of geometry column?

I have a table where one of the columns is a geometry column the_geom for polygons with an SRID. I added a new column in the same table with exactly the same geometry data as the_geom. This new column has the name the_geom4258 because I want to set…
Z77
  • 1,097
  • 6
  • 19
  • 30
21
votes
5 answers

ST_DWithin takes parameter as degree , not meters , why?

The ST_DWithin document says , the third parameter(distance) is in meters. But when I execute some query , it seems it takes the 3rd parameter as 'degree' ? Here is my simplified table structure : > \d+ theuser; Table…
smallufo
  • 11,516
  • 20
  • 73
  • 111
20
votes
1 answer

django.contrib.gis.db.backends.postgis vs django.db.backends.postgresql_psycopg2

If a gis application has some tables which don't have gis related columns, does the performance better when use multiple databases (django.db.backends.postgresql_psycopg2 and django.contrib.gis.db.backends.postgis) compared using…
zhigang
  • 6,597
  • 4
  • 30
  • 24
20
votes
2 answers

How to force drop index relation in postgresql?

In PostgreSQL 9.2 / PostGIS 2.0.2 I had an index on a spatial column, created with CREATE INDEX tiger_data_sld_the_geom_gist ON tiger_data.sld USING gist(the_geom); Subsequently dropped the index with DROP INDEX tiger_data_sld_the_geom_gist; But…
kentr
  • 969
  • 1
  • 11
  • 21
19
votes
5 answers

Change LC_CTYPE for PostgreSQL and PostGIS use

So I'm walking through the GeoDjango tutorial and I'm stuck on this error message: postgres@lucid32:~$ createdb -E UTF8 template_postgis createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US DETAIL: The chosen…
a.m.
  • 2,108
  • 5
  • 24
  • 29
19
votes
2 answers

how to change install postgis location? postgres

When I am in my postgres db and tried to create an extension for my db, I get this error ERROR: could not open extension control file "/usr/share/postgresql/9.5/extension/postgis.control": No such file or directory I know there are so many posts…
Tsuna
  • 2,098
  • 6
  • 24
  • 46
19
votes
3 answers

How to create postgis extension for postgresql in docker?

I'm getting errors when trying to create postgis extensions. Here is what my dockerfile looks like. from postgres RUN apt-get update && apt-get install postgis -y ADD /create_postgis_extension.sh…
user1685095
  • 5,787
  • 9
  • 51
  • 100
19
votes
3 answers

In PostGIS, how do I find all points within a polygon?

I am using PostgreSQL with the GIS extension to store map data, together with OpenLayers, GeoServer etc. Given a polygon, e.g. of a neighborhood, I need to find all LAT/LONG points stored in some table (e.g. traffic lights, restaurants) that are…
Shaul Dar
  • 881
  • 3
  • 10
  • 16
19
votes
1 answer

Postgres GIST vs Btree index

Following on from my previous question on this topic, Postgres combining multiple Indexes: I have the following table on Postgres 9.2 (with postgis): CREATE TABLE updates ( update_id character varying(50) NOT NULL, coords…
kapso
  • 11,703
  • 16
  • 58
  • 76
18
votes
1 answer

Postgis install

I have Postgres version 8.4.8 select version(); PostgreSQL 8.4.8 on i686-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5, 32-bit Installed Postgis via the synaptic package manager, (postgis and…
Orn Kristjansson
  • 3,435
  • 4
  • 26
  • 40
18
votes
2 answers

Install Postgis in docker container

I created a database with docker using the postgres image as usual docker run -d \ --name some-postgres \ -e POSTGRES_PASSWORD=mypassword \ -v ${HOME}/postgres-data/:/var/lib/postgresql/data \ -p 5432:5432 \ postgres now I decided to add a…
DatGuy
  • 377
  • 1
  • 4
  • 10