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
229
votes
7 answers

Get PostGIS version

How can I find out which version of PostGIS I have?
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
226
votes
7 answers

Which data type for latitude and longitude?

I am newbie to PostgreSQL and PostGIS. I want to store latitude and longitude values in PostgreSQL 9.1.1 database table. I will calculate distance between two points, find nearer points by using this location values. Which data type should I use…
user1008404
  • 2,307
  • 2
  • 14
  • 6
134
votes
15 answers

Postgis installation: type "geometry" does not exist

I am trying to create table with Postgis. I do it by this page. But when I import postgis.sql file, I get a lot of errors: ERROR: type "geometry" does not exist Does anybody know how can I fix it?
yetty
  • 2,326
  • 2
  • 19
  • 22
73
votes
13 answers

FATAL ERROR lock file "postmaster.pid" already exists

I have recently installed PostGIS on my Mac (El Capitan 10.11.4, Postgres is version 9.5.1) using Homebrew, and I am following these instructions - http://morphocode.com/how-to-install-postgis-on-mac-os-x/ When I try to start Postgres using pg_ctl…
skwidbreth
  • 7,888
  • 11
  • 58
  • 105
72
votes
5 answers

GIS: PostGIS/PostgreSQL vs. MySql vs. SQL Server?

EDIT: I have been using Postgres with PostGIS for a few months now, and I am satisfied. I need to analyze a few million geocoded records, each of which will have latitude and longitude. These records include data of at least three different types,…
Aren Cambre
  • 6,540
  • 9
  • 30
  • 36
52
votes
7 answers

How to intelligently degrade or smooth GIS data (simplifying polygons)?

I have detailed US county maps, from the TIGER LINE data sets. How might I sample, smooth, or degrade the data so that I get straighter, more boxy, less "noisy" shapes to represent the geographical features -- in this case just county boundaries and…
unmounted
  • 33,530
  • 16
  • 61
  • 61
50
votes
7 answers

JPA/Hibernate Native Queries do not recognize Parameters

I am using Hibernate/JPA to execute native PostGIS queries. The problem with these queries is that they need parameters that are not of the classical X = 'value' form. For example, the following lines crash String queryString = "select * from Cell…
user99054
  • 599
  • 1
  • 4
  • 5
49
votes
2 answers

What is ST in PostGIS?

Almost all the functions in PostGIS start with ST. e.g. ST_Distance_Sphere, ST_GeomFromText, ST_Intersection, etc. What does ST mean? http://www.postgis.org/documentation/manual-svn/PostGIS_Special_Functions_Index.html
hekevintran
  • 22,822
  • 32
  • 111
  • 180
43
votes
2 answers

What's the "E" before a Postgres string?

I was reading a Postgres/PostGIS statement like this: SELECT ST_AsBinary( ST_GeomFromWKB( E'\\001\\001\\000\\000\\000\\321\\256B\\312O\\304Q\\300\\347\\030\\220\\275\\336%E@', 4326 ) ); The above creates something from a Well Known Binary…
thor
  • 21,418
  • 31
  • 87
  • 173
39
votes
4 answers

How do I add PostGIS to PostgreSQL pgAdmin?

I've got PostgreSQL and pgAdmin installed, but I want to add a PostGIS server so I could work on a Geographic Informations System project. I'm following this tutorial, which assumes PostGIS is set up. In the previous page of the tutorial, it…
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
39
votes
6 answers

How do you know what SRID to use for a shp file?

I am trying to put a SHP file into my PostGIS database, the the data is just a little off. I think this is because I am using the wrong SRID. The contents of the PRJ file are as…
priestc
  • 33,060
  • 24
  • 83
  • 117
35
votes
5 answers

PostgreSQL latitude longitude query

i have latitude and longitude columns in location table in PostgreSQL database, and I am trying to execute distance query with a PostgreSQL function. I read this chapter of the…
Idan
  • 901
  • 4
  • 13
  • 29
34
votes
3 answers

How do I convert a latitude/longitude pair into a PostGIS geography type?

I'm trying to load a bunch of latitude/longitude pairs into a PostGIS geography type so as to be able to query by location. In particular I have a table with float latitude and longitude columns and a geography(Point, 4326) column. I would like to…
DRMacIver
  • 2,259
  • 1
  • 17
  • 17
30
votes
2 answers

Get the SRID of a geometry field

I have a table with some geometry types in and need to be able to return the SRID of a given field. How can I do this. I have had a search but all I can find is the function to alter a SRID. In Oracle I am doing this: A.CLUSTER_EXTENT.SDO_SRID Is…
CSharpened
  • 11,674
  • 14
  • 52
  • 86
30
votes
7 answers

Hibernate Spatial 5 - GeometryType

After upgrading Hibernate-spatial to Version 5.0.0.CR2 the following declaration doesn't work anymore: @Column(columnDefinition = "geometry(Point,4326)") @Type(type = "org.hibernate.spatial.GeometryType") private Point position; with…
Denis Lukenich
  • 3,084
  • 1
  • 20
  • 38
1
2 3
99 100