-
-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GeoInterface to Python MapScript Classes #5765
Add GeoInterface to Python MapScript Classes #5765
Conversation
I'll review today... |
@sdlime - it is mainly the C function at https://github.com/mapserver/mapserver/pull/5765/files#diff-deee1b0c6f077b32fa05657f1799802c that it would be good to review. The Python extension code and tests should be fine. I changed the approach from returning a gmlItemDefinition which involved adding SWIG guards everywhere in the mapows.h and simply return the data type name as a copied string. |
@geographika Sorry, sorry... Should check item_list is not NULL before accessing it since msGMLItems() can return if it has issues allocating memory. I think it's fine otherwise. |
@sdlime - thanks for the review. I've added in the check. I presume if |
Looks good to me - merge on! |
This pull request adds a
__geo_interface__
property for PointObj, LineObj, and ShapeObj.See https://gist.github.com/sgillies/2217756 for details about the geo_interface.
It allows a GeoJSON-like interface for MapScript objects to help with interoperability with other geospatial Python libraries.
Results in:
A new MapScript method getItemDefinitions has been added to the layerObj.
This allows the type of an item (field) to be returned as a string e.g. Character, Integer, Real (these are all GML data types as listed at https://mapserver.org/ogc/wfs_server.html).
Types are set on fields in a layer through
gml_[item name]_type
METADATA settings, or using"gml_types" "auto"
These types can then be set as a property on a shapeObj as shown in the example above so that item values are returned in the GeoJSON output as ints, floats, or strings.
A review of the C code in
mapscript/swiginc/layer.i
would be very much appreciated.