New answers tagged postgis-2.0
According to the documentation (chapter 7.3), there are several geometry accessors which might meet your criteria, depending on whether the geometry is a collection, a polygon, or a multi-polygon: ST_NumGeometries - If geometry is a GEOMETRYCOLLECTION (or MULTI*) return the number of geometries, otherwise return NULL. ST_NumInteriorRings - Return the ...
Use the geometry accessor ST_NumGeometries. For example SELECT ID, ST_NumGeometries(shape) FROM myTable If your geometries contain geometry types other than polygons, you will need to break them up and keep only the polygons before counting. But from your question this would not be required.
When you create a PostGIS database using create extension postgis the "spatial_ref_sys" table is created automatically. I don't see any use case where you would want to do that by hand. If you are new to the technology, you really need to read some basic litarture. Just asking about random details here won't get you anywhere. See for example Getting ...
Ok, so I figured out the issue... I scanned through other shapefiles I have that are related and noticed that their SRID is set to 2278. I inputted that for the current shapefile and I'm getting the correct coordinates now. Someone probably messed it up in ArcGIS or similar beforehand. Thanks for taking a look!
Oh well I totally forgot about this question. I in general did what you said, but without a function. Also I changed to approach to the problem slightly to gain much better performance. So instead of looking for the filling stations each time I need to refill in my simulation, I query all available filling stations at the beginning using the Query below. ...
You could write a pl/pgsql-function in which you create a temp table(which you can drop on commit).then loop through the records of your (executed) sql-statement and write one result during each loop in this table.if all loops are done execute a "select * from temptable" and set the result of this query as return value.
I don't believe that there is a function to do this directly, but you could calculate the difference between the boundary (or the concave hull) of your land polygons and the union of the same land polygons, which would return a MultiPolygon with all the gaps. SELECT ST_Difference( (SELECT ST_MakePolygon(ST_Boundary(ST_Union(geom))) from land), (SELECT ...
MortenSickel - take a look at ST_Tile. http://postgis.net/docs/manual-2.1/RT_ST_Tile.html
Top 50 recent answers are included