On Wed, Mar 7, 2012 at 4:47 AM, Justin Deoliveira <jdeolive@anonymised.com> wrote:
Hi Martin,
Not sure there is a quick answer to this one. It depends on what backend data formats are in play, but also what type of output format / encoding is in play. Some will respect z, others don’t.
Indeed it is a non-trivial exercise to modify things to preserve z through an entire request chain. I would start with a specific format, say postgis, and then start surveying a bunch of different outputs formats. GML 3/2, GeoJSON, figuring out where along the chain z is dropped.
Take for instance the specific case of WFS 1.1/GML 3 output with a postgis backend. The postgis driver explicitly forces 2d coordinates with a Force2D call. And also last time I checked the GML3 geometry bindings also ignore the third coordinate. Obviously those things would have to be changed to carry z through.
Then of course there would be the opposite chain with wfs transactions. I am less familiar with the behaviour in that case but the exercise remains the same. Debug different scenarios and patch accordingly.
And btw, don’t patch as if anything would want the 3rd dimension, the renderer never does,
and explicitly asks to use a particular type of 2d coordinate sequences.
Here is the code setting up the hints:
// … basic one, we want fast and compact coordinate sequences and geometries optimized
// for the collection of one item case (typical in shapefiles)
LiteCoordinateSequenceFactory csFactory = new LiteCoordinateSequenceFactory();
GeometryFactory gFactory = new SimpleGeometryFactory(csFactory);
Hints hints = new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY, csFactory);
hints.put(Hints.JTS_GEOMETRY_FACTORY, gFactory);
hints.put(Hints.FEATURE_2D, Boolean.TRUE);
A optimized datastore should honor all of them.
For the record, the lite coordinate sequence is a special case of packed coordinate sequence
that can be manipulated and copied directly, the SimpleGeoemtryFactory uses special
subclasses of Geometry for the case of MultiGeometry with a single element inside
(avoids the overhead of arrays and the like), and FEATURE_2D asks for 2d geometries
Cheers
Andrea
–
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf