[geos-devel] GEOSGetCoordinates() and performance (postgis bug fix)

strk strk at keybit.net
Fri Oct 24 10:49:51 EDT 2003


The function GEOSGetCoordinates() had a comment on top stating
it would have been called just for linestring, so I casted given
pointer to a linestring and used getCoordinatesRO() for performance.

Well. this is not the case. That function is called for all kind
of geometry since after all from postgis point of view every kind
of geometry will have a straight list of points. Underlying 
GEOS getCoordinates() is not documented to return points in the exact
same manner useful for postgis, but I suppose it does. Since postgis
wrapper will only need geometry CoordinateList for read and copy
purposes it is a waste to make one more copy of them.

I'd like to go back to calling getCoordinatesRO() and having GEOS taking
care of optimizing memory copy to reduce it at most. This mean that
getCoordinatesRO() should be made a virtual method of GeometryClass and
the way it will organize returned coordinates should be documented.

>From an architectural point of view we'll obtain greater abstraction.

>From an implementation point of view we'll move to GEOS internal
every optimization work. What do you think, should getCoordinatesRO()
be a virtual Geometry method ?

--strk;



More information about the geos-devel mailing list