PostGIS is an extension for the PostgreSQL object-relational database that adds support for geographic objects.

learn more… | top users | synonyms

4
votes
2answers
1k views

postgis error: when adding features geometry has z dimension but column does not

I have to define a geometry column in PostGIS for 2D points, but when I try to import points from DXF to postgres I get the following message: "postgis error: when adding features geometry has z ...
8
votes
4answers
1k views

What is the best web editor and server for postgis?

I'm looking for a web editor (similar to openstreetmap) that works with an map Server (postGIS). This should permit edit and create new structures on map. What is the best option? Can you help me? ...
2
votes
1answer
255 views

How to return nearest point to input lat/long with distance?

I am trying to write a query with PostGIS that returns one row where the geometry of that row is the closest to an input point. I would also like to include the distance between these points in the ...
2
votes
3answers
433 views

How does ST_Azimuth work?

I do not understand the function behaviour. I am giving the function a point B that is North of point A so I would expect something around 90 degrees but I get 263 degrees instead. In another example, ...
6
votes
2answers
2k views

PostGIS ERROR: could not load library “/usr/lib/postgresql91/lib64/postgis-2.0.so”

OS is openSUSE 12.1, PostgreSQL - 9.1, PostGIS - 2.0. Postgre/PostGIS are installed from Application:Geo repository. After recent updates when I try to connect to my database I get the following ...
4
votes
4answers
616 views

Caching / Preloading data for use with WMS queries

Hoping someone can help me with this issue. I've got a map implemented in my web application using OpenLayers that makes WMS queries to GeoServer that in turn queries a Postgres (PostGIS) database to ...
6
votes
2answers
190 views

How to sample a 3D raster along a 3D path (or 4D raster along 4D path)?

I have a 3d raster dataset of atmospheric variables (lat x lon x altitude). I would like to sample this raster dataset along a 3d path. Any idea how I can achieve this, preferable with qgis or ...
3
votes
1answer
85 views

PostGIS - improving sql statement

I've managed to create the below statement that creates a table based on a point in polygon query. However it creates a column that gives a true/false value which I then delete out all the f values ...
11
votes
2answers
365 views

Are there any tricks to using a schema other than public in PostGIS?

I'm currently setting up a fresh install of PostGIS 2.0.2 and PostgreSQL 9.1.6 on Ubuntu. I've recently come across some information indicating that using the public schema to store all data is not a ...
3
votes
1answer
156 views

Creating a vector based design from a raster database

I have a raster table that I've created using Postgis raster. It has 365 records and the table looks like this: +-----+------------+---------+------------+ | rid | rast |filename |date_of data| ...
1
vote
1answer
1k views

SRID 4326 and geometry conversion

From this line: SELECT ST_AsEWKT(geom) FROM buildings LIMIT 1; I get this result: "SRID=4326;MULTIPOLYGON(((404269.308014269 4543087.6184561,...)))" I'm wondering if the coordinations are ...
2
votes
1answer
2k views

How to fix incorrect SRID of the geometry column? [duplicate]

I've been told to use AddGeometryColumn to properly add a column with correct/preferred SRID. however I wonder if it's possible to fix/change the current column instead of adding a new? If there's no ...
0
votes
1answer
167 views

Why does Find_SRID return zero?

using SELECT Find_SRID('public', 'myTable', 'myColumn'); I get zero as the result, what does it mean? Regards,
10
votes
3answers
975 views

How to speed up queries for raster databases?

I have a raster database in postgresql/postgis with these columns: (ID, rast, data_of_data). 'rast' is the column that has raster files in WKT format. An example query to find the DN value of a ...
3
votes
3answers
540 views

How to find SRID for random polygon?

I'm testing spatial database performance on a dataset. Spatial objects in this dataset (stored as WKT in a flat text file) are random valid polygons which have vertex coordinates (x,y) where 100,000> ...
1
vote
1answer
266 views

loading multiple shapefiles using shp2pgsql in a bash script

I have this bash script (loadShapefiles.sh) to load multiple shapefiles at a time. The script and the shapefiles are stored in the same directory. When I run the bash file with the command of bash ...
0
votes
0answers
148 views

Can I do full SQL expressions through the “WHERE” clause in UpdateCursor?

