Why is are the coordinates of my WGS 1984 geometries returned as Web Mercator Auxiliary Sphere in Arcade?

1874
5
Jump to solution
10-21-2017 11:21 AM
XanderBakker
Esri Esteemed Contributor

I thought I would create a pop up and add a link to Google Streetmap for the location of the geometry. Although my my points were published in WGS 1984, when I retrieve the X Y properties of the Geometry in Arcade the coordinates are return in Web Mercator Auxiliary Sphere:

Since Arcade is based on JavaScript I hoped that some of the properties of Point objects in the JavaScript API would be available like getLatitude() and getLongitude():

However, these are not supported. 

How can I get my Latitude and Longitude coordinates without storing them as attributes in my hosted featurelayer?

I just did a test with some sample code from the help and it throws an error since the spatialReference specified (4326) is different from the map:

Looking at the REST endpoint I noticed that the spatial reference of my hosted feature layer is 102100 (Web Mercator Auxiliary Sphere). This happened probably since I added the content to ArcGIS Online using a ZIP with the fgdb in it. Question: When you add a fgdb from your computer is the spatial reference always projected to 102100?

I will publish the layer using Pro to see if anything will be different.

0 Kudos
1 Solution

Accepted Solutions
KellyGerrow
Esri Frequent Contributor

Hi Xander,

When you publish through the Add Item workflow, the service is published in the WGS 1984 Web Mercator (Auxiliary Sphere) coordinate system. If you want to set a different coordinate system, publish through ArcMap or ArcGIS Pro.

Arcade will always return geometry values in the spatial reference of the web map. In your example this is probably all web Mercator, but if you are looking for results in a different SR, ensure that your basemap is in the correct SR.

-Kelly

View solution in original post

5 Replies
DanPatterson_Retired
MVP Emeritus

Xander, is this the docs that you are getting your Arcade info from?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Nope, it is not in the documentation, but you can do more than with Arcade than is mentioned in the documentation since it uses JavaScript. Some things are not mentioned, but can be used ... hence the trail and error. However, I do miss the richness of what you can do with Python. In Python we can simply use the projectAs and obtain the projected coordinates, but in JavaScript this would be done by call to a Geometry Service, since the client (the browser) does not have info on these projections.

As for my question, the WGS1984 data when added in a zipped FGDB is published as Web Mercator Auxiliary Sphere. I just need to investigate if that is always the case or not. I would have expected that it would publish the data in WGS1984 if my data is in WGS1984. Also, when creating a geometry from JSON, why is this tied to the coordinate system of the map and can't I create it using a different coordinate system? There is still a lot I need to understand on Arcade.

For now I just added the Lat and Lon coordinates to the featureclass, republished and constructed the Streetview URL inArcade based on the attributes instead of the geometry properties. 

0 Kudos
XanderBakker
Esri Esteemed Contributor

I haven't had much luck lately with my computer (my laptop just died on me)

So I checked the documentation (http://doc.arcgis.com/en/arcgis-online/share-maps/publish-features.htm ) to see if there is any reference on the output SR when a FGDB is published to ArcGIS Online by adding a ZIPped FGDB from my computer.

File Geodatabase:
http://doc.arcgis.com/en/arcgis-online/share-maps/publish-features.htm#ESRI_SECTION1_F878B830119B444... 

... no mention of output SR

CSV, Excel and GeoJSON:
Features are published in the WGS 1984 Web Mercator (Auxiliary Sphere) coordinate system.

Shapefile:
If your shapefile does not include a .prj file and the x,y domain extent is between -180 and 180 degrees, the features are published in the GCS_WGS_1984 coordinate system.

Kelly Gerrow‌; do you know if the output SR is set to WGS 1984 Web Mercator (Auxiliary Sphere) when a FGDB as ZIP (using GCS_WGS_1984) is uploaded to ArcGIS Online?

0 Kudos
KellyGerrow
Esri Frequent Contributor

Hi Xander,

When you publish through the Add Item workflow, the service is published in the WGS 1984 Web Mercator (Auxiliary Sphere) coordinate system. If you want to set a different coordinate system, publish through ArcMap or ArcGIS Pro.

Arcade will always return geometry values in the spatial reference of the web map. In your example this is probably all web Mercator, but if you are looking for results in a different SR, ensure that your basemap is in the correct SR.

-Kelly

XanderBakker
Esri Esteemed Contributor

Thanks Kelly!

0 Kudos