Scale vs Physical Measurement on web apps

2132
1
Jump to solution
04-30-2016 10:48 AM
JosephMootz1
Occasional Contributor

What is the best way to ensure web maps display to scale correctly on screen and when printed to match physical measurements?

Our customers need to be able to create and print maps to scale. So if the scale is 1:600 for example, 1 inch on the screen map and 1 inch on the printed map represents 50ft in the physical environment (1in:50ft = 1:600).

We have a web app with a featurelayer for a basemap so we can zoom to scale without being limited to the LOD settings of a tile basemap. We can set the scale to 600 using map.setscale(600) in the ESRI Javascript API, then draw a 50 foot line on the map to match 50 ft in the physical world. The map.getScale() confirms the current scale of the map. But, the line measures approximately 1.375 inches on the screen and 1.5 inches when the map is printed.

If we set the scale to 800, the line measures 1 inch on the screen as it should for a 1:600 scale. If we force the scale to 900 when printing, the printed map measures 1 inch as it should for a 1:600 scale.

We have done some tests for other scales and it seems the setscale and getscale functions are off by a factor of 4:3 on the screen and 3:2 for the printer.

Do we need to adjust for aspect ratio for the map.setscale() and map.getscale() functions? If so, is the adjustment hardware dependent? I don't know if it is a coincidence but esri's GIS dictionary defines aspect ratio as

"[hardware] The ratio of the width of an image to its height. The aspect ratio of a standard computer monitor is 4:3 (rectangular)."

This is a public app, so not sure if the aspect ratio of 4:3 would work on all monitors or would need to be adjusted for individual monitors and how to do that.

We tried calculating an extent based on the scale and using setExtent instead of setScale based on this technical article (http://support.esri.com/fr/knowledgebase/techarticles/detail/23278) but had the same issue. We calculated the Map Scale Factor = Reference Scale / (ppi * constant), but it seemed like we still needed to adjust by 4:3 for the extent on the screen to match the expected physical measurement .

Any help is appreciated.

0 Kudos
1 Solution

Accepted Solutions
JosephMootz1
Occasional Contributor

This is an issue with projection. The web map is using Web Mercator spatial reference so planar measurements are distorted as you move away from the equator.

Although we have our own Non-Tiled basemap for which we can use a different projected spatial reference, we also allow use of ESRI's tiled basemaps. We could set our map and basemap to a projected spatial reference, but then the ESRI basemaps are not listed in the Basemap gallery widget.

The ESRI Javascript api functions map.setScale(), map.getScale() , map.extent all use the map's Spatial reference, i.e. Web Mercator . So when we set the scale to 600 using map.setScale(), planar lengths are off by a factor of the ratio of the extent in map units to the extent in planar units. We did some math to get the correct scale to set the map at so that measurements on the monitor match the physical world, i.e. 1 inch on the monitor = 50 ft in the physical world, but that affects other widgets like the coordinate widget and printing widget and it does not seem like a robust solution. Also, the issue with monitor projection is not as important as with printed maps.

The simple solution for printing is to force the PrintTask's out spatial reference to a projected spatial reference by modifying the code in the print widget as follows:

this.printparams.outSpatialReference =new SpatialReference({ wkid:2914 });

So for now, this issue is resolved for us until we can find a way to have a the web map in a spatial reference other than Web Mercator and still have the Basemap Gallery allow access to ESRI's basemaps.

Some helpful related blogs are below:

Measuring distances and areas when your map uses the Mercator projection | ArcGIS Blog

GeometryEngine: Testing spatial relationships and editing | ArcGIS Blog

View solution in original post

1 Reply
JosephMootz1
Occasional Contributor

This is an issue with projection. The web map is using Web Mercator spatial reference so planar measurements are distorted as you move away from the equator.

Although we have our own Non-Tiled basemap for which we can use a different projected spatial reference, we also allow use of ESRI's tiled basemaps. We could set our map and basemap to a projected spatial reference, but then the ESRI basemaps are not listed in the Basemap gallery widget.

The ESRI Javascript api functions map.setScale(), map.getScale() , map.extent all use the map's Spatial reference, i.e. Web Mercator . So when we set the scale to 600 using map.setScale(), planar lengths are off by a factor of the ratio of the extent in map units to the extent in planar units. We did some math to get the correct scale to set the map at so that measurements on the monitor match the physical world, i.e. 1 inch on the monitor = 50 ft in the physical world, but that affects other widgets like the coordinate widget and printing widget and it does not seem like a robust solution. Also, the issue with monitor projection is not as important as with printed maps.

The simple solution for printing is to force the PrintTask's out spatial reference to a projected spatial reference by modifying the code in the print widget as follows:

this.printparams.outSpatialReference =new SpatialReference({ wkid:2914 });

So for now, this issue is resolved for us until we can find a way to have a the web map in a spatial reference other than Web Mercator and still have the Basemap Gallery allow access to ESRI's basemaps.

Some helpful related blogs are below:

Measuring distances and areas when your map uses the Mercator projection | ArcGIS Blog

GeometryEngine: Testing spatial relationships and editing | ArcGIS Blog