Run as a standalone python script for a shapefile in a toolbox on ArcMap. For example: psql_url_pop = '''SELECT shapefile.NAME_# + shapefile.WIKI_URL FROM public.shapefile''' rows = ...
1
vote
2answers
646 views

dealing with 2 different coordination systems in postGIS

I'm seeking a function that converts degrees to the following format: POINT(405115.926025391 4543389.4354248) I dont know this format's name, but is there any function to do so? Cheers, EDIT ...
11
votes
4answers
16k views

How to get coordinates from geometry in PostGIS?

This line: SELECT geom FROM myLayer.geom will return a hex value, i'm wondering how would it be possible to get decimal values, a result that look likes human-readable coordination? Regards,
2
votes
2answers
452 views

How fill length and feature count in PostGIS table for each polygons

I'am new to PostGIS/PostgreSql. I have a database which containts two shape-files : polygonal layer towns and linear layer of roads To calculate the length and feature count of 'Streets' inside ...
5
votes
1answer
417 views

How can you join attributes from polygons to points which are within the polygon feature using PostgreSQL and PostGIS? [duplicate]

Possible Duplicate: How to perform a spatial join of point and polygon layers in PostGIS? I don't know how to solve my actual problem. I have polygons and points (some points are located ...
5
votes
2answers
605 views

How to recreate unique reference number with QGIS or PostGIS?

I have a shp file with about 500 odd records in it. It has an ID field but I want to add in a new field with a unique reference number. Can I use the field calculator to generate a unique reference? ...
2
votes
1answer
598 views

Getting points within a range from a postgres database?

ok so this is query i'm making which returns no result: SELECT building.gid FROM building WHERE ST_Dwithin(building.geom, ST_GeomFromText('POINT(long lat)',4326), 400) If I run this ...
1
vote
0answers
164 views

How to config geoserver to read style of vector layer from postgis/SQL store?

I've imported vector layers from map info pro to both SQL server and post gis using easy loader. In both cases I've included style column in the exported table. When I create new store in geoserver ...
5
votes
1answer
222 views

PostGIS ST_Rotate distorts polygon

I'm trying to rotate a box around its southwest corner using PostGIS. However, I am not getting the expected results when doing the rotation. I'm using SRID 3785. The image below shows what ...
3
votes
2answers
1k views

General GeoDjango Opinion

I'm forced to crawl out of my intranet and create a public GIS site with quite an extensive dataset. All of my data is contained within PostGIS. I started dabbling with Geoserver/Postgis/OpenLayers ...
2
votes
2answers
1k views

Spatial index to speed up the query

I have spatial table in PostgreSQL 9.2 / postgis 2.0 that I have to extract some information from it. But my query is hopelessly slow. How could I make use of spatial index to improve the performance ...
1
vote
0answers
217 views

How can I use Convex Hull to select an area with a space from the points?

This refer to this post : Read Here My goal is to select an area covering some points, but maintaining some space from points of border, like in the follow picture : I think ST_Convexhull will do ...
7
votes
1answer
564 views

How to set up GeoDjango with PostGIS 2.0?

I would like to run GeoDjango (Django 1.4) with Postgis 2.0. Whenever I try to run syncdb I get the following error for geographic fields: Failed to install index for stores.Store model: operator ...
2
votes
1answer
376 views

Detect city from coordinates

I need to know how to detect which city belong certain coordinates. Wich is the best way to do this? Thanks in advance. Pd: excuse my english
2
votes
0answers
566 views

why preview image is blank for ImageMosaicJDBC (postgis raster) layer?

I follow http://docs.geotools.org/latest/userguide/library/coverage/pgraster.html to publish a ImageMosaicJDBC layer in geoserver. the layer seems published ok and saved, but the preview of this layer ...
2
votes
1answer
245 views

GeoServer: Show (Random?) Subset of Features

Background We have a GeoServer layer backed by a PostGIS table with 22 million smallish features covering the continental US. We're using GeoServer to serve the features as a WMS layer to a client ...
3
votes
4answers
1k views

What is the easiest way to detect geometry type from text in PostGIS?

I have some records with different types of 'geometries (poly,line,points)' stored as string. I'm trying to use ST_GeomFromText as I want to do some intersection with them. What is the easiest way to ...
5
votes
2answers
146 views

