Opened 19 years ago

Closed 19 years ago

#1160 closed enhancement (wontfix)

initialize a shapeObj from WKB data, export shapeObj as WKB

Reported by: sgillies@… Owned by: sdlime
Priority: high Milestone:
Component: MapScript-SWIG Version: 4.5
Severity: minor Keywords:
Cc:

Description

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.

Change History (7)

comment:1 by sdlime, 19 years ago

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

comment:2 by dmorissette, 19 years ago

Cc: warmerdam@… added
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.

comment:3 by sgillies@…, 19 years ago

WKT in the mapfile would be more appropriate.

comment:4 by fwarmerdam, 19 years ago

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. 

comment:5 by sdlime, 19 years ago

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

Steve

comment:6 by sgillies@…, 19 years ago

Yes, Frank, I am concerned about speed as well as the volume of data.

comment:7 by sgillies@…, 19 years ago

Component: MapScriptMapScript-SWIG
Resolution: wontfix
Status: newclosed
Nevermind, am withdrawing this enhancement proposal.

Note: See TracTickets for help on using tickets.