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

PostgreSQL 12 and PostGIS 3.0.1: ERROR: could not access file "$libdir/postgis-3": No such file or directory on Linux

I have Linux Mint 19.2 where I installed the newest PostgreSQL 12 using: sudo apt-get install postgresql Similarly, I installed the newest Postgis 3.0.1 using: sudo apt-get install postgis I setup postgres account and everything and wanted to create…
janchytry
  • 320
  • 2
  • 12
14
votes
4 answers

How to install Postgis to a Keg installation of Postgres@9.6 using Homebrew?

I have installed Postgresql@9.6 and Postgis via Homebrew. However, installing Postgis via Homebrew installs the latest version of Postgresql at 10 as dependency and pinning Postgresql at 9.6.5 blocks the install of Postgis via Homebrew. Performing…
14
votes
2 answers

Creating Postgis extension: "ERROR: could not open extension control file"

I am getting the following error when I run create extension postgis; ERROR: could not open extension control file "/Library/PostgreSQL/9.6/share/postgresql/extension/postgis.control": No such file or directory I am using Postgres 9.6.3 and PostGIS…
Fiona
  • 151
  • 1
  • 1
  • 6
14
votes
3 answers

Sequelize geospatial query: find "n" closest points to a location

Using Sequelize and geospatial queries, if I want to find the "n" closest points to a certain location, how should the Sequelize query be? Assume I have a model that looks something like this: sequelize.define('Point', {geo:…
Pensierinmusica
  • 6,404
  • 9
  • 40
  • 58
14
votes
5 answers

Insert POINT into postgres database

I need to insert/update a point column type in postgres database. I'm using node-postgres The script generated using POSTGRES admin panel shows the update query as UPDATE public.places SET id=?, user_id=?, business_name=?, alternate_name=?,…
Deepak Bandi
  • 1,854
  • 4
  • 21
  • 37
13
votes
2 answers

GeoDjango within a NE, SW box

I'm creating a geo app with Google Maps and I receive bounding box as 2 coordinates: north east south west I have a model with PointField. from django.contrib.gis.db import models class Place(models.Model): name =…
FrEaKmAn
  • 1,785
  • 1
  • 21
  • 47
13
votes
6 answers

How can I query the nearest record in a given coordinates(latitude and longitude of string type)?

I am using GeoDjango with PostGIS. Then I am into trouble on how to get the nearest record from the given coordinates from my postgres db table.
eros
  • 4,946
  • 18
  • 53
  • 78
13
votes
3 answers

Django: Could not find the GDAL library (OSX)

After my old macbook died I am transferring across a Django Webapp I'd been building to my new machine (which is a MacBook Pro M1 2021). I am currently in the process of reinstalling the correct packages and extensions for the app. However I am…
deadant88
  • 920
  • 9
  • 24
13
votes
2 answers

What is the meaning of && in PostGIS?

In PostGIS, what is the result of the && operation between two geometries? In my mind, && returns a boolean, but does return geometry this time. In the following example, the operation is between a LineString and a Polygon. Firstly, I guess this is…
sh g
  • 173
  • 1
  • 6
13
votes
5 answers

How to determine if postgis is enabled on a database?

I wanted to know if there is a way to determine that PostGis was enabled on a database. I am trying to replicate my production server with my dev machine and I am not sure if the database on my dev machine had either PostGIS or postgis_topology…
MistyD
  • 16,373
  • 40
  • 138
  • 240
13
votes
4 answers

django error on migration: "There is no unique constraint matching given keys for referenced table

So I have seen that a lot of these kinds of questions have popped up (few answered) and none in a Django aspect that I saw. I am confused why I am getting the error, I am guessing i am missing something on my field decorator or what not in my model…
Codejoy
  • 3,722
  • 13
  • 59
  • 99
13
votes
4 answers

Iterate through table, perform calculation on each row

I would like to preface this by saying I am VERY new to SQL, but my work now requires that I work in it. I have a dataset containing topographical point data (x,y,z). I am trying to build a KNN model based on this data. For every point 'P', I search…
Canadian_Marine
  • 479
  • 1
  • 4
  • 10
13
votes
4 answers

Display Map like OpenStreetMap

I like the way OpenStreetMap display its map. It almost looks like Google Map. I have already installed GeoServer and PostGis on my notebook. I also got this cloudmade osm file for my country, Indonesia. I downloaded indonesia.osm.bz2. I…
deerawan
  • 8,002
  • 5
  • 42
  • 51
13
votes
3 answers

How to connect to multiple PostgreSQL schemas from Django?

In my GeoDjango project I want to connect to a legacy PostgreSQL/PostGIS database. It contains the following schemas: data // contains all the geospatial data django // empty, created by me public // system tables such as spatial_ref_sys I want…
JJD
  • 50,076
  • 60
  • 203
  • 339
13
votes
1 answer

GeoDjango, what SRID to use for PointField interfacing with Google Maps V3 API?

I am a bit confused, what should I set my SRID value to in my GeoDjango PointField to stay accurate in the context of addresses being geocoded via google maps api into coordinates and distances being queried via django-postgis? Im getting mixed…