MapServer / MapServer-import

3 stars 2 forks source link

initialize a shapeObj from WKB data, export shapeObj as WKB #1160

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: sgillies@frii.com Date: 2005/01/10 - 20:47

Building up a shapeObj from pointObjs and lineObjs using the mapscript API is too
expensive to be useful for large numbers of features.  I propose to create 
msShapeFromWKB and msShapeToWKB functions in mapprimitive.c and expose them
through mapscript as 

    shapeObj.toWKB()
    shapeObj.fromWKB()
    new shapeObj(type, wkb)  # a second, optional argument

The new msShape* functions could also be used by code in mappostgis.c and
mapmygis.c where we currently have two independent (cut and pasted)
implementations.
tbonfort commented 12 years ago

Author: sdlime Date: 2005/01/10 - 21:03

I was thinking about that awhile ago as well but in a slightly different 
context. I was thinking of allowing folks to define inline features (in a 
mapfile or via a URL) using a WKB format instead of POINTS ... END. Your 
functions, which should live in mapprimitive.c I think, would form the basis 
for those modifications as well. In a mapfile you'd do:

FEATURE WKB " " END
FEATURE WKB " " END

and so on...

Steve
tbonfort commented 12 years ago

Author: dmorissette Date: 2005/01/10 - 21:15

I like the idea, but isn't WKB a "binary" encoding? How would that fit in a
mapfile? You would encode it in HEX? And how would you generate the WKB for your
features?

Wouldn't we be better with WKT (or both)? I seem to remember that there was a
WKT as well but I could be wrong. Adding Frank to CC since I think he is
familiar with that.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2005/01/10 - 21:25

WKT in the mapfile would be more appropriate.
tbonfort commented 12 years ago

Author: fwarmerdam Date: 2005/01/10 - 21:34

I would agree that a WKT <-> shapeObj geometries would be useful.  I'm not so
sure of the value of the WKB <-> shapeObj converter.  Sean, where you thinking
of doing this because it might be faster than WKT parsing?   I would certainly
have no objection to having both implemented.

Note that the PostGIS driver apparently already does WKB to shapeObj.  
The mapogr.cpp code also already does OGC data model to shapeObj though using
the OGR geometry functions.  I am not aware of any code going from shapeObj to
OGC simple feature style geometries but if you are "doing this right" I would
like to see that as well.   Of course shapeObj geometries are not really a 
1:1 mapping with OGC simple features so conversion of some types of geometry
will not be lossless. 
tbonfort commented 12 years ago

Author: sdlime Date: 2005/01/10 - 21:35

I meant WKT, sorry, I assumed that's what Sean was refering too. WKT would be 
useful via MapScript too.

Steve
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2005/01/10 - 22:06

Yes, Frank, I am concerned about speed as well as the volume of data.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2005/02/21 - 18:54

Nevermind, am withdrawing this enhancement proposal.