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

1
vote
2answers
41 views

How can I speed up these queries

I am trying to make some calculations using PostGIS and PostgreSQL. There are 3 important tables : wbn, wgo and wvb. These tables have about 500.000 objects in them (geometries). The problem is that ...
1
vote
0answers
13 views

PostGIS 3D Extrude function

I selected buildings from OSM (which represents my city). I insterted a new column 'height' and I filled with a random number exactly number 2, so every building have 2metres altitude. Buildings are ...
1
vote
0answers
34 views

Raster slightly displaced after exporting from PostGIS database

With the following queries I've exported a raster (GTiff) from my postgis database: 1.Creating a large object: WITH buffer AS ( SELECT id, ST_Buffer(geom,50) AS geom FROM ...
1
vote
1answer
25 views

3D functions with SFCGAL in PostGIS

I have this setup: "POSTGIS="2.1.2 r12389" GEOS="3.3.8-CAPI-1.7.8" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.2, released 2012/10/08" LIBXML="2.7.8" LIBJSON="UNKNOWN" TOPOLOGY RASTER" on ...
2
votes
2answers
39 views

Do I still have to use a template DB for PostGIS?

createdb mydb -T template_postgis Is this -T template_postgis still necessary in new versions of PostGIS? I never saw this db being different, it always has those 3 sql files you run there. Is this ...
1
vote
1answer
32 views

ST_Union to merge tables containing lines?

I have to build a street network with Postgis that will be used with pgrouting. I have two tables: 1) the_network (182 lines): is a MULTILINESTRING table. Having columns road_name (varchar) / ...
1
vote
1answer
28 views

Trying to understand / troubleshoot intersection behavior of postgis

I'm trying to calculate the percent of intersection between two polygons using postgis. I was able to do so successfully for 90% of my polygons, but about 1500 have very unexpected values. I ...
1
vote
1answer
28 views

Weird ST_Contains behaviour

I'm creating a polygon and then checks whether one of the origin points is contained inside the polygon. To my surprise, I get False (?!) What is wrong here? SELECT ST_contains(ST_GeomFromText('POINT ...
4
votes
1answer
54 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
25 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 ?
2
votes
1answer
33 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
34 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
41 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
36 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
59 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 ...
2
votes
1answer
76 views

How to create a buffer on a linestring with varying or increasing/decreasing width

I want to buffer rivers/streams for a topographic map. I'm using a PostgreSQL/PostGIS database. Usually, I create buffer with ST_Buffer with a constant width. For example, the width of a river buffer ...
0
votes
0answers
29 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 ...
3
votes
3answers
94 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: ...
1
vote
3answers
60 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
16 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
29 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
43 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
96 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? ...
0
votes
0answers
24 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 ...
1
vote
1answer
55 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
52 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
64 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
72 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
197 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
55 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
210 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 ...
2
votes
1answer
48 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 ...
3
votes
0answers
87 views

POSTGIS SQL - How do I remove (defined) sliver polygons

I would like assistance in writing SQL (for POSTGIS in postgresql) to remove sliver polygons (including long narrow slivers and some small irregular polygons that were erroneous 'gaps' in the original ...
3
votes
1answer
297 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 ...
2
votes
1answer
121 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 ...
0
votes
1answer
89 views

Python Geoserver gsconfig create resource from Postgis store table

I've working Workspace and PostGIS store in GeoServer. I would like to use python and gsconfig to create new resource/new layer from existing PostGIS table, with: computing bbox, adding abstract, ...
1
vote
2answers
49 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
71 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
52 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
45 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
46 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
1answer
68 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
53 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 ...
6
votes
1answer
145 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 ...
0
votes
1answer
39 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
120 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 ...
1
vote
0answers
96 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 ...
1
vote
0answers
127 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
88 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
74 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 ...