Select to view content in your preferred language

Where's the spatial reference information?

2012
4
Jump to solution
05-16-2023 12:37 PM
JerryDavis
New Contributor III

Where is the spatial reference information for maps and layers in ArcGIS Online? 

I've learned through experimentation a few relevant things:

  • There is a spatial reference for every map. That's of course obvious.
  • The spatial reference for a map is defined by that of the basemap.
  • Any image layers (and presumably rasters in general) added to the map must be in that spatial reference defined by the basemap.
  • Feature layers seem to be projected on the fly, as in ArcGIS desktop/pro.

I guess the system mostly works, since most of the time you don't need to be aware of what the spatial reference is, and layers either display or produce errors.  And since feature layers are projected on the fly, issues with those don't arise.  However, i often work with imagery that I want to add to a map, and unless I've included clues like "UTM" in the title of the raster layer, I don't know what is in which coordinate system.

Am I missing something?  This would seem to be easy enough to provide, but my digging hasn't revealed anything.

1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

You can find this information in the REST service directory endpoint for your feature/item.

In AGOL, navigate to your content then open up your item page 'Overview' tab.  At the bottom right of the page you have a box with 'URL' above it.

Click on 'View' (just above the box on the right hand side).  This then takes you to the REST directory page for that service.  There should then be a heading in bold called 'Spatial Reference' and the corresponding WKID.

View solution in original post

4 Replies
DavidPike
MVP Frequent Contributor

You can find this information in the REST service directory endpoint for your feature/item.

In AGOL, navigate to your content then open up your item page 'Overview' tab.  At the bottom right of the page you have a box with 'URL' above it.

Click on 'View' (just above the box on the right hand side).  This then takes you to the REST directory page for that service.  There should then be a heading in bold called 'Spatial Reference' and the corresponding WKID.

JerryDavis
New Contributor III

Indeed, it's there, at least for data.  For the map, that box isn't there, but it's easy enough to go to the basemap layers, which will have it.

0 Kudos
DavidPike
MVP Frequent Contributor

Yes the basemap of the webmap dictates the spatial reference/projection of all other data, it's not an inherent property of the WebMap.

0 Kudos
Clubdebambos
Occasional Contributor III

Hi @JerryDavis 

Just an alternative and to place here for others that come across your post as it might be helpful. The below Python code snippet allows for quick access to spatial reference information. You can add in other item types as required. I use this as a basis for quality checking as all our data should be in the same coordinate system and this will go through all Layers in a WebMap or provide for a Feature Service/Image Service, and I can easily find deviations where we have published data in the wrong SRS in error. 

 

from arcgis.gis import GIS

## connect to agol
agol = GIS("home")

## access the item by Item ID
item = agol.content.get("INSERT_ITEM_ID")

## if it is a feature service or image service
if item.type in ("Feature Service", "Image Service"):
    ## then print the WKID of the SRS
    print("WKID: {0}".format(item["spatialReference"]))

## if it is a WebMap
elif item.type == "Web Map":
    ## access the json data
    wm_data = item.get_data()
    ## print the SRS for the WebMap
    print("WebMap WKID: {0}".format(wm_data["spatialReference"]))

    ## iterate through each layer in the WebMap
    for lyr in wm_data["operationalLayers"]:
        ## print the name of each layer
        print("Layer Name: {0}".format(lyr["title"]))
        ## access the item each layer comes from
        item = agol.content.get(lyr["itemId"])
        ## print the WKID for each layer
        print("\t WKID: {0}".format(item["spatialReference"]))

## otherwise print the item type 
## can add in another elif to catch this item.typoe as needed
else:
    print(item.type)

 

 

~ learn.finaldraftmapping.com
0 Kudos