Confused about PostGIS and Postgres terminology

I am documentating my stuff and not sure what is the right way to write this, "I have installed Postgres and added the shapefile to the Postgres database. This database is then PostGIS enabled" or ...
3
votes
2answers
6k views

How to install PostgreSQL 9.2 with PostGIS 2.0 on Ubuntu 11.10 (or higher)?

I have read this question: Install PostGIS v2 for PostgreSQL v9.2, but it didn't resolve my problem. I added the PostgreSQL backports PPA and installed the postgresql-9.2 package, but there is no ...
4
votes
3answers
413 views

Why is a stored procedures much slower than the single query?

I wrote a normal query to snap the next way point from a pair of coordinates in EPSG4326, nothing complex. To optimize the performance a bit I made a boundary condition to minimize the points needed ...
2
votes
1answer
152 views

Why is pgrouting astar not consistent?

I route from 1 end of a circular route to the opposite end. Visually it is obvious that going clockwise is shorter, however shortest_path_astar sometimes picks clockwise and sometimes anti-clockwise. ...
6
votes
1answer
504 views

Geometry errors when importing data from ESRI file geodatabase to PostGIS

When I run the following command to import by data from an ESRI fgdb to postgis... ogr2ogr -f "PostgreSQL" -a_srs "EPSG:28355" -t_srs "EPSG:3857" PG:"dbname=tp_test user=postgres port=54321 ...
2
votes
1answer
810 views

How can I fix QGIS PostGIS Manager error 'shp2pgsql' is not recognized?

I have QGIS 1.8.0 installed via OSGeo Installer and work on win 7. All I need is to upload the shapefile to the database via this plugin. Unfortunately I am receiving an error: Something's wrong: ...
2
votes
1answer
177 views

How to create infrastructure coverage using pgRouting?

I'm trying to reproduce what Underdark did here. I succesfully installed pgrouting and the two required function (nearest neighbour and driving_distance). cdv_osm_v contains all the openstreetmap ...
1
vote
1answer
143 views

Intersecting 3 tables with Spatial SQL

I have three tables I need to intersect but not sure how to get the third Heres what I have so far: SELECT nyc_neighborhoods.name, SUM(nyc_census_blocks.popn_total) AS POP FROM nyc_neighborhoods JOIN ...
5
votes
3answers
400 views

how to parse a XML Document file associated with the shapefile into a PostGIS/PostgreSQL table

I have a shapefile, and information on its attributes is stored in a XML Document format. For example, the attribute of COUNTY is stored as follows: -<attr> ...
1
vote
1answer
259 views

Unable to add PostGIS table to Geoserver

I am able to add individual tables to Geoserver using, curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d ...
1
vote
2answers
2k views

How to find nearest line from point using PostGIS?

I have a table of Roads in PostGIS which geometry is "geometry(MultiLineString,4326)". Its attribute are gid osm_id name ref type oneway bridge maxspeed geom Now i want to know ...
2
votes
1answer
165 views

How to link pgrouting edges with street names to route user based in street names?

I have installed postgreSql + postGis + pgrouting and I have loaded OSM data into my database using osm2po and shp2pgsql. How can I search for points in the map using the street names and then route ...
3
votes
2answers
637 views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
4
votes
3answers
2k views

How to extract POINT from a [LINE|MULTILINE]STRING

I'd like to create a vectorLayer in QGIS to display all the points that form a LINESTRING or a MULTILINESTRING stored in a PostGIS DB. I think that I need to transform all points of LINESTRING (or ...
2
votes
0answers
249 views

From pgRouting shortest_path back to osm node id

I'm successfully performing path finding queries like shortest_path on data imported with osm2pgrouting. The tables I have inside my pgrouting DB are the following: List of relations ...
1
vote
2answers
239 views

How to remove shapefile from PostGIS

I added a shapefile to the PostGIS using, ogr2ogr -f PostgreSQL PG:"host=server_ip user=username dbname=dbname password=password" yourshapefile.shp; Now I want to remove it. What is the command ...
9
votes
2answers
8k views

Adding shapefiles to PostGIS database

I was able to create a Postgresql database and then I executed, createlang plpgsql geospecies psql -d geospecies -f postgis.sql psql -d geospecies -f spatial_ref_sys.sql So now can I directly ...