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
1 answer

How to use Geodjango snap_to_grid on geography Field (not geometry)

I create a table using geodjango with a column location = models.PointField(geography=True). class Point(models.Model): location = models.PointField(geography=True) Later I want to use ST_snapToGrid method to cluster those locations. But if I…
MorningBAI
  • 108
  • 6
2
votes
1 answer

Display POSTGIS data in a JMapFrame with GeoTools

EDIT: For information : create style with StyleLab example and it will display what you want. I'm trying to display POSTGIS data with GeoTools I did the examples in : http://docs.geotools.org/stable/userguide/examples/ : With QueryLab i can display…
2
votes
1 answer

PostGIS SQL to generate separate line segments from a set of points, with varying IDs

All, I'm probably trying to push the SQL angle too far, but I need to generate simple two vertice line segment from a set of GPS tracking points as a feed from many vehicles(veh_id). The resulting line segments are also grouped in the input by…
blammo
  • 21
  • 3
2
votes
1 answer

Postgresql add rule to column to transform data on select

I want to have a column that stores data in one format (Postgis geography format), but whenever it is subjected to select query, it should be transformed with function and returned in another format. Is it possible? Will it affect queries like…
Nameless
  • 2,306
  • 4
  • 23
  • 28
1
vote
1 answer

postgreSQL update all column rows with subselect without link between tables. Can I avoid plpgsql?

This SQL gives me a list of IDs and the point-in-polygon count. select count(*), poly.gid from inpn p INNER JOIN half_degree poly ON poly.the_geom && p.the_geom and CONTAINS(poly.the_geom, p.the_geom) group by poly.gid count gid 10 …
user1249791
  • 1,241
  • 4
  • 14
  • 33
1
vote
1 answer

Compiling PostGIS for PostgreSQL 9.1 on Mac

I'm really banging my head off a wall now with this. I've installed PostgreSQL from the DMG on the Postgres site. I now have version 9.1. I then used the Stack Builder to install the PostGIS extension. But despite downloading and going through the…
John H
  • 2,488
  • 1
  • 21
  • 35
1
vote
1 answer

What is wrong with this PostgreSQL statement?

I have the following statement that I need to run on a table which has a geometry column. I am getting a WKT from Oracle using my C# program and then attempting to insert it into PostgreSQL using an npgsql connection. highways=# INSERT INTO…
CSharpened
  • 11,674
  • 14
  • 52
  • 86
1
vote
1 answer

Equivalent spatial types for insert statement

I have a number of files containing vast amounts of Insert statements (which were generated by Toad for Oracle) which I need to run on a Postgresql database. Sounds simple I know but there are also oracle specific spatial data types in there which…
CSharpened
  • 11,674
  • 14
  • 52
  • 86
1
vote
2 answers

PostGIS geometry database query

I have several tables that contain multipolygons. I need to find points within these polygons that I can use in my java test class. What I have been doing is sending a query to return all the multi polygons, choose a vertex to use as a point, and…
cool mr croc
  • 725
  • 1
  • 13
  • 33
1
vote
1 answer

Bind variable options

Is it possible to denote a bind variable in SQL Server using the same notation as Oracle i.e. :0, :1 instead of using ?. I have searched but not found anything conclusive on this. At the moment my solution uses bind variables to introduce values to…
CSharpened
  • 11,674
  • 14
  • 52
  • 86
1
vote
2 answers

setting up Postgresql 9.1 database in Django for ubuntu 11.10

I am trying to configure Postgresql 9.1 in Django 1.3 . Note: I am doing this in Ubuntu 11.10 (oneric). Also I have postgis 1.5 installed to work with Postgresql 9.1 To my best knowledge, I have installed all the dependencies required. I read the…
Jigish Chawda
  • 2,148
  • 1
  • 22
  • 29
1
vote
1 answer

Getting an error while running rake command on a rails 2 project

I am runnning a rails 2 project with the following gems, georuby, spatial_adapter. And Postgres db as backend. But I am facing this error. I tired installing postgis also but still get this. Any ideas what i should try. This is a rails 2.3 project…
hungry fish
  • 188
  • 1
  • 3
  • 12
1
vote
1 answer

How to correctly render features with GeoTools to an image using AffineTransformation?

I'm trying to correctly render some features I read from a featuretable of a PostGIS enabled database with GeoTools to an image. My configuration: PostgreSQL 8.4 PostGIS 1.5 Osmosis 0.40.1 OSMembrane build 845 GeoTools 2.7.4 Rendering some…
pmoule
  • 4,322
  • 2
  • 34
  • 39
1
vote
0 answers

Send a PostGIS object through RestFul service (JSON)

all. This is my first question, so forgive if I do anything wrong. Here we go. I have a problem while trying to send a PostGIS Object (actually a PGgeometry) through a RestFul service. The class I'm trying to send is…
Gayolomao
  • 586
  • 4
  • 15
1
vote
2 answers

When to store longitude and data in a spatial enabled DBMS and when to store as Float?

I have a bunch of latitude and longitude data from my GPS running watch, and I want to store that in a DB, I've been reading about GIS but I don't know what does a spatial enabled DBMS like PostGIS allows me to do that simply storing the data as…
RinoFM
  • 78
  • 1
  • 6