Re: [geos-devel] Dimension and Coordinate Sequences
Folks, In followup on the dimension support front, I have made a quick pass through the CoordinateArraySequence and related classes as well as WKTReader so that I can preserve dimension in a GEOS geometry, at least to some extent. Rather than ask for permission, I've just gone ahead and applied the changes. We can always tweak as needed. They are documented in: http://trac.osgeo.org/geos/ticket/345 I will note that the common idiom CoordinateSequenceFactory-create(0,3) to create a 3D coordinate sequence no longer exactly works since I have added dimension as an argument in the create() method that takes a coordinate vector. This means that 0 can be interpreted as NULL or a count. To disambiguate I have had to cast the zero to size_t in the tests and a couple other places. Hopefully this isn't going to cause other people heartache. Future directions might include preserve dimension carefully through geometry operations, and having the WKT and WKB Writer classes produce output based on the dimension of the geometry. I haven't checked WKBWriter, but WKTWriter is (annoyingly) only supporting 3D output based on a build time choice, rather than dynamically based on the input geometry. Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel
[geos-devel] Dimension and Coordinate Sequences
Folks, I am creating a GEOS Point from 2D WKB input, then fetching back the CoordinateSequence and interogating it's dimension. I get 3. Looking through the code there does not seem to be a real effort to preserve dimension for coordinate sequences, at least with the CoordinateArraySequence implementation. Is this intentional? As the Z coordinate is NaN I'll try and adapt my code to watch for that as a clue to dimension but it is not entirely clear to me why dimension is not currently preserved. Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel
Re: [geos-devel] Dimension and Coordinate Sequences
On Mon, May 17, 2010 at 11:25:56AM -0400, Frank Warmerdam wrote: Folks, I am creating a GEOS Point from 2D WKB input, then fetching back the CoordinateSequence and interogating it's dimension. I get 3. Looking through the code there does not seem to be a real effort to preserve dimension for coordinate sequences, at least with the CoordinateArraySequence implementation. Is this intentional? The interface was added to later make a real effort, but none is made at this time indeed. When non-empty you could check for IsNan(Z) but when empty you can't tell.. As the Z coordinate is NaN I'll try and adapt my code to watch for that as a clue to dimension but it is not entirely clear to me why dimension is not currently preserved. PostGIS extracts dimension from postgis format, then converts, does the thing and converts back to same dimension of input. --strk; () Free GIS Flash consultant/developer /\ http://strk.keybit.net/services.html ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel
Re: [geos-devel] Dimension and Coordinate Sequences
strk wrote: On Mon, May 17, 2010 at 11:25:56AM -0400, Frank Warmerdam wrote: Folks, I am creating a GEOS Point from 2D WKB input, then fetching back the CoordinateSequence and interogating it's dimension. I get 3. Looking through the code there does not seem to be a real effort to preserve dimension for coordinate sequences, at least with the CoordinateArraySequence implementation. Is this intentional? The interface was added to later make a real effort, but none is made at this time indeed. Strk, Is this a good time for me to take a crack at implementing dimension support? I see the dimension potentially makes it as far as the CoordinateArraySequenceFactory, but that CoordinateArraySequence has nothing to keep track of it. I could add it as a private member and ensure it is passed in by the factory. When non-empty you could check for IsNan(Z) but when empty you can't tell.. I'm using the C API. Is there a nice portable way to check for NaN in C code? Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel
Re: [geos-devel] Dimension and Coordinate Sequences
On 17/05/10 16:42, Frank Warmerdam wrote: I'm using the C API. Is there a nice portable way to check for NaN in C code? Frank, double is_nan(double v) { return v != v; } Best regards, -- Mateusz Loskot, http://mateusz.loskot.net ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel
Re: [geos-devel] Dimension and Coordinate Sequences
This would be an excellent time! :) It is raised about every 2 months on the list, both the oddness of the return value and the fact that we have no M value support. P On Mon, May 17, 2010 at 8:42 AM, Frank Warmerdam warmer...@pobox.com wrote: strk wrote: On Mon, May 17, 2010 at 11:25:56AM -0400, Frank Warmerdam wrote: Folks, I am creating a GEOS Point from 2D WKB input, then fetching back the CoordinateSequence and interogating it's dimension. I get 3. Looking through the code there does not seem to be a real effort to preserve dimension for coordinate sequences, at least with the CoordinateArraySequence implementation. Is this intentional? The interface was added to later make a real effort, but none is made at this time indeed. Strk, Is this a good time for me to take a crack at implementing dimension support? I see the dimension potentially makes it as far as the CoordinateArraySequenceFactory, but that CoordinateArraySequence has nothing to keep track of it. I could add it as a private member and ensure it is passed in by the factory. When non-empty you could check for IsNan(Z) but when empty you can't tell.. I'm using the C API. Is there a nice portable way to check for NaN in C code? Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | Geospatial Programmer for Rent ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel
Re: [geos-devel] Dimension and Coordinate Sequences
Great, the more victims^H^H^H^H^H^Husers we have, the better! (Surely Ingres wants M! :) P On Mon, May 17, 2010 at 9:39 AM, Frank Warmerdam warmer...@pobox.com wrote: Paul Ramsey wrote: This would be an excellent time! :) It is raised about every 2 months on the list, both the oddness of the return value and the fact that we have no M value support. strk wrote: Sure, you may try that. Only, I highly dubt any computation will check dimension of input(s) and use that to dimension the output. Paul, strk, OK, I'm going to make a quick pass to try and implement support for differentiating between 2D and 3D dimension of geometries in the default CoordinateSequence related classes and ensure that the path from WKB, and WKT to GEOS Geometries and back will preserve dimension. At this time I'm not going to try and address M, nor to start going into the algorithms and making them dimension aware. This is driven by the Ingres implementation effort, by the way. Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | Geospatial Programmer for Rent ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel
Re: [geos-devel] Dimension and Coordinate Sequences
On Mon, May 17, 2010 at 12:39:15PM -0400, Frank Warmerdam wrote: At this time I'm not going to try and address M, nor to start going into the algorithms and making them dimension aware. M will be much harder indeed. --strk; () Free GIS Flash consultant/developer /\ http://strk.keybit.net/services.html ___ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel