Get geometry from OpenLayers.Control.WMSGetFeatureInfo JSON

المشرف العام

Administrator
طاقم الإدارة
I need to store the geometry of a certain feature with OpenLayers.Control.WMSGetFeatureInfo and i'm using these parameters to get it in json format

output:'features',infoFormat:'application/json',format: new OpenLayers.Format.JSON,After i store the geometry from the json i'm writing a WKT string with it to get something like...

"MULTIPOLYGON(((-8.098636886812224 39.016921320632704, -8.098572979051546 39.016543430309326,)))"The problem is that i don't know why but the JSON geometry object is coming with a comma between the LAT and LONG like so:

"MULTIPOLYGON(((-8.098636886812224,39.016921320632704, -8.098572979051546, 39.016543430309326)))"What's the best way to get a correct WKT string from the event.features JSON Object or in alternative how to replace every other comma with a blank space using a regular expression in javascript?

Replacing the first and keeping the second?



أكثر...
 
أعلى