postexperiments - issue #3
Proposal for supporting 3DZ,3DM manipulation in PostGIS AsKML generator
Google Earth KML supports 3D geometries(http://code.google.com/apis/kml/documentation/kml_tags_beta1.html#coordinates)
The <coordinates> tuple looks like this:
<coordinates>-115.228103529649,30.2725123759017,4</coordinates>
(The third value is the optional altitude value in meters above sea level.)
AsKML() DOES currently support proper conversion of Z values within postgis EWKT into KML altitude values.
However AsKML() does not currently support two features of interest for more advanced visualization of postgis data exported to KML for Google Earth.
1) AsKML() does not support accessing M values if present.
2) AsKML() does not support direct manipulation/substitution of the Z values.
Below I list potential usecases where both of these features could be useful.
===== M Value Access ------------
USECASE: When M values within postgis EWKT are present and used to represent Timestamps of data records or when they represent routed measures along linestrings.
*In both of these cases it would be useful to have an option within AsKML() or a similar function like AsKML4d() where M values would be parsed into <TimePrimitive> (<timestamp> in particular) tags. *http://code.google.com/apis/kml/documentation/kml_tags_beta1.html#timestamp
===== Z Value Manipulation ------------
USECASE: When Z values are present in the data that represent altitude in a different unit than meters is a case where direct access to the Z values within the KML function could be useful.
*Something like ST_AsKML(geometry, [precision], [z factor]) could be useful to either convert or exaggerate the altitude values.
*However the most useful feature would be to be able to substitute alternative values for the Z values which correspond to the attributes of another column in the table. For example if you have a spatial table of state with population data and you would like to use the KML polygon height to visualize state relative population. (an example is here: http://www.sgrillo.net/googleearth/demo4.kmz)
*You of course could do this within postgis independent of the AsKML() function just by reassign the Z value with a combination of functions like this: select asEWKT(ST_Translate((ST_Force_3dz(the_geom)),0,0,(Select my_attribute from mytable))) from mytable; However it seems like the most likely usecase for something like this would be when exporting to KML so wrapping it in as an optional feature could be very slick.
*This way you could say ST_AsKML(the_geom, [precision], publc.states.population) and the altitude value would be fed in from that table and column.
Status: New
Labels:
Type-Defect
Priority-Medium
Code