Version 2.0 of PostGIS brought a heavy set of new extensions for the PostgreSQL object-relational database, adding greater support for spatial objects.

learn more… | top users | synonyms

3
votes
1answer
183 views

Improve speed of PostGIS “nearest neighbor” query?

One of the features of the Python/Django/PostgreSQL web application I'm building is that a user will be able to see the 100 other users who are nearest to them, sorted by distance. I'm using PostGIS ...
0
votes
0answers
49 views

PostGIS: calculate width/length of rectangular surface

I have rectangular shaped surfaces (multipolylines) and I need to calculate the width and/or length.. they have a rectangular shape but they're not real rectangles. Is there a way to do this ?
1
vote
2answers
270 views

Start postgresql+postgis without installation on Windows

I have used Windows7x64 and want start PostgreSQL+POSTGIS without installation process. I copy PostgresSQl\9.1 folder from other laptop to c:\opt. I need create .bat file with enviroment variables and ...
2
votes
1answer
110 views

POSTGIS: function st_collect(geography) does not exist

I am trying to use some Geography functions, but I am getting an error that (all) functions are not existing. I have checked other Stackexchange posts (e.g. this one), but the solutions did not work ...
1
vote
1answer
43 views

PostgreSQL : question about SELECT .. WHERE .. = max()

