AnsweredAssumed Answered

Querying rest endpoint returns NULL Shape_length

Question asked by recurvata on Jan 3, 2018

I have a script that queries a rest endpoint, exports the data in json, and converts it to a feature class. Mostly works pretty well. However, the Shape_length field has all Null values. What's even weirder is I can still use the field in Field Calculator,

e.g !Shape_length@feet! and it gives results, although not correct ones. They're off by about 500 feet on average.

The map data comes by default in Web Mercator Auxiliary, and I've also converted it to WGS 1984 in the outSR parameter of the query to check for differences. Any idea what's going on and how to correct it? Thanks. (Also have another, somewhat related question, but will post that separately).

 

    # query parameters
    query_dict = {"token" : token["token"], "where" : "1=1", "outfields" : "*", "outSR" : 4326, "returnGeometry" : "true", "f" : "json"} # added outSR 1.3.2018

    baseurl = "http://company.com/arcgis/rest/services/Maps/City/MapServer/"

    # layers in REST endpoints are identified by index number, not name
    layerid = layer_dict[infeature]

    query = "/query"

    urltoquery = baseurl + layerid + query

    r = requests.get(urltoquery, auth=(username, password), params=query_dict)

Outcomes