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
18
votes
6 answers

Inserting and selecting PostGIS Geometry with Gorm

I've been trying to find a way to insert and retrieve geometric types using Golang, and specifically the library gorm. I'm also attempting to use the library orb that defines different types for geometries, and provides encoding/decoding between…
robbieperry22
  • 1,753
  • 1
  • 18
  • 49
18
votes
3 answers

How to find intersecting geographies between two tables recursively

I'm running Postgres 9.6.1 and PostGIS 2.3.0 r15146 and have two tables. geographies may have 150,000,000 rows, paths may have 10,000,000 rows: CREATE TABLE paths (id uuid NOT NULL, path path NOT NULL, PRIMARY KEY (id)) CREATE TABLE geographies (id…
David Murdoch
  • 87,823
  • 39
  • 148
  • 191
18
votes
2 answers

Postgres replace characters in string

I have column with text where I need to change characters! For example �ay----> need to be Day �rag---->need to be Drag So I need to replace � with character D. I try next but I get error:invalid regular expression: quantifier operand…
user238271
  • 643
  • 3
  • 11
  • 27
18
votes
4 answers

How to get lng lat value from query results of geoalchemy2

For exammple, class Lake(Base): __tablename__ = 'lake' id = Column(Integer, primary_key=True) name = Column(String) geom = Column(Geometry('POLYGON')) point = Column(Geometry('Point')) lake = Lake(name='Orta',…
Chung
  • 1,063
  • 1
  • 13
  • 21
17
votes
2 answers

Django AttributeError: 'DatabaseOperations' object has no attribute 'select'

I've got a GeoDjango instance connected to a PostGIS database backend. When I query a table in this database, I get the error in the title: AttributeError: 'DatabaseOperations' object has no attribute 'select' As suggested elsewhere, I checked to…
Adam
  • 3,668
  • 6
  • 30
  • 55
17
votes
2 answers

pg_upgrade: "lc_collate values for database "postgres" do not match"

I've just upgraded (using Homebrew) my postgreSql and postGis installations. I can no longer 'brew postgresql-upgrade-database' (as it's telling me that my data is 'error: already upgraded' from a previous attempt; it's not, since the attempt…
Josef M. Schomburg
  • 477
  • 1
  • 5
  • 11
17
votes
2 answers

Geopandas PostGIS connection

I recently started using Geopandas in python for some of my spatial work and am very pleased with it - I'm currently trying to read in PostGIS features and don't quite understand how to parameterize the database connection, and it didn't seem clear…
mweber
  • 739
  • 1
  • 6
  • 17
17
votes
1 answer

Deserialize RGeo column as SphericalPointImpl

there is a table with an RGeo column in Rails 4.2.4 and activerecord-postgis-adapter 3.1.2 class CreateAddresses < ActiveRecord::Migration def change create_table :addresses do |t| t.st_point :coordinates, geographic: true, srid: 4326 …
lessless
  • 866
  • 10
  • 27
17
votes
1 answer

PostgreSQL PostGIS vs ElasticSearch Spatial search

I am working on a search query which needs to do a geospatial filter (i.e. filter all elements outside of a certain radius). We have both PostgreSQL and ElasticSearch as part of our infrastructure and I am evaluating which of the two to use. I'm not…
lmirosevic
  • 15,787
  • 13
  • 70
  • 116
17
votes
2 answers

Can I check whether a multipolygon contains point in PostGIS?

I got one column (latlon) which is a ST_MultiPolygon. The other geometry is a point which I just want to check if it is inside one of my MultiPolygons. I tried: SELECT ST_CONTAINS(latlon, ST_GeometryFromText('POINT(48.208417 16.372472)') FROM…
krackmoe
  • 1,743
  • 7
  • 29
  • 53
17
votes
3 answers

Update multiple rows in a table from another table when condition exists

I have two tables. Table1 contains companies whose locations are georeferenced with lat/lng coordinates in a column called the_geom Table2 also contain the same companies from Table1, not georeferenced, along with hundreds of other companies…
John
  • 802
  • 2
  • 9
  • 19
16
votes
4 answers

Issues installing PostGIS

I'm trying to install PostGIS following these instructions: wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz tar zxvf postgis-1.5.2.tar.gz && cd postgis-1.5.2/ sudo ./configure && make && sudo checkinstall --pkgname postgis-1.5.2…
avatar
  • 12,087
  • 17
  • 66
  • 82
16
votes
1 answer

How to alter the path for Postgres looking for extensions?

I installed Postgres on a Windows machine, downloaded the binary installer for PostGIS and installed it. I only have one version of Postgres, so there is no messing up possible. Installing PostGIS using the binary installer is straight forward and…
TomGeo
  • 1,213
  • 2
  • 12
  • 24
16
votes
3 answers

create postgis extension syntax error at or near "PARALLEL"

When I try to enable the postgis extension in postgresql on windows I get the following error: syntax error at or near "PARALLEL" I have been looking, but cannot find anyone with this error. Any help?
Jens de Bruijn
  • 939
  • 9
  • 25
16
votes
2 answers

Multicolumn index on 3 fields with heterogenous data types

I have a postgres table with 3 fields: a : postgis geometry b : array varchar[] c : integer and I have a query that involves all of them. I would like to add a multicolumn index to speed it up but I cannot as the 3 fields cannot go under the same…
nourdine
  • 7,407
  • 10
  • 46
  • 58