API primer: getting the coordinates of the options in a location list field

Location list fields are a special kind of list field where each option is associated to a set of geographic coordinate system coordinates.

When working with this kind of field via the API, the coordinates can be found inside the “InternalFormat” for the field and can be matched to the option via the ID.

Looking at the ProcFields response:

{
    "Result": {
        "Process": {
            "ProcessID": 502,
            "Fields": [
                {
                    "Name": "A Location List",
                    "Uid": "500_7610",
                    ...
                    "Options": [
                        {
                            "Text": "Headquarters",
                            "ID": 9386,
                            "IsHidden": false
                        },
                        {
                            "Text": "Field office",
                            "ID": 9387,
                            "IsHidden": false
                        }
                    ],
                    "InternalFormat": {
                        "Values": [
                            {
                                "Value": "51.0500\u00b0 N, 114.0667\u00b0 W",
                                "ID": 9386
                            },
                            {
                                "Value": "53.54438900,-113.49092669",
                                "ID": 9387
                            }
                        ]
                    },
                    ...
                }
            ],
            ...
        }
    }
}
Posted in API Usage Examples
<span>%d</span> bloggers like this: