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

learn more… | top users | synonyms

1
vote
2answers
31 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 ...
0
votes
0answers
9 views

Focal Mean of neighbors using ST_DWithin on points in PostGIS

I'm trying to calculate focal means on a grid of points in PostGIS. I know that a raster calculation would be more efficient, but I only need to run the algorithm once to get the data, so I don't ...
1
vote
0answers
12 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
2answers
61 views

Cannot st_linemerge a multilinestring because its not properly ordered

i have a MultiLineString which i created by using st_union in many steps. Each of them are connected to each other according to their points, but the order is not correct. So ST_LineMerge is not able ...
4
votes
3answers
6k views

How to convert MultiLinestring to Linestring?

I have a multiline string and want to convert it to a linestring in order to use some functions that only work with linestrings. I used ST_Dump() and got a collection of my geometries. If I merge them ...
2
votes
1answer
111 views

assign_vertex_id:problems when creating the node ids

Before using pgrouting, I have to create the node ids. I loaded my polyline layer into PostGIS Manager: I type this in SQL query: select assign_vertex_id('split_4', 800, 'geom', 'gid') But as ...
0
votes
2answers
16 views

How to get feature from PostGIS to OpenLayers with ASP.NET?

I need to show my feature from this table in PostGIS in my ASP.NET web page web. Has anyone done that?
1
vote
0answers
381 views

How to add legend in WFS openlayers

How can I publish WFS openlayer with legend, have tried different examples such as http://api.geoext.org/1.0/examples/vector-legend.js. But when I tried using this firebug shows an error=> ...
2
votes
2answers
256 views

Iterating polygons on a SpatialPolygonsDataFrame in R with readWKT

