Skip to content

Instantly share code, notes, and snippets.

@pedros007
Last active January 5, 2018 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedros007/f685d8d336c77aff4cc56673b85f6672 to your computer and use it in GitHub Desktop.
Save pedros007/f685d8d336c77aff4cc56673b85f6672 to your computer and use it in GitHub Desktop.
MapServer MAP file demonstrating a MultiPolygon being converted to a single polygon. https://lists.osgeo.org/pipermail/mapserver-users/2018-January/080433.html
# This GIST is for a question to the MapServer mailing list:
# https://lists.osgeo.org/pipermail/mapserver-users/2018-January/080433.html
#
# Request a GeoJSON FeatureCollection via this:
# curl "http://localhost/mapserv?MAP=/usr/src/mapfiles/multi_should_be_multi.map&service=WFS&VERSION=1.1.0&REQUEST=getfeature&typename=should_be_multi&OUTPUTFORMAT=geojson&layer_id=23"
# I expect to receive one feature with
# "geometry": { "type": "MultiPolygon", "coordinates": ... }
# However, I get one feature with
# "geometry": { "type": "Polygon", "coordinates": ... }
MAP
OUTPUTFORMAT
NAME "geojson"
DRIVER "OGR/GEOJSON"
MIMETYPE "application/json; subtype=geojson"
FORMATOPTION "STORAGE=memory"
FORMATOPTION "FORM=SIMPLE"
FORMATOPTION "LCO:RFC7946=YES"
FORMATOPTION "FILENAME=result.json"
END
CONFIG "MS_ERRORFILE" stderr
CONFIG "CPL_DEBUG" "TRUE"
EXTENT -180 -90 180 90
# Without SIZE setting, WFS requests return "msCalculateScale():
# General error message. Invalid image width or height"
SIZE 256 256
PROJECTION
#"init=epsg:4326"
"proj=longlat"
"ellps=WGS84"
"datum=WGS84"
"no_defs"
END
WEB
METADATA
"ows_title" "requested multipolygon feature should be returned as multipolygon"
"ows_onlineresource" "http://localhost?MAP=/usr/src/mapfiles/multi_should_be_multi.map"
"ows_srs" "EPSG:4326 EPSG:900913"
"ows_enable_request" "*"
"wms_srs" "EPSG:4326 EPSG:900913"
"wms_feature_info_mime_type" "text/html"
"wfs_getfeature_formatlist" "ogrgml,geojson"
END
END
MAXSIZE 4096
LAYER
NAME should_be_multi
TYPE polygon
DEBUG 5
FEATURE
WKT "MULTIPOLYGON(((16.3091233197381 42.451171875,16.4198976404527 42.451171875,16.4183942009421 42.36328125,16.171875 42.36328125,16.171875 42.451171875,16.3091233197381 42.451171875)),((18.369140625 42.36328125,18.369140625 42.451171875,18.193359375 42.451171875,18.193359375 42.5390625,18.017578125 42.5390625,18.017578125 42.626953125,17.490234375 42.626953125,17.490234375 42.71484375,16.962890625 42.71484375,16.962890625 42.626953125,16.9304432588465 42.626953125,16.9226478127872 42.6279628978056,16.9068100873162 42.626953125,16.787109375 42.626953125,16.787109375 42.71484375,16.435546875 42.71484375,16.435546875 42.802734375,16.611328125 42.802734375,16.611328125 42.890625,16.5234375 42.890625,16.5234375 43.06640625,16.34765625 43.06640625,16.34765625 42.978515625,16.171875 42.978515625,16.171875 43.154296875,16.259765625 43.154296875,16.259765625 43.330078125,16.171875 43.330078125,16.171875 51.328125,22.5 51.328125,22.5 42.1875,18.720703125 42.1875,18.720703125 42.275390625,18.544921875 42.275390625,18.544921875 42.36328125,18.369140625 42.36328125),(17.2312837488511 42.802734375,17.314453125 42.802734375,17.314453125 42.890625,17.05078125 42.890625,17.05078125 42.802734375,17.2312837488511 42.802734375),(16.5234375 44.2034822351792,16.5547180175781 44.2026430017808,16.5740158978631 44.2039759018842,16.590181238511 44.2041195140165,16.6172566133387 44.2038098503562,16.6276954202091 44.2027417351218,16.6757516299977 44.2039579503676,16.6758683148552 44.2281476189108,16.6789245605469 44.2805480957031,16.677313411937 44.3119946648093,16.6198640711167 44.3108412798713,16.5514328900506 44.311492022346,16.551908605239 44.278169519761,16.380682552562 44.2767064711627,16.379197064568 44.2044022504021,16.4230167164522 44.2049048928654,16.4554281795726 44.204397762523,16.4736983355354 44.2030917896944,16.5234375 44.2034822351792),(16.7950574089499 44.7517260383157,16.8190181956572 44.7539699778837,16.921090518727 44.7605671602137,16.9212834975299 44.7291385426241,16.9558895335478 44.7288109274471,16.9521242029527 44.7466951258042,16.9501764634076 44.7613435633042,16.9709553438074 44.7617340087891,16.9768613927505 44.8378215116613,16.6818147547105 44.8344062356388,16.7958472756779 44.8223517922794,16.7943617876838 44.7919419232537,16.7951426786535 44.7831591437845,16.7939803179573 44.7709251852596,16.7950574089499 44.7517260383157),(21.6770261876723 48.2631279440487,21.7413689108456 48.2630157470703,21.7414003259995 48.3025045955882,21.6772595573874 48.3036086138557,21.6770261876723 48.2631279440487),(21.6274126838235 48.621431238511,21.6786687514361 48.6179172291475,21.6778429816751 48.473955042222,21.718355066636 48.474022360409,21.7170131907744 48.5148216696346,21.7413195441751 48.5176624971278,21.7412208108341 48.648879107307,21.694995655733 48.6526982924517,21.6942551556756 48.7823576085708,21.6272511201746 48.7843098359949,21.6274126838235 48.621431238511),(16.8980452593635 48.7587872673483,16.9547361486098 48.7585314582376,16.9542020909926 48.8631528966567,16.8997551413143 48.8628252814798,16.8980452593635 48.7587872673483)))"
END
END
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment