Postgis Functional Index on st_pointonsurface() Ignored
If I define the following table… CREATE TABLE tbl_vast_importance( id bigserial PRIMARY KEY, geom geometry(MultiPolygon,4326) ); CREATE INDEX ON tbl_vast_importance USING GIST (geom); CREATE INDEX ON...
View ArticleAlternative to ST_Union/ST_MemUnion for merging overlapping polygons using...
New to PostGIS so I trust this is a very basic question but can’t seem to find the right solution. I have a materialized view consisting of ~4 million polygons. Some of them overlap. I need to merge...
View ArticleIncorrect results returning from st_distance_spheroid query
Given a routable network table constructed by completing the guide at http://anitagraser.com/2011/02/07/a-beginners-guide-to-pgrouting/, how can I get an accurate list of all roads that are within a...
View ArticleCartoDB – PostgreSQL row_number() using PostGIS ST_Distance
I’m currently working on a query that should return a subset (i.e. “new”) CartoDB table sorted by proximity to a given point. I want to display labels on the map corresponding to the closest, second...
View ArticleCursor help on large spatial query in PostgreSQL
I have two very large tables on which I want to perform a spatial query. UPDATE table_a SET att_1 = b.att_1, att_2 = b.att_2 FROM table_a AS a JOIN table_b AS b ON ST_Contains(a.geom,b.geom); I am...
View ArticleCan't delete postgis
geo2=# create extension postgis; ERROR: PostGIS is already installed in schema 'public', uninstall it first geo2=# create extension postgis_topology; ERROR: required extension "postgis" is not...
View ArticlePostGIS Geometry Type Column with EPSG:4326 Data Confusion [closed]
I’ve loaded a shapefile into PostGIS using ogr2ogr, but transformed it from it’s original SRS EPSG:3857 to CRS EPSG:4326 ogr2ogr -t_srs EPSG:4326 -lco GEOMETRY_NAME=geom -nln newyork -f PGDump...
View Articleogr2ogr – PostGIS to GML with nested attributes
I am attempting to create GML from PostGIS tables and having issues with nested tags. Before I waste too much time on this, I would like to know if what I am trying to do is possible with “ogr2ogr”. I...
View Articleorthogonal projection of a point onto linestring in PostGIS
I am trying to find the orthogonal projection of a Point (in 4326 SRID) onto a LineString (in 4326). The picture shows the objective. I have tried to use ST_Distance function, but in this case the...
View ArticleExport to DXF from PostgreSQL using ogr2ogr
I have a large dataset in a PostGIS database (OS MasterMap). My aim is to export specific areas of this dataset to DXF, while retaining the attributes of the data as layers in the DXF. My current...
View ArticleFinding density centroids within polygons in PostGIS
I want to find the highest density of OpenStreetMap nodes within a dataset of census geometries. I want to tie the census data to the location of the node which is most central in terms of population....
View ArticleDistance measure of ST_ClusterWithin
I use SRID 4326(WGS 84). So what is the measure of distance in ST_ClusterWithin . m, km, degree ? I ask it because in documentation it only says: geometry[] ST_ClusterWithin(geometry set g, float8...
View ArticleImplementing spatial autocorrelation (global and local moran's) using PostGIS?
Has anyone tried to count global and local moran’s index for polygons inside PostGIS database, with defined neighborhood relations as queens? Is it even possible? I could use R, but my goal was to use...
View ArticleHow to check point intersection with bbox made from two points?
I have two points which represents lower left and upper right point of BBOX. I have one point which SHOULD be somewhere inside and I want to test it. I have all of them as ‘geometry(POINT, 4326)’ data...
View ArticleHow can I add the PostGIS extension?
I’m experiencing difficulties when trying to add the PostGIS extension to PostgreSQL. I wasn’t able to add the extension during the installation because of an error. Now I’m trying to add the extension...
View ArticleUpdate one table from another based on spatial join
In beginning i had two tables of points and i wanted create from one of this POINT table new table CIRCLES which will contain circle polygons 300 metres around points. This step i have done here:...
View ArticleHow to calculate width and lengths of street layer in Postgis/PostgreSQL?
I was able to project the point location (ad.shp) to the nearest street (line.shp) like this. My approach was like this. I used ST_ClosestPoint() to iterate this for every point location within a...
View ArticleHow to use gdal_rasterize with postgis vector?
I’m trying to convert a multipolygon vector layer to a raster using the GDAL tool gdal_rasterize. The command I am using is: gdal_rasterize -b 1 -burn -9999 PG:"dbname=db password=password" auckland...
View ArticleAdd SRID to Point
When inserting a point into a PostGIS database I do it using ST_GeomFromText('POINT(0 1 2)',26918). Note that this was done on a tutorial database where the SRID was set manually as explained here Now...
View ArticlePython GDAL open dataset in PostGIS with quotations
Error trying to use gdal to open a dataset in PostGIS with the following code: ds = gdal.Open("PG: dbname=nyc host=localhost user=postgres password=mypassword port=5432 mode=2 schema=public column=rast...
View Article