0

In my application some of my layers use fake 3 dimensional polygons (3rd dimension is always 0) is there a way to make Openlayers read these?

Example:

POLYGON XYZ ((617.81059999999968 2472.3350000000005 0, 629.66577577794476 2456.1329822816815 0, 668.9204102950016 2402.4857125922567 0, 695.52259999999956 2366.1289999999995 0, 806.55708249846236 2214.3840603669482 0, 844.61589999999944 2242.2329999999993 0, 843.71289999999976 2243.4679999999994 0, 842.80899999999974 2242.8060000000005 0, 832.12069999999994 2257.4129999999996 0, 833.0246999999996 2258.0740000000005 0, 831.9027000000001 2259.6079999999993 0, 830.99869999999976 2258.9469999999997 0, 820.31049999999959 2273.5539999999996 0, 821.21439999999984 2274.2149999999997 0, 820.09239999999954 2275.7489999999993 0, 819.18849999999986 2275.0869999999995 0, 808.5001000000002 2289.6939999999995 0, 809.40413489503783 2290.3559523183035 0, 808.28219999999999 2291.8889999999997 0, 807.37820000000022 2291.2279999999996 0, 796.68979999999988 2305.8349999999996 0, 797.59359999999992 2306.4959999999996 0, 796.47159999999985 2308.0299999999997 0, 795.5676999999996 2307.3680000000004 0, 771.73464435096901 2339.9399375070484 0, 771.83197469254264 2340.0111565158923 0, 681.29960000000005 2463.7359999999994 0, 654.99913487185813 2499.5449523474394 0, 617.81059999999968 2472.3350000000005 0))

EDIT: Right now I'm editing the string before giving it to Openlayers so it won't have the 3rd dimension, but I'd rather find a way to not have to do that all the time...

4
  • 2
    I don't know how the WKT parser of OpenLayers works but by the standards POLYGON XYZ is wrong WKT. Depending on the standard version it is "POLYGONZ" or "POLYGON Z".
    – user30184
    Commented Jan 9, 2017 at 12:52
  • Yes, you'll likely have an easier time if you provide standard-conformant text.
    – Vince
    Commented Jan 9, 2017 at 14:36
  • @user30184 Well go tell that to the Mapguide people then, I'm just using the data not making it :P
    – Firenter
    Commented Jan 10, 2017 at 6:40
  • They probably have some user forum. You are their user, so write and ask if they consider that polygon xyz is ok.
    – user30184
    Commented Jan 10, 2017 at 7:25

1 Answer 1

1

MapGuide seems to use it's own version of WKT called AGF Text. It is said to be a "superset of the Open GIS Consortium's (OGC ) Well-Known-Text (WKT) grammar" and

"AGF Text adds definitions for CurveString, MultiCurveString, CurvePolygon, and MultiCurvePolygon and dimensionality attribute for each definition"

.

Unfortunately AGF Text adds dimensionality in a non-compliant way to newer OGC standards which also have support for X,Y,Z, and M dimensions in WKT. By the newest standard a polygon with XYZ dimension is expressed in WKT like

POLYGONZ((0 0 100,0 10 100,10 10 100,10 0 100,0 0 100),(1 1 100,1 9 100,9 9 100,9 1 100,1 1 100))',4326)))

Unfortunately, again, it seems that OpenLayers does not accept this format either. Pasting the POLYGONZ WKT into demo at http://dev.openlayers.org/sandbox/docs/examples/wkt.html yields just "Bad WKT".

I suggest you to make a good script for converting your WKT as you do now. Second step would be to make a feature request for OpenLayers to add support for XYZ(M) WKT, and the third step to make a feature request for MapGuide to make AGF Text to follow the OGC standard with the dimensionality.

Note The MapGuide API document is about version 2.0. I could not find easily any newer documentation from the MapGuide Open Source trac https://trac.osgeo.org/mapguide/wiki.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.