1

I'm having trouble with the ArcGIS json responses

The geometry paths make no sense to me, they appear in the wrong place, relatively to each other they seem correct but they are not in the correct places, for example the first ones fall on the river.

What am I missing here?

Here is my request:

https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?token?TOKEN_HERE&stops=38.868047,-9.106938;38.630616,-8.915192&findBestSequence=true&directionsLanguage=pt-PT&directionsOutputType=esriDOTComplete&returnStops=true&restrictionAttributeNames=none&f=json

and this is the response:

{"messages": [], "routes": {
    "fieldAliases": {
        "ObjectID": "ObjectID",
        "Name": "Name",
        "FirstStopID": "FirstStopID",
        "LastStopID": "LastStopID",
        "StopCount": "StopCount",
        "Total_TravelTime": "Total_TravelTime",
        "Total_Kilometers": "Total_Kilometers",
        "Total_Miles": "Total_Miles",
        "Shape_Length": "Shape_Length"
    },
    "geometryType": "esriGeometryPolyline",
    "spatialReference": {
        "wkid": 4326,
        "latestWkid": 4326
    },
    "features": [
        {
            "attributes": {
                "ObjectID": 1,
                "Name": "Location 1 - Location 2",
                "FirstStopID": 1,
                "LastStopID": 2,
                "StopCount": 2,
                "Total_TravelTime": 209.73960486765333,
                "Total_Kilometers": 55.930561298040885,
                "Total_Miles": 34.753639556266954,
                "Shape_Length": 0.50709013429313077
            },
            "geometry": {
                "paths": [
                    [
                        [38.829044500000066, -9.0679354999999759],
                        [38.822430000000054, -9.0745499999999311],
                        [38.805600000000027, -9.0878699999999526],
                        [38.797190000000057, -9.1074999999999591],
                        [38.785980000000052, -9.1236199999999599],
                        [38.773360000000025, -9.1320399999999609],
                        [38.767750000000035, -9.1453599999999255],
                        [38.748120000000029, -9.1502599999999461],
                        [38.722180000000037, -9.1579699999999775],
                        [38.699860000000058, -9.162529999999947],
                        [38.691980000000058, -9.1552599999999416],
                        [38.683650000000057, -9.146129999999971],
                        [38.680040000000076, -9.1403399999999806],
                        [38.679130000000043, -9.1383499999999458],
                        [38.677680000000066, -9.1273099999999658],
                        [38.67497000000003, -9.1198899999999412],
                        [38.672070000000076, -9.1102999999999383],
                        [38.673340000000053, -9.105419999999981],
                        [38.664470000000051, -9.1030699999999456],
                        [38.661760000000072, -9.0979999999999563],
                        [38.660860000000071, -9.0949299999999766],
                        [38.65796000000006, -9.0923899999999662],
                        [38.647830000000056, -9.0884099999999535],
                        [38.640410000000031, -9.0847899999999413],
                        [38.635710000000074, -9.0800899999999274],
                        [38.632450000000063, -9.0762899999999718],
                        [38.629920000000027, -9.0672399999999698],
                        [38.625570000000039, -9.0531299999999533],
                        [38.622680000000059, -9.0458899999999289],
                        [38.61997000000008, -9.0373899999999594],
                        [38.619780000000048, -9.0330499999999461],
                        [38.617070000000069, -9.0182099999999537],
                        [38.617980000000045, -9.0129599999999641],
                        [38.617980000000045, -9.007539999999949],
                        [38.616890000000069, -9.0024699999999598],
                        [38.613450000000057, -8.9995799999999804],
                        [38.606940000000066, -8.990889999999979],
                        [38.605490000000032, -8.9854599999999323],
                        [38.603320000000053, -8.9802199999999743],
                        [38.59916000000004, -8.9747899999999277],
                        [38.592830000000049, -8.9693599999999378],
                        [38.590290000000039, -8.9666499999999587],
                        [38.587580000000059, -8.9612199999999689],
                        [38.583960000000047, -8.9499999999999318],
                        [38.58233000000007, -8.947469999999953],
                        [38.581790000000069, -8.9463799999999765],
                        [38.591560000000072, -8.9376999999999498],
                        [38.601510000000076, -8.926119999999969],
                        [38.607480000000066, -8.9226799999999571],
                        [38.613810000000058, -8.923219999999958],
                        [38.623400000000061, -8.926119999999969],
                        [38.631730000000061, -8.9262999999999693],
                        [38.635890000000074, -8.9255799999999681],
                        [38.63818399400003, -8.9172849189999397]
                    ]
                ]
            }
        }
    ]
}, "stops": {
    "fieldAliases": {
        "ObjectID": "ObjectID",
        "Name": "Name",
        "RouteName": "RouteName",
        "Sequence": "Sequence",
        "TimeWindowStart": "TimeWindowStart",
        "TimeWindowEnd": "TimeWindowEnd",
        "ArriveCurbApproach": "ArriveCurbApproach",
        "DepartCurbApproach": "DepartCurbApproach",
        "SourceID": "SourceID",
        "SourceOID": "SourceOID",
        "PosAlong": "PosAlong",
        "SideOfEdge": "SideOfEdge",
        "CurbApproach": "CurbApproach",
        "Status": "Status",
        "Attr_Minutes": "Attr_Minutes",
        "Attr_TravelTime": "Attr_TravelTime",
        "Attr_Miles": "Attr_Miles",
        "Attr_Kilometers": "Attr_Kilometers",
        "Cumul_TravelTime": "Cumul_TravelTime",
        "Cumul_Kilometers": "Cumul_Kilometers",
        "Cumul_Miles": "Cumul_Miles"
    },
    "geometryType": "esriGeometryPoint",
    "spatialReference": {
        "wkid": 4326,
        "latestWkid": 4326
    },
    "features": [
        {
            "attributes": {
                "ObjectID": 1,
                "Name": "Location 1",
                "RouteName": null,
                "Sequence": 1,
                "TimeWindowStart": null,
                "TimeWindowEnd": null,
                "ArriveCurbApproach": null,
                "DepartCurbApproach": 2,
                "SourceID": 1,
                "SourceOID": 2772912,
                "PosAlong": 0.50839627378317298,
                "SideOfEdge": 1,
                "CurbApproach": 0,
                "Status": 0,
                "Attr_Minutes": 0,
                "Attr_TravelTime": 0,
                "Attr_Miles": 0,
                "Attr_Kilometers": 0,
                "Cumul_TravelTime": 0,
                "Cumul_Kilometers": 0,
                "Cumul_Miles": 0
            },
            "geometry": {
                "x": 38.868047000000047,
                "y": -9.1069379999999569
            }
        },
        {
            "attributes": {
                "ObjectID": 2,
                "Name": "Location 2",
                "RouteName": null,
                "Sequence": 2,
                "TimeWindowStart": null,
                "TimeWindowEnd": null,
                "ArriveCurbApproach": 2,
                "DepartCurbApproach": null,
                "SourceID": 1,
                "SourceOID": 2772869,
                "PosAlong": 0.97579155971441689,
                "SideOfEdge": 1,
                "CurbApproach": 0,
                "Status": 0,
                "Attr_Minutes": 0,
                "Attr_TravelTime": 0,
                "Attr_Miles": 0,
                "Attr_Kilometers": 0,
                "Cumul_TravelTime": 209.73960486765333,
                "Cumul_Kilometers": 55.930561298040885,
                "Cumul_Miles": 34.753639556266954
            },
            "geometry": {
                "x": 38.630616000000032,
                "y": -8.9151919999999336
            }
        }
    ]
}, "directions": [
    {
        "routeId": 1,
        "routeName": "Location 1 - Location 2",
        "summary": {
            "totalLength": 34.753941887643236,
            "totalTime": 209.73960486589931,
            "totalDriveTime": 209.73960486765333,
            "envelope": {
                "xmin": 38.581790000000069,
                "ymin": -9.162529999999947,
                "xmax": 38.868047000000047,
                "ymax": -8.9151919999999336,
                "spatialReference": {
                    "wkid": 4326,
                    "latestWkid": 4326
                }
            }
        },
        "features": [
            {
                "attributes": {
                    "length": 0,
                    "time": 0,
                    "text": "Iniciar em Location 1",
                    "ETA": -2209161600000,
                    "maneuverType": "esriDMTDepart"
                },
                "compressedGeometry": "+1m91+21rn8-fc78+0+0"
            },
            {
                "attributes": {
                    "length": 11.742525083602693,
                    "time": 70.865992097978719,
                    "text": "Siga para Sudoeste",
                    "ETA": -2209161600000,
                    "maneuverType": "esriDMTStraight"
                },
                "compressedGeometry": "+1m91+21rn8-fc78-bf-bg-t8-n4-ej-123-jf-s0-lu-ek-9o-n5-123-8g-1d2-dd-16o-7t"
            },
            {
                "attributes": {
                    "length": 22.421131775335077,
                    "time": 135.31125,
                    "text": "Vire à direita",
                    "ETA": -2209161600000,
                    "maneuverType": "esriDMTTurnRight"
                },
                "compressedGeometry": "+1m91+21kms-fhbi-dm+ck-ef+fr-69+a2-1j+3f-2g+j5-4n+ct-51+gl+27+8f-fd+43-4n+8q-1i+5a-51+4e-hj+6t-ct+69-85+85-5l+6j-4d+fn-7i+oh-50+ci-4n+ep-b+7h-2q+g1-1s+9o+1i+94+0+9d-1s+8q-5v+50-ba+f3-2h+9e-3o+93-78+9e-b0+9e-4d+4n-4m+9e-6a+jf-2q+4d-u+1s+gv+f3+h9+k4+ac+5v+b0-u+gl-51+ef-a+77+18"
            },
            {
                "attributes": {
                    "length": 0.59028502870546617,
                    "time": 3.5623627696746252,
                    "text": "Vire à esquerda",
                    "ETA": -2209161600000,
                    "maneuverType": "esriDMTTurnLeft"
                },
                "compressedGeometry": "+1m91+21h7o-f4fv+3v+ed"
            },
            {
                "attributes": {
                    "length": 0,
                    "time": 0,
                    "text": "Terminar em Location 2, à esquerda",
                    "ETA": -2209161600000,
                    "maneuverType": "esriDMTStop"
                },
                "compressedGeometry": "+1m91+21hbn-f41i+0+0"
            }
        ]
    }
]}
1

Ended up finding what I was doing wrong, my input stops were:

38.868047,-9.106938;38.630616,-8.915192

after changing to

-9.106938,38.868047;-8.915192,38.630616

it works as expected, but still I don't understand why they are reversed in ArcGIS, Google Maps expects them in the way I was inputting them before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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