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

Can't save polygon with PostGIS/RGeo

How do you save a polygon using the PostGIS adapter for Rails? In my model I have: self.rgeo_factory_generator = RGeo::Geos.factory_generator set_rgeo_factory_for_column(:bounds, RGeo::Geographic.spherical_factory(:srid => 4326)) but then when I…
Avishai
  • 4,512
  • 4
  • 41
  • 67
2
votes
2 answers

PostGIS functions integrated in php example?

I'm writing a client for a postgreSQL database with PostGIS functions. this client of course communicates through php. However I'm looking for a proper documentations for available postGIS functions that i can call from my php files. I would really…
Kourosh
  • 608
  • 2
  • 14
  • 34
2
votes
2 answers

rails gem install pg

I want to install the gem pg onto my windows 7 machine with: gem install pg But it fails every time with following error: Fetching: pg-0.14.1-x86-mingw32.gem (100%) Successfully installed pg-0.14.1-x86-mingw32 1 gem installed Installing ri…
krackmoe
  • 1,743
  • 7
  • 29
  • 53
2
votes
1 answer

Converting id's in int[] elements in another table Postgres

I have a table that contains an array of ints (we'll call it lineTable). That array of int's represents an array of unique id's in another table (pointTable). The point table in turn contains 3 columns (id, x, y). I want to be able to convert…
gibetcher
  • 55
  • 2
2
votes
2 answers

How to calculate distance from point A to point B taking into account the availability of roads and public transport?

Imagine I have a PostGIS database with following pieces of information OSM (OpenStreetMap) of a city, the roads/streets inside the city and the routes of public transport in that city. I want to calculate distance from building A to building B…
Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
2
votes
2 answers

Importing OpenStreetMap data into PostgreSQL database

I'm trying to import one of the following OpenStreetMap maps 1, 2, 3 into a PostgreSQL database using calls like call osmosis.bat --read-xml file="map.osm" --write-pgsimp user="ccp-web-user" database="ccp-web2" password="ccp-web-password", but I…
Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
2
votes
1 answer

How to insert into geometry_columns in postgis 2.0

Hello. When I used postgres 8.4 and postgis 1.5, I register tables (for example, for qgis) with coordinates in geometry_columns. But now, in postgres 9.2 and postgis 2.0, geometry_columns it's view! And view geometry_columns consists of system…
Kris Ku
  • 1,507
  • 1
  • 16
  • 32
2
votes
3 answers

Calling a function on every row returned by a subquery

I need to run the following query to extract the values of my raster records in a specific point. select st_value((select rast from mytable), (select st_GeomFromText('POINT(30.424 -1.978)', 4326))) But I encounter with the following…
f.ashouri
  • 5,409
  • 13
  • 44
  • 52
2
votes
1 answer

Ruby on Rails + PostGIS model custom initialization and custom JSON output

I am using PostgreSQL + PostGIS to work with spatial data and I am also using this gem activerecord-postgis-adapter to keep it easy to write code. I have this model class Device < ActiveRecord::Base attr_accessible :location …
xissburg
  • 618
  • 5
  • 14
2
votes
1 answer

Nested query as PostGIS function parameter

I have a PostGIS query where I really need to have nested queries inside PostGIS function calls: UPDATE raw.geocoding SET the_geom = ST_Centroid( ST_Collect( SELECT the_geom FROM raw.geocoding WHERE hash =…
Aren Cambre
  • 6,540
  • 9
  • 30
  • 36
2
votes
2 answers

issue when trying to create template database postgresql for postgis

I'm using ubuntu 12.04, I have postgis2.1 installed and postgresql9.1... and I'm a newbie for all!... I follow this tuto to create a template database: http://linfiniti.com/2012/05/installing-postgis-2-0-on-ubuntu/ and I'm stuck and don't know what…
Lane
  • 21
  • 1
  • 3
2
votes
3 answers

How to find nearest City of out of a selected set

I need to get the nearest city out of a selected set of cities. Our company has a list of subsidiaries (some 100 in my country). We get around 3000 requests a day. This requests should be assigned to the subsidiaries (by geographical distance). Is…
d0x
  • 11,040
  • 17
  • 69
  • 104
2
votes
1 answer

postgis, extrapolate a line

I'm trying to extrapolate from a line segment to find a point on the line but a 3rd of the way 'back', i.e. trying to find point new, given points A and B below: Given a line, I can interpolate it to get a position at any particular percentage…
EoghanM
  • 25,161
  • 23
  • 90
  • 123
2
votes
2 answers

Using ST_DWithin in subquery (PostGIS)

I have a geometry table with points. All points have unique ID's. Now I want to make a query where I select one point (with id 34567) and make a bufferzone analysis of 5 km around this point. My goal is to select all points more than 5 km away from…
2
votes
2 answers

fe_sendauth: error sending password authentication

I'm now learning Django and am following the Django book step by step. When I proceeded to chapter 5 to connect my Django project to my database, I can't get it to connect. I get the error: FATAL: password authentication failed for user…