Tag Info

Hot answers tagged

5

You no longer need to use the templates or even the script in the new versions of Postgis. As you can see in the Postgis - installation page, all you need is run the CREATE EXTENTION command. -- Enable PostGIS (includes raster) CREATE EXTENSION postgis; -- Enable Topology CREATE EXTENSION postgis_topology; -- fuzzy matching needed for Tiger CREATE EXTENSION ...


4

Would be more efficient with EXISTS I think since it can stop after first positive. Though Martin's answer should work as well SELECT boundary.* FROM boundary WHERE EXISTS (SELECT location.geom FROM location WHERE ST_Intersects(boundary.geom,location.geom) );


3

As seen in the comments, it was a bug. You can see the bug in the bugtracker. It was fixed in the 2.1.2 release However, being caught by that bug outlined a fundamental issue in our design, and made it possible to realize that the app would not be performing well using such a generic type. I would not advise to use GeometryCollections unless you know ...


2

I just figured out that one of my earlier approaches would have worked, but I had a typo in my postgres query. Right-click and copy the binary hex string from SQL Server Management Studio. Paste into a string in the PG Admin III SQL Editor window. Delete the "0x" at the beginning of the string. Wrap that value with a decode. Now ST_GeomFromWKB has WKB. ...


2

Given a point (excavation site), you can use an SQL-language function to project lines out in the cardinal directions, to a specified radius: CREATE OR REPLACE FUNCTION cardinal_lines (g geometry, r float) RETURNS TABLE (dir varchar(2), geom geometry) AS $$ SELECT 'NE'::varchar(2), ST_MakeLine(g, ST_SetSRID(ST_MakePoint(ST_X(g) + sqrt(r/2), ST_Y(g) + ...


2

OpenLayers uses the EPSG:3857 coordinate system, in meters, and not the WGS84 system, in degrees, look at OpenStreetMap Wiki: EPSG:3857 But why use subprocess and ogr2ogr? 1) you can use directly the PostGIS ST_AsGeoJSON function: import psycopg2 conn = psycopg2.connect("dbname='osm' host='localhost' user='me'") cur = conn.cursor() # srid of the layer ...


2

You may instead want to produce a Concave Hull (that is, replace ST_ConvexHull with ST_ConcaveHull as well as possibly experimenting with tweaking the second and third optional target_percent and allow_holes parameters). It may still be disappointingly simple depending on the target_percent you set, but it will most likely be closer to the ideal shape you ...


2

The ST_Polygonize aggregate in PostGIS will return a geometry_dump containing all possible polygons formed by a set of lines. I'm assuming the block IDs shown in your example are not related to the IDs of input linework. If this is the case, you can get your polygons and IDs with: SELECT (st_dump).path[1] as poly_id, (st_dump).geom FROM (SELECT ...


1

It's important to understand that you cannot use more than one index into any one table at one time, and that indexes on columns unrelated to queries are of no use. This is why building an index on 'uidn' is of no use on an ST_Intersects query that involves a 'the_geom' column. One thing you can do to improve the efficiency of a spatial index is to ...


1

It seems you're overcomplicating the use of SRS flags. If you have source data from two spatial reference systems (SRSs): EPSG:4269 (Census data) and EPSG:3081 (Texas data), and your desired SRS (in PostGIS) is EPSG:4269 (same as Census data), then you'd use two variations of the ogr2ogr command. For the Texas data, specify source and target SRSs, so data ...


1

Hmm as I recall there should be in an sfcgal output in your postgis_full_version() output. Did you compile postgis with sfcgal support? It's not enough to just have sfcgal installed. I see you are right the instructions in docs don't tell you how to compile with sfcgal support. I'll amend that. What you need to add is in your postgis configure ...


1

Mihai, I was able to replicate the error with this simple statement: SELECT ST_Segmentize('LINESTRING EMPTY'::geometry, 10); and I was able to also replicate the error with your rpoints edit. I created a ticket on http://trac.osgeo.org/postgis/ticket/2712 for this. Feel free to add comments to that ticket. In looking at the dataset you have, as ...


1

If you don't have primary-secondary attribution to help you, you can still implement some basic logic to decide who's on the losing end of ST_Difference. For example, at a T-shaped intersection, you might specify that the road that passes through the intersection will retain its buffer, while the road that ends at the intersection will have its buffer ...



Only top voted, non community-wiki answers of a minimum length are eligible