I have fetched some data (39 objects) from my PostGIS database and converted this data into a matrix: rs <- dbSendQuery(con, "SELECT ST_AsText(polygon_accumulation) AS ShapeWKT from ...
1
vote
1answer
18 views

Strategies for managing (and ultimately merging) duplicate business locations in a spatial database

I am working on a project right now that involves using multiple (very large) "location directories" to identify with the highest possible inclusiveness, a diverse set of business locations. These ...
5
votes
1answer
256 views

How to avoid duplicate GIDs when copying features from one PostGIS layer to another?

When I enter new elements (features) in another Postgres layer, I can do it in two ways: Drawing new element(s) (with 'Add feature') which I do rarely or Copying (or cutting) some elements from ...
1
vote
1answer
64 views

What index to use in this situation

I am working with 3 tables with 3 x 500.000 rows. There is one colomn that gives each object a unique ID (UIDN), there also is a colomn with the geo data (the_geom). There also are some other columns ...
1
vote
2answers
261 views

Function for Selecting Points in a Polygon

I've been banging on this for a few hours, but since I'm relatively new to PostgreSQL and PostGIS, I can't find the solution. I'm trying to create a stored procedure (function) which will return all ...
3
votes
1answer
36 views

MS SQL Server 2012 to Postgresql

How to use MS SQL Server 2012 spatial database in postgresql using foreign data wrapper?
0
votes
1answer
272 views

SELECT assign_vertex_id('ways', 0.00001, 'the_geom', 'gid'); not work

I'm using using OSgeo 6.5 dvd and studing pgrouting workshop (link) for get shortest path. I created network topology call "pgrouting - workshop". There are three commands to execute in section 5.2 ...
1
vote
0answers
33 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
22 views

How to split/divide linestrings of larger lengths in postgis

I want to split/divide linestrings in my data. I have roads data and I want to have every road segment having length not more than 250 meter. Check the shape length of this particular line feature. ...
2
votes
1answer
71 views

ST_Intersects() in WHERE clause misses results

I have a table with a lot of geographical objects like countries, cities or points inside the cities. For instance # SELECT id, ST_AsText(location) FROM brace_brace WHERE id IN (3, 42); id | ...
1
vote
2answers
45 views

How to find all features in one table that intersect features in another table in PostGIS?

I have two tables, boundary polygon table and location point table. I need to find all boundary polygons that contain at least 1 location point. What is the proper way to do this in PostGIS? I tried: ...
1
vote
2answers
42 views

PostGIS to GeoJSON with GDAL: how to get lat/longs?

I'm trying to convert line features from PostGIS to GeoJSON files, as follows: from psycopg2 import * from subprocess import call conn = connect(dbname='gis') cur=conn.cursor() cur.execute("SELECT ...
1
vote
1answer
15 views

Trouble using ogr2ogr w/ -s_srs to combine inconsistent EPSG files into my postgis DB

I'm having trouble combining shapefiles from TIGER and different local governments into a single postgis db to query legislative locations. I've imported all data to multipolygon geom, but found some ...
3
votes
1answer
171 views

Hibernate Spatial - 'Invalid endian flag value encountered' Exception

I'm trying to run a simple query in Hibernate Spatial 4.0 on PostgreSQL 9.3. I have a number of objects in a table with latitude/longitude values, and I'm trying to query objects that fall within a ...
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 ...
0
votes
0answers
26 views

How to split a polygon by a polygon and apportion attributes - postgis [duplicate]

I would like to split polygons by polygons and have the numerical attributes be apportioned. For example: I have a parcel that needs to be split by region. With How to split polygons with another ...
1
vote
2answers
33 views

What is the best way to take a WKB value in SQL Server Management Studio and create a PostGIS geometry in PGAdmin III?

Normally, I would just use WKT strings but I'm investigating some possible geometry weirdness with the Text methods in SQL Server. I would like to copy/paste the WKB values from the SQL Server ...
2
votes
1answer
93 views

Separate a polygon in different polygons depending of the distance to another polygon

I have a reference polygon "R", and others polygons (in grey). I want to separate each grey polygon in multiple polygons, depending on the distance to R with different Buffers : - The red line is R ...
2
votes
4answers
61 views

How to assign geometry to records in a table that contain an ID of a geometry point?

We are looking to map out 'incidents' at schools, but the incident table, which contains a few thousand records, only has a school number (plus the incident data). The table format is an Excel ...
6
votes
4answers
7k 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
1answer
74 views

Routing problem finding shortest route to line

inspiration on how to solve this problem. (Ascii art, I don't have points to insert picture) I need to find Z Z = Shortest route from X Using Road (no point exists here) O = The points that makes ...
1
vote
0answers
45 views

How to save a google map direction into a postgresql/postgis database?

I have taken a direction(route) from google map. Can I save this resultant direction/path/route to my postgresql/postgis database? How?
2
votes
2answers
37 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 ...
0
votes
0answers
13 views

How to ensure that Tilemill interprets my postgis query as intended?

One of my layers (a postgis query from my local osm2pgsql database) is being translated incorrectly in Tilemill. The query is attempting to select the way, the area of the polygon, and the sport=* ...
4
votes
3answers
187 views

How to create non-overlapping street polygons from centerlines?

I want to create non-overlapping polygon layer from center line by applying the buffer to line layer in postgis. I am able to create polygon layer but how to avoid or resolve overlapped polygons. ...
1
vote
1answer
21 views

convert XML to PostgreSQL using MATLAB

In a weeks time I should be able to transfer the GIS data provided in the XML format to PostgreSQL database. I have prepared the PostgreSQL database (empty) and looking at Matlab scripts. (I am on ...
3
votes
1answer
78 views

How to transform a set of street-segments into city-blocks, with PostGIS2?

Theoretically is possible to obtain the polygons of city blocks (urban blocks) from streets, when streets are represented by street axis (LineStrings). The urban blocks are bounded by streets, so ...
2
votes
1answer
25 views

Extra detailed bounding polygon from many geometric points

I have a database of around 100,000 postcodes each with lat/lon which I have converted to geom type in PostGIS. Each postcode also has one of 5 "regions". I wish to generate an accurate bounding ...
1
vote
1answer
45 views

Finding closest Intersection between line strings (PostGIS)

I want to find the distance between one point (excavation sites) and a line (rivers) for the cardinal directions. What I thought would be the easiest way is to draw lines between the excavation site ...
1
vote
1answer
17 views

Is there a way to edit the host name of Postgis layer?

Recently I change my server to a remote host. That's means all my work there I used Postgis layers, the host name at the source is set to 'localhost' and I need to change to 'remotehostname'. The ...
1
vote
2answers
261 views

Polygon intersection with bounding box with polygon's holes intact

I am trying to serve GeoJSON FeatureCollection tiles with each feature's geometries trimmed to the tile boundary. I am working on a Leaflet plugin to re-assemble the geometries. It works by building ...
1
vote
3answers
80 views

How to find area/multipolygon bounded by three other multipolygons?

Trying to get my head around PostGIS and QGIS...I'm trying to find the area (in white) bounded by three multipolygons (in purple) - refer to picture. Each multipolygon only touches the other two ...
1
vote
2answers
39 views

PostGIS ERROR: getPoint4d_p: point offset out of range

I have a set of streets (LINESTRING) in a PostGIS 9.1 PostGIS 2.1 database. I need to obtain points from the lines, on the right and on the left of the street. I offset the lines with: ...
3
votes
1answer
689 views

How to use the pgRouting TSP function?

For more than two days I'm trying to make the TSP algorithm work in PostgreSQL/PostGIS. My problem seems to occur when I'm trying to take into account the road network for TSP algorithm. I know that ...
1
vote
0answers
41 views

Display postGis query result on Google maps Api [closed]

I have MULTILINESTRING Geometry in Postgis and as Google Api does not provide any way to plot MULTILINESTRING , i'm converting MUltiLINEstring to LINESTRING through ST_Merge function. But when i'm ...
3
votes
1answer
22 views

Update/refresh edited PostGIS table in QGIS

I imported a PostGIS table (with geometry) from my PostgreSQL database as a layer in QGIS. Later, I edited the table using PostgreSQL UPDATE commands. Is there a way to quickly update (like a refresh ...
1
vote
0answers
16 views

qGIS' Database Manager “Load as New Layer” Option Not Working

I'm trying to visualize some of my database queries on qGIS. I run a valid SQL query which returns a subset of my table that should be easily loaded as a layer. I then check "Load as new layer," ...
0
votes
0answers
20 views

Consult the charts of a line

I have a table of bus lines and other bus stops in PostGIS. Are conformed to the image below, the lines and the stops on the sides. I want to relate the lines with parades through a spatial query. ...
1
vote
1answer
64 views

How to cluster similar lines in PostGIS?

In PostGIS I have a large database of linestrings which I have obtained using ST_makeline function. I would like to cluster similar lines based on where the lines start and end. Here is an example ...
1
vote
2answers
52 views

Conversion of point grid to a raster with open source tools (Gdal, QGIS …)

I'm looking to do something which seem simple to me, but I haven't found a solution since 2 days I looked for. I've got a Postgis DB with lot of points (WGS84) spaced of 100 meters which cover a ...
2
votes
1answer
24 views

pass an array of geometry to postgresql function

I am trying to pass an array of geometry to a postgis function using JDBC with JAVA: CallableStatement proc = conn.prepareCall("{ ? = call somefunc(?) }"); ...
0
votes
0answers
22 views

OpenStreetMap Road and Polygon Data as 1x1 Degree Shapefiles

I am working on a global project for which I want to use OSM data as a model input. I am looking for advice on the best way to produce 1x1 degree WGS84 shapefiles from either regional extracts or the ...