Select to view content in your preferred language

How does Map. resolution work ? :-)

1863
4
01-24-2011 08:42 AM
JacobSaugmann
Deactivated User
Hi All

Can somebody help me with some explanation? ??
I???m working on a Silverlight usercontrol for printing. The user selects paper size, orientation, resolution and output scale, then clicks in the map and then I???ve made a class that takes the parameters and creates a BitmapImage using the mapserver/?export feature. That works fine.(the export part of the code.. not the image returned ??) The thing I just can understand I how the Map.resolution works, and how to calculate the extends of the export bounding box based on the position of the mouse.
I???ve found an example on how to calculate the Scale of the current view.-
From the API documentation
Map scale = 1 : (96dpi * 39.37 inches/meter * (Map.Resolution * 1))

Why the 39.37 ??
And when I click in the map I get example 206,602 how can I make that an point I can use to the export ex 55212.21545,625879.15455 ?? I???m having trouble understanding the way the map uses the Map resolution .. Can anybody give point me to some sort of explanation ? 🙂
0 Kudos
4 Replies
dotMorten_esri
Esri Notable Contributor
Hej Jacob

There's 39.37 inches to one meter.
0 Kudos
JacobSaugmann
Deactivated User
Hej Morten

Thanks 🙂

now when i have a point on the screen (where the user clicks) and know how big the rectangle has to be in a given scale, how can i transform this to Points on the Screen that match the scale the map is currently in.

Lets say i know the start point - its where the mouse i clicked, how can i transform the rectangel size to units on the screen to the the second point for the envelope?
0 Kudos
dotMorten_esri
Esri Notable Contributor
I'm not sure I completely follow what you want, but here's the laydown of the map resolution:
It's the size of one pixel in map units. The map unit might be meters, feet, degrees etc depending on what spatial reference the map is in. The map is essentially unit and scale agnostic, so to the map it's just a "dumb number". If you need to make sense of it, you will need to first figure out how big a pixel is on your screen. A common value used is 96 pixels per inch (DPI), or 1/96 inch per pixel, but thats just a very rough estimate and never the case. It gets even worse when you connect your laptop to a projector and clone the screen. Now you have different DPIs on your laptop and on the projected image, and thus you have two different scales at the same time! This does make sense since the same map extent is bigger on the projected screen, thus the scale must be different. This is basically why the map doesn't deal with scale. There is no good way of outputting the correct scale (note: When ArcMap displays scale it incorrectly assumes 96dpi).

I've seen examples of apps asking people to measure the size of a box on the screen. Using that, the app can calculate the correct DPI. Here's an example of that: http://www.gal-systems.com/2/post/2011/01/calculating-and-calibrating-the-scale-in-web-mercator-proj...

If you need to print the map, it gets a little easier. Often we know what size the paper is in "real" units, so we can now better estimate the scale*. If I want to print the current map extent on a piece of paper thats 200mm wide, and my map extent is 5000m wide (ie. map.Extent.Width * mapUnitsToMeterConversionFactor), the scale becomes: 200mm:5000m, or (if we make the units the same on both sides) 1:25000.

Notice how I didn't even have to mess with the resolution to get to that value. However, since we are dealing with a bitmap, we at some point need to generate an image that will fit the piece of paper. If the printer prints at 300dpi and the paper is 200mm wide, we get 200mm/2.54mmPerInch * 300dpi = 2362 pixels wide.
So our map extent should be 2362px * map.Resolution, which will give us the width in MapUnits.

Hope this helps.


*Note that in addition to this "simple" scale calculation, the world is projected onto a flat screen, and that projection causes the scale to change throughout the world. It might not even be the same scale horizontally and vertically (Mercator for instance, the Y scale goes toward infinity when you get closer to the poles, and X scale also changes based on both Y and X). This distortion is often ignored, and for many local projections you can in most cases ignore it, but it's worth taking note off that you pretty much never will get the correct scale, unless you print in 3D 🙂
0 Kudos
JacobSaugmann
Deactivated User
Hi Morten

THANKS a lot, that was a fantastic explanation, no I have a basic understanding of how I works �?
Have a nice day.
0 Kudos