[geos-devel] GEOS SRID Patch

Paul Ramsey pramsey at refractions.net
Wed Sep 19 00:54:33 EDT 2007


The readme on releasing spells out the policy if I recall correctly.
P

On 18-Sep-07, at 9:05 PM, Howard Butler wrote:

> Do we need to increment the API with these additions?  What policy  
> did Sandro have going?
>
> Howard
>
> On Sep 18, 2007, at 10:51 PM, Charlie Savage wrote:
>
>> So - any comments on this.  Will people get upset if I commit it  
>> (which I would like to do)?
>>
>> Charlie
>>
>> Charlie Savage wrote:
>>> I've attached a patch that implements what we discussed yesterday.
>>> More specifically:
>>> * It updates WkbWriter to support outputting SRID values in EWKB/ 
>>> HEX format.  This is off by default so is backwards compatible.
>>> * Adds getter/setter methods for byte order, dimensions and  
>>> include SRID to WkbWriter - these are needed for the C API  
>>> changes below.
>>> * Adds new C API interfaces for WktReader, WktWriter, WkbReader,  
>>> WkbWriter.  These were added to the end of the *.h file and I did  
>>> not change any existing C apis - so this should be backwards  
>>> compatible.
>>> Here is what the new WkbWriter interface, which is the most  
>>> complicated one, looks like:
>>> extern GEOSWKBWriter GEOS_DLL *GEOSWKBWriter_create();
>>> extern void GEOS_DLL GEOSWKBWriter_destroy(GEOSWKBWriter* writer);
>>> extern unsigned char GEOS_DLL *GEOSWKBWriter_write(GEOSWKBWriter*  
>>> writer, const GEOSGeometry* g, size_t *size);
>>> extern unsigned char GEOS_DLL *GEOSWKBWriter_writeHEX 
>>> (GEOSWKBWriter* writer, const GEOSGeometry* g, size_t *size);
>>> extern int GEOS_DLL GEOSWKBWriter_getOutputDimension(const  
>>> GEOSWKBWriter* writer);
>>> extern void GEOS_DLL GEOSWKBWriter_setOutputDimension 
>>> (GEOSWKBWriter* writer, int newDimension);
>>> extern int GEOS_DLL GEOSWKBWriter_getByteOrder(const  
>>> GEOSWKBWriter* writer);
>>> extern void GEOS_DLL GEOSWKBWriter_setByteOrder(GEOSWKBWriter*  
>>> writer, int byteOrder);
>>> extern char GEOS_DLL GEOSWKBWriter_getIncludeSRID(const  
>>> GEOSWKBWriter* writer);
>>> extern void GEOS_DLL GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter*  
>>> writer, const char writeSRID);
>>> Here is some example ruby code that uses the new api via SWIG:
>>> writer = Geos::WktWriter.new
>>> writer.includes_srid = true
>>> writer.output_dimension = 3
>>> wkb = writer.write(geom)
>>> hex = writer.write_hex(geom)
>>> The other readers/writers work similarly.
>>> I think this is a better approach then the current API because:
>>> 1.  It eliminates the need for the hacky static variables for  
>>> byte order and output dimensions
>>> 2.  It gives the client more control - you can create a reader/ 
>>> writer and reuse it instead of having a new one created every  
>>> time you read/write a geometry
>>> 3.  Its more extensible.  For example, at some point we may wish  
>>> that the WktReader supports the EWKT format.  That would require  
>>> doing this:
>>> extern char GEOS_DLL GEOSWKTWriter_getIncludeSRID(const  
>>> GEOSWKTWriter* writer);
>>> extern void GEOS_DLL GEOSWKTWriter_setIncludeSRID(GEOSWKTWriter*  
>>> writer, const char writeSRID);
>>> So I think this patch meets my objectives (more client control,  
>>> supports outputting SRID values), Frank's objectives (get rid of  
>>> static fields) and Paul's (backwards compatible).
>>> I also tested it by exposing the new API via SWIG and updating  
>>> the various Ruby tests I have.  So at least every new method has  
>>> been called/verified via a simple set of tests.
>>> Comments?  If this looks ok, can I apply it?
>>> Charlie
>> _______________________________________________
>> geos-devel mailing list
>> geos-devel at geos.refractions.net
>> http://geos.refractions.net/mailman/listinfo/geos-devel
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel




More information about the geos-devel mailing list