AnsweredAssumed Answered

Swap coordinate pairs in a Polygon

Question asked by mtrompesri-nl-esridist Employee on Feb 3, 2015
Latest reply on Feb 3, 2015 by xander_bakker

Hi,

 

I have an "Poll an External Website for JSON" Input connector. The Polygon information in the json is wrapped in a string and looks like this:

"\"type\":\"polygon\",\"centerLat\":\"53.2841903320603\",\"centerLng\":\"6.1497098207473755\",\"polygonVertices\":[{\"lat\":53.284613668968,\"lon\":6.1477410793304},{\"lat\":53.28426089025,\"lon\":6.1476981639862},{\"lat\":53.283766995153,\"lon\":6.1516785621643},{\"lat\":53.284318617876,\"lon\":6.1517214775085}]}"

 

With some string processing I am able to make a valid Geometry and send it to an Hosted FeatureService. The polygon looks like this:

"{""rings"":[[[53.284613668968,6.1477410793304],[53.28426089025,6.1476981639862],[53.283766995153,6.1516785621643],[53.284318617876,6.1517214775085]]],""spatialReference"":{""wkid"":4326}}}"

 

The location is east of Somalia instead of the Netherlands because latitude and longitude are in the wrong order.

 

Is there a way to swap the coordinate pairs in the polygon?

 

Kind Regards, Maarten Tromp

 

Outcomes