If you have, for example; SELECT * FROM data WHERE line = min( (SELECT length FROM lines) ) AND number < 500; (It's just an example, not a real code) How does PostgreSQL react when the ...
0
votes
1answer
64 views

Postgis query not using the spatial index

I've been using postgres8.3/postgis1.5 for some time, and it works well. I've moved my entire database to a new, faster machine and upgraded to postgres9.3/postgis2.1 using pg_dump/postgis_restore.pl, ...
0
votes
0answers
132 views

Problems moving POSTGIS database from postgresql 8.3 to 9.3 using Navicat

I am using Navicat 11 to move a POSTGIS database from 8.3 to 9.3 on Mac OS X 10.9. I have installed PostgreSQL 9.3 and PostGIS with homebrew (brew install postgresql postgis) and everything looks ok. ...
2
votes
1answer
87 views

Problem with matching a buffer in Openlayers and the same buffer in PostGIS query

I am using a buffer tool to create a buffer on my base map in Openlayers. In addition to creating and visualizing this buffer, I pass the center point and radius to a query. The query collects all ...
4
votes
3answers
231 views

How to create random points in a polygon in PostGIS

I have a polygon layer, and would like to generate random points in each polygon. An initial searching in Google resulted this website which presents a function for this purpose: ...
0
votes
0answers
66 views

Postgis performance: st_dwithin vs static buffer and st_contains

I have a table with a polyline column. I need to find which of those polylines are within 20 meters from a bunch of moving points. I can do this no problem with st_dwithin(). What I would like to know ...
1
vote
3answers
96 views

Geometry vs geography for line-to-polygon intersection

I have two WGS84 NAD83 shapefiles, one polygonal, the other containing lines: Geometry: Polygon Feature Count: 1294 Extent: (-79.761059, 44.991143) - (-57.105486, 62.582865) Layer SRS WKT: ...
0
votes
0answers
25 views

Postgis and osm2pgsql: find all cities that belong to selected state [duplicate]

I'm pretty new to postgis, so I don't quite understand it's mechanisms yet. My task is to build database with relations: +---------+ +------------+ +----------+ | country | | adm_unit ...
0
votes
0answers
32 views

Transforming multiple LineStrings to shape for ST_Contains

I want to find cities, villages etc inside each region of Poland. For most of them querying something like this is enough: ... AND ST_Contains((SELECT way FROM planet_osm_polygon WHERE osm_id = ...
1
vote
1answer
49 views

ST_AsLatLonText returns wrong data

I want to list all cities in lubelskie vovoidenship, which is relation 130919. I also want to get latLong data for each city. To perform this I do: SELECT name, ST_AsLatLonText(way), place ...
1
vote
1answer
60 views

Problem with runing a loop in a query in PostGIS

I am new to PostGIS and I have a question which can't solve. I have a table of buildings each having a value for number of people living in it. I would like to calculate the total value (sum of number ...
2
votes
3answers
131 views

Problem with result of query in PostGIS

I run the following query and irrelevant of the point coordinates and radius I always recieve all the records of the table I'm querying. Can anyone point out what the problem could be with this query? ...
2
votes
1answer
233 views

PostGIS: How to ST_Clip() a raster with a polygon?

I have done: Import a SHP file into PostGIS by PostGIS SHP loader GUI. Import a raster into PostGIS: \raster2pgsql -I -s 4326 landsat.TIF -t 500x500 public.landsat > query.sql After importing ...
1
vote
1answer
88 views

Problem with using a circle as polygon for querying PostGIS

I'm trying to query PostGIS and find some object features that intersect with a circular buffer created by the user using OpenLayers, JavaScript and PHP. I use the following code for creating the ...
2
votes
1answer
161 views

Problem with reading data from PostGIS as KML file using PHP

I am using the following PHP code in order to read data from PostGIS and save it in KML format as a file. When I load the page a document with ".PHP" extension is returned (not .kml) which inside has ...
2
votes
2answers
178 views

Problem in running query on PostGIS using PHP

Would you kindly help me solving this problem. I'm trying to use the PHP code provided here in order to read geo-data from PostGIS. The code seems clear without any problem (also nobody has ...
2
votes
1answer
348 views

Add PostGIS spatial functions to a custom schema other than “public” in PostgreSQL

I am new to PostgreSQL and PostGIS. Recently, I created a PostGIS 2.0.3 database on a PostgreSQL 9.1 database server using pgAdmin. The "PostGIS" extension was found installed in "Extensions". Al ...
3
votes
1answer
1k views

Loading Shapefiles into PostGIS using shapefile import/export manager

I am a complete beginner with PostGIS. I've started learning it using the tutorials provided by Boundless. In section 4 of this tutorial where I want to import shapefile in PostGIS, I do not have the ...
0
votes
1answer
81 views

Routing result not showed up [closed]

I'm following the http://workshop.pgrouting.org/ but my routing result not showed up at all, like the picture below: my firebug also didn't give me an error, I'm using geoserver 2.4.2, postgresql ...
1
vote
5answers
424 views

Problem installing PostGIS on Ubuntu Server 13.10

I've installed PostgreSQL 9.1 and postgis on Ubuntu Server 13.10 as follows: sudo add-apt-repository-ppa:ubuntugis/ubuntugis-unstable apt-get update apt-get install postgresql-9.1-postgis then I ...
3
votes
1answer
531 views

osm2pgsql loses connection at end of import for large PBF, north-america-latest.osm.pbf

I just wanted to check and see if anybody else out there encountered this issue before I started diving into the code. I'm using osm2pgsql to import OSM data into my Postgres database. I encounter the ...
1
vote
1answer
131 views

How Do I configure PostGIS 2.0 on windows to use ST_GeomFromGeoJSON?

I have installed PostGIS 2.0 on a Postgres 9.1 database on a Windows 2012 Server. I need to write an insert query, which uses ST_GeomFromGeoJSON(). The Docs for this query say that I need - JSON-C >= ...
2
votes
1answer
54 views

Is there a way to use some sort of “instancing” when storing polygons in a spatial database?

I am quite new to GIS database addons, and I am still exploring the possible uses for them. In general the idea of storing objects indexed by their position which enables additional operations is ...
1
vote
1answer
588 views

PostGIS Select Union of Polygons

I have a Postgres 8.4 PostGIS 2.0 enabled database and I've loaded it up with a bunch of shapefiles. I'm trying to get the database to do on-the-fly unions of geometries. Here is the query I'm ...
3
votes
1answer
728 views

Copy a spatial table from one PostGIS database to another PostGIS database

I have two PostGIS databases on two different servers. The first server is PostGIS 2.0 and the second server is PostGIS 1.5. On the PostGIS 2.0 I have a table "lakes" with MULTIPOLYGON geometry ...
4
votes
3answers
2k views

Loading geotiffs into PostGIS using raster2pgsql

I have an issue with loading some Ordnance Survey raster data into PostGIS. I have been using the following raster2pgsql command to load a tif that I have placed in my C:\Program ...
1
vote
2answers
83 views

ST_Length (GEOM, true) for calculating distances in Geographic Reference System

Good afternoon all, I use (1) ST_Length (ST_Transform (geom, 3395)) to get distances in meters from points in Geographic Reference Systems EPSG: 4326. The thing is I found that with (2) ST_Length ...
2
votes
1answer
138 views

GeoDjango: read geometry column in geography field

I have a Django application that needs to work with an existent PostGIS database, apart from its own database. I've configured multidatabase support, created a database router, created models for the ...
2
votes
1answer
74 views

PostGIS ST_SummaryStats

I need some help writing the sql for returning the "MEAN" value from a raster(in postgis db) that intersects a defined(inquery) polygon(in postgis db). The polygon layer is called: ...
0
votes
1answer
49 views

Where and what format GIS data is suitable for me? [closed]

I am a student on computer science.Now , I am on a competition which is to develop a taxi recommendation system for Beijing ,China. I am now looking for the GIS data of Beijing. The key step is , ...
0
votes
2answers
55 views

Select area which is at least x meters away from other geometries

In my table I have the build-up area from a region as a big number of polygons. urban_area: id | name | geometry(polygon) I was wondering if and how I would be able to find the area within a ...
1
vote
0answers
80 views

St_OffSetCurve with self-crossing lines

I have about 50,000 linestrings in PostGIS. They represent routes along roads. But I want them to be (roughly) pavements (aka sidewalks) instead. So I need to move all the lines 3 metres to the left ...
1
vote
1answer
78 views

Get DISTINCT nearest neighbors with indexed search

I'm using the indexed nearest neighbor search to return the closest points to a given starting location. My points also have attributes like color and shape, stored as strings. I want each query to ...
1
vote
2answers
61 views

Ogr2ogr - shape to postgis - is there a way to use and preserve an existing primary key?

I've been struggling with this for a while, tried a few different ideas inspired by these pages: http://www.gdal.org/ogr2ogr.html http://www.gdal.org/ogr/drv_pg.html ...
8
votes
1answer
236 views

What is the precision of SELECT DISTINCT on PostGIS geometry column?

I wonder what the precision of the SELECT DISTINCT operator is on a PostGIS geometry. On my system, the following query gives me a count of 5, which means that the inserted points are considered equal ...
2
votes
1answer
37 views

Weird behaviour of ST_Project with PostGIS2

somehow I can't understand the results of ST_Project, but maybe this problem is just me being stupid (again): Note: I use geography-type here, but the results are the same for geometry. I use a ...
0
votes
1answer
53 views

Problem with double field type in postgis database

I have connection to PostGIS spatial database through ArcSDE, and all double type numeric fields are cutting numbers after comma. Does anyone know how can I fix this problem?
0
votes
1answer
271 views

How to install pgrouting 2.x on ubuntu 12.04 LTS

I try to install pgrouting 2.0 on ubuntu 12.04 LTS with postgresql 9.2 I have ppa in the system by sudo add-apt-repository ppa:gwibber-daily/ppa answer: `You are about to add the following PPA to ...
6
votes
5answers
2k views

How to split OSM roads into individual segments at intersections?

I want to create a road-network for use with pgRouting using OpenStreetMap data. I loaded a shapefile from GeoFabrik into a Postgres table (with PostGIS enabled). However, one problem I had was that ...
2
votes
2answers
607 views

Importing planet files into Nominatim

After a gruesome night installing PostgreSQL 9.1, PostGIS 2 and Nominatim 2 on CentOS 6.3 using the instructions here, I am finally at the stage of importing a US planet file. Problem: In ...
1
vote
0answers
118 views

identify subgraphs within planet_osm_line table

I want to identify subgraphs within the planet_osm_line table of the osm2pgsql-schema. those subgraphs are classified by certain tags i want to check. My first attempt was to do this recursively with ...
0
votes
1answer
147 views

ImageMosaic-JDBC Error

I'm trying to get postgis raster layers in geoserver-2.3.1, with postgresql-8.4, postgis-2.0 and gt-imagemosaic-jdbc-9.1.jar support. I'm going through the tutorial with a PNG raster that i have. In ...
1
vote
0answers
178 views

Problem Installing pgRouting 2.0; libcgal8 dependency

I've been trying to install PostGIS and pgRouting on an AWS Ubuntu server (first tried 13.10, then reverted to 12.04, both 64bit "small" instance) for several days now but no matter what I do I keep ...
0
votes
1answer
159 views

Coordinate Conversion in PostGIS

I have some problem with the representation of the coordinates. I need to convert the coordinates from "EPSG: 32633" to "EPSG: 4326", and then create geometries in PostGIS. For the conversion (from ...
0
votes
1answer
84 views

PostGIS Transform distance or create a view

I have a postgis table that is updated on a regular basis so it is not practical to cast my geometry column to geography So can I modify the following query to convert a distance say 0.5k into ...
0
votes
1answer
77 views

Installation extension functions to pgRouting

I'm trying to find sql source of functions routing_dd.sql and routing_dd_wrappers.sql I'm working on Windows 7 32bit. The only one link to that wrote by Underdark is empty: Both are available ...