[mapserver-dev] Questions on MapServer architecture and attribute conversions

Seth G sethg at geographika.co.uk
Wed Mar 13 15:23:04 PDT 2019


Hi devs,

I've created a pull request to add a __geo_interface__ to the Python MapScript PointObj, LineObj, and ShapeObjs. 
This allows Python scripts to easily share MapScript objects with other Python geospatial libraries such as 
Shapely, QGIS, and ArcPy. It also completes a nice cycle as Sean Gillies was a core developer of the MapScript Python bindings
and created __geo_interface__.  This only affects the Python MapScript bindings - do I need to create a RFC or ask for a vote to merge this for a 7.4 release?

I also have a few questions on the internal architecture of MapServer classes. Could other devs confirm (or correct) the following assumptions?

- the shapeObj has no link back to a layerObj - they are completely independent with no way to get a reference to a layer from a shape
- all shapeObj attribute values are stored internally as strings

To get attribute names for a shapeObj I had to get retrieve them  from the relevant layerObj and store these in a new property on the shapeObj in Python MapScript. I can then output something like the following:

    "properties": {
        "guid": "954BADBF-2891-48ED-A132-AED39C60E4C9", 
        "featureid": "203529", 
        "classid": "12"
    }

It would be nice to be able to convert the property values to their relevant types e.g. integers and floats. Looking through the 
MapServer source they seem to only be converted to types using METADATA blocks and "gml_FIELD_NAME_type" "datatype" and in certain cases e.g. in mapogroutput.c
Are these conversions all handled differently for different data inputs? Is there an easy way to reuse these conversions in MapScript?

Thanks for any information on the above. 
Regards,

Seth

--
web:http://geographika.co.uk
twitter: @geographika


More information about the mapserver-dev mailing list