[postgis-users] mixed geometry types
Stephen V. Mather
svm at clevelandmetroparks.com
Mon Jan 28 22:02:00 PST 2013
Hi William,
Thanks for your Mac binaries. I've used them for years.
You can definitely mix geometry types. PostGIS in Action has a great section on homogenous vs. heterogeneous vs. inheritance as the model for structuring geo-data, with an overview of the advantages and disadvantages. If memory serves me, the primary disadvantage of heterogeneous data is how it is handled by software accessing the database. We've had some great success with views that aggregate to heterogeneous geometry combinations with GeoServer, since GeoTools/the SLDs don't care (for good or for bad) what the underlying data type are for display, and then we can create a single layer that is multilines and polygons, and thus have a single legend representing a single layer with a variety of different hydro features, linear and areal. Pretty nifty affect, really (although can be achieved with layer groups in GeoServer as well, I think). Desktop applications, such as QGIS and others can be a bit more fussy about unconstrained data (or at least data that are mixed).
As to how it shows up in the geometry_columns view... I can't say I've looked... (finally upgrading our production 1.3.x instance to 2.0.1 this week).
Best,
Steve
Stephen V. Mather
GIS Manager
(216) 635-3243 (Work)
clevelandmetroparks.com
________________________________________
From: postgis-users-bounces at lists.osgeo.org [postgis-users-bounces at lists.osgeo.org] on behalf of William Kyngesburye [woklist at kyngchaos.com]
Sent: Monday, January 28, 2013 6:59 PM
To: PostGIS Users Discussion
Subject: [postgis-users] mixed geometry types
Is it OK to change a constraint to allow multiple geometry types in a table? I'm getting tired or worrying whether I can use a linestring and explode multilinestrings to match, or I need to use a multilinestring and force all imported lines to multi. Similar for polygon/multipolygon.
A typical constraint I get when importing a new table with GDAL is:
geometrytype(wkb_geometry) = 'LINESTRING'::text OR wkb_geometry IS NULL
I assume I can just change that to:
geometrytype(wkb_geometry) = 'MULTILINESTRING'::text OR geometrytype(wkb_geometry) = 'LINESTRING'::text OR wkb_geometry IS NULL
How does PostGIS 2 determine what geometry type a table is for the geometry_columns view? the first item in the constraint?
-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/
"Time is an illusion - lunchtime doubly so."
- Ford Prefect
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list