Select to view content in your preferred language

Auto-calculating distance and area - how do I get the correct numbers?

694
9
09-06-2024 06:56 AM
TrentonWalker
Occasional Contributor

Hey everyone,

We use ArcGIS Field Maps for lots of things, including construction site inspections. Sometimes we'll walk a feature out (like a stretch of silt fence, for example, or the limits of a revegetated area) to get estimates of materials used to check against what the contractor has reported as used.

We use Web Maps for our Field Maps. I don't know if this is the optimal way to use Field Maps, but it has worked well for us so far. I'll build the map in ArcGIS Pro, share it as a Web Map to ArcGIS Online, and access it through the Field Maps app.

Web Maps are - to my knowledge, at least - constrained exclusively to the WGS 1984 Web Mercator (Auxiliary Sphere) coordinate system. I have been told (from numerous places, including this forum answer: https://community.esri.com/t5/data-management-questions/big-discrepancy-in-acres-calculation/td-p/10...) that Web Mercator is less than ideal for area or distance measurements: Web Mercator is a "lousy map projection for area calculations" and "should never be used for area or distance calculations."

OK. Fair enough.

But we still need those calculations, and we need them live then and there in the field - in feet or acres, specifically. Web Mercator provides a length and area measurement by default, but it's in meters (and square meters, I'm assuming?), so I've had to add a separate field for calculating lengths and areas in feet and acres.

On top of that, I've been using an Arcade script (that I borrowed and modified from this post: https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/common-calculated-expressions-fo...) to auto-calculate our lengths and areas as the features are collected. But the lengths and areas in the Arcade script are calculating them geodetically, whereas I'm fairly certain the default Web Mercator numbers are planar.

If I want the lengths and areas to match what we'd get if we walked these distances out or manually surveyed these areas, what do I need to do? Would removing "Geodetic" from the Arcade script give me the real-world, walked-out numbers? Or does the fact that these calculations are being done within Web Mercator mean I'll never get the real numbers until I extract the data after-the-fact, project it in our state plane projection, and then manually calculate them? And, again, would I need to use planar or geodetic to get the real numbers in that case, too?

What's the best way to get my field guys the same numbers in Field Maps - in real-time, while they're in the field - that they'd get if they measured these things by hand?

9 Replies
Nick_Creedon
Regular Contributor

I recommend publishing your hosted feature layers to your local State Plan projection, this will help default your x,y,z data to a standard unit of measurement along with giving you accurate shape lengths too. I had polygon and lines projected in web mercator and all my measurements were off. Once I changed them to my local state plane I have been able to make accurate calculations in AGOL. In AGOL layers project on the fly so the measurement tool in AGOL should measure correctly. In ArcGIS Pro things change, if your "map" in ArcGIS Pro is projecting in Web Mercator and you must set your measurement tool to Geodesic, if your 'map' is projected in a state plan or local projection you want to select planar. 

Nick_Creedon
Regular Contributor

I should actually chat with someone from Esri because there might be a bug when sharing layers to AGOL.

In ArcGIS Pro, if your layer is projected to a local projection and your "Map" is set to Web Mercator and you go to share it online. The layer will take the projection of the Map and not the layer. 

Your Map must also be set to the same projection you want your layer to be when sharing online. This was my first mistake to why all my layers were giving me wrong measurements. In ArcGIS Pro you can have a map projected in one system and your layers in another. Transformations are automatically set to keep your layers spatially accurate. Just when sharing layers you want projections to be same across the board.

Hopefully this gives some clarification for your workflow.

TrentonWalker
Occasional Contributor

Hi Nick, thanks for the reply. Let me make sure I understand your response (I apologize in advance - almost all of my GIS skills have been self-taught, so I'm really bad with terminology in particular).

You're recommending that I publish my "hosted feature layers" in my local StatePlane projection. A "hosted feature layer" would be the individual layers (feature classes - points, lines, polygons, etc.) within the Web Map, correct? So instead of building it all as a single Web Map in ArcGIS Pro and then sharing as a Web Map, your suggestion is to publish the layers to AGOL individually, and to publish them in my local StatePlane projection instead of Web Mercator (auxiliary sphere)? In that case, if I later built a Web Map and manually added those hosted feature layers to the Web Map, they would stay in StatePlane rather than changing to Web Mercator - is that correct, or have I misunderstood?

You mention making accurate calculations in AGOL, which would be helpful, but my preference would be to get accurate measurements even before we get back to the office and view the map in AGOL - we'd like accurate measurements for lengths and areas in real-time while we're out in the field creating these features in Field Maps. Would your suggested changes also work for that? Thanks again for the help.

 

Edit: Sorry, Nick, I just realized your follow-up comment below answered some of what I asked above. So the projection of the hosted feature layer doesn't matter if it's placed in a Web Map with the Web Mercator projection - it'll automatically adjust the projection of the layer to match the projection of the Web Map. And I think the reason our Web Maps are always Web Mercator is because I'm using ESRI's default basemaps for all of our maps since they don't use credits, unlike using a raster as a custom basemap. I guess my next step should be testing a Web Map in our local StatePlane projection using a custom basemap (as well as all of the feature classes) in that same StatePlane projection and then see what kinds of lengths we're getting and what the difference between planar and geodetic are, although it may not be possible (or maybe just not wise) to measure geodetic lengths in a planar projection. Thanks again for the insight. I've got some things to think about and test.

0 Kudos
Nick_Creedon
Regular Contributor

Q-You're recommending that I publish my "hosted feature layers" in my local StatePlane projection. A "hosted feature layer" would be the individual layers (feature classes - points, lines, polygons, etc.) within the Web Map, correct?

Answer- Yes, I would publish your layers in your local projection. This will change the unit of measurement from meters to US Feet (assuming this is where you are). You can select multiple layers to publish as a group layer if you choose or do each layer individually.

 

Q-So instead of building it all as a single Web Map in ArcGIS Pro and then sharing as a Web Map, your suggestion is to publish the layers to AGOL individually, and to publish them in my local StatePlane projection instead of Web Mercator (auxiliary sphere)?

Answer- Yes, publish your layers from ArcGIS Pro to AGOL and add these layers to a webmap in AGOL (To publish them correctly you must set your layers and the map to the desired projection). Making your webmap- you can use the default basemaps in AGOL, they are projected as Web Mercator. THIS IS OKAY, your locally projected layers will "project on the fly" to be spatially accurate in Web Mercator.  

 

Q-In that case, if I later built a Web Map and manually added those hosted feature layers to the Web Map, they would stay in StatePlane rather than changing to Web Mercator - is that correct, or have I misunderstood?

Answer- Yes correct, your layers will stay in StatePlane/your local projection and will "project on the fly" in the Web Mercator Projected Basemap in the webmap on AGOL. "Project on the Fly" in AGOL is like how in ArcGIS Pro their transformations for layers that don't share same projections as the map they are in. 

 

Q-You mention making accurate calculations in AGOL, which would be helpful, but my preference would be to get accurate measurements even before we get back to the office and view the map in AGOL - we'd like accurate measurements for lengths and areas in real-time while we're out in the field creating these features in Field Maps. Would your suggested changes also work for that? 

Answer- Yes, setting up your data this way will allow for your measurements to calculate correctly.

 

Here is a quick test I did:

-Make a quick Line layer, called it test line.

-Made it in ArcGIS Pro so I could project it in my local StatePlane. (any layer you make in AGOL will be projected in Web Mercator).

-Once published to AGOL, I added the layer to a new webmap with good arial imagery (projected in web mercator).

-I used a tap measure and measured a parking space, then created a feature line of the same measurement I took. These numbers were very accurate, and I used the measuring tool in AGOL and it gave me the same measurement as well. Tape Measure, AGOL Measuring Tool and my Line Layer Shape length were all the same (imagery can affect this slightly).

 

Hopefully I explained this okay, 

Let me know if you have any more questions. 

TrentonWalker
Occasional Contributor

Fantastic, thank you! This is extremely helpful and has clarified a lot for me. I'm going to test a new template for our Field Maps with these suggestions today and see how it goes. Thanks again.

0 Kudos
IngridHogle
Frequent Contributor

We have had success using referenced Enterprise data, which is in our local UTM NAD83 projection, in Field Maps with Esri's world imagery (for export) basemap.

At first we used Abs($feature["Shape__Area"]) and the equivalent Shape_Length fields to get the actual, correct area and length of the feature into an attribute, but these geometry values are not able to be calculated until the feature is submitted.  So field staff had to save the feature then reopen the edit form to be able to then calculate other Arcade calculations that depended on these geometry values.

At the UC, Field Maps staff suggested we try Abs(AreaGeodetic($feature)) and LengthGeodetic($feature), as these calculate on the fly.

We did some testing and found that the difference between AreaGeodetic and Shape_Area was extremely minimal for the size of features we record (just centimeters off). So we now use AreaGeodetic and LengthGeodetic in our Arcade formulas and call it good enough.

Good luck!

TrentonWalker
Occasional Contributor

Hi Ingrid, thanks for replying. Like I mentioned to Nick above, I'm almost entirely self-taught, so my familiarity with GIS / ArcGIS terminology is not great.

When you say "referenced Enterprise data," what does that mean? And when you say you used ESRI's world imagery basemap "for export," are you saying that there are versions of ESRI's default selection of basemaps that allows them to be exported in other projections? If so, that's news to me, and it's great news! But there's a good chance I've misunderstood, so I thought I'd clarify.

I think our tests (where we walk out a test line feature using the streaming function in Field Maps, measure the feature manually with measuring tape, calculate the geodetic length, calculate the planar length, and then compare to the automatic Shape_Length number after converting it from meters to feet) showed that the Shape_Length and the planar length, not the geodetic length, were the same. Oddly enough, Field Maps displays another length number at the top of the feature when it's selected in Field Maps, and that number appears to be the geodetic length, because it's not equal to the Shape_Length measurement (after that's converted from meters to feet), so it's an entirely separate calculation going on - and this calculation doesn't happen outside of Field Maps. When you click on the item in AGOL or in ArcGIS Pro, it doesn't show up. It's not actually in a field of the feature class itself, it just seems to be part of the pop-up in Field Maps exclusively. These are all very strange design choices to me, but, again, I'm coming to ESRI software as an outsider, so maybe that's why it doesn't make sense.

We've only done a little testing - our field guys are really busy, and when they're all out in the field I don't have anyone in the office to help me manually measure things - but it seems like the geodetic lengths match the manually measured lengths best, generally within a foot or half a foot. And even the manually measured lengths aren't "true" reality, because there's always some slack in the tape, sections where it's sitting on a bump or rock, etc., so I'm comfortable with a little difference. But the difference between the planar calculations and the manually measured lengths is much more than just a "little" difference.

What I'm still confused about is why the planar lengths are longer than the geodetic lengths. In my mind, the geodetic should be longer since they're arching over the curved surface of the earth rather than being drawn straight between two points (or as a series of segments drawn straight between two points). The straightest distance should be the shortest distance, but that's not what we're getting. When I open a Web Map in ArcGIS Pro, select the "Measure" tool, and then measure the planar length of a feature vs. the geodetic length of a feature, the planar length is always longer.

I just want to find out the true distance of a stretch of silt fence after it's installed on the surface of the Earth at a specific location... and I'm finding out that maybe that's too much to ask! Apparently geography and philosophy have a lot more in common than I thought, because now I'm questioning what's real...

0 Kudos
IngridHogle
Frequent Contributor

1. Referenced Enterprise data means our data lives in an ArcGIS Enterprise geodatabase. See Data and publishing in ArcGIS Enterprise—Portal for ArcGIS | Documentation for ArcGIS Enterprise.

2. World Imagery (for export) means you can take a limited amount of the imagery provided by Esri offline. See https://www.arcgis.com/home/item.html?id=226d23f076da478bba4589e7eae95952

3. I don't know the details of the different lengths or why they work the way they do.

 

TrentonWalker
Occasional Contributor

Thanks for the link to the World Imagery (for export). The comments on that link are also very helpful. I'll have to start incorporating this into our offline Field Maps alongside the terrain basemap, which is really useful for what we do.

0 Kudos