MapServer exportMapImage - Device Resolution

579
1
Jump to solution
07-17-2013 08:38 AM
LeoDonahue
Occasional Contributor III
MapServer exportMapImage
According to the documentation, when exporting a map image, specifying a device resolution in IImageDisplay will affect map scale.

Is there a method to calculate the correct device resolution for IImageDisplay based on the width and height you are setting?
0 Kudos
1 Solution

Accepted Solutions
LeoDonahue
Occasional Contributor III
With the help of Ameya N. from ESRI tech support I think we have it figured out.

Before you export the map image from MapServer, you need to know how much space the image is going to take up.  In my case, I was exporting the MapServer map image to be added to a pdf document.  In the pdf document, I had placed 36 pt (1/2 inch margins), so I know that I only have 7.5 inches to work with in the width area now, slightly less if I add a border to the map area in the pdf. 

Basically you multiply 7.5 times the device resolution you want your image to have (say 100), and that gives you the width of the IImageDisplay width property, in this case 750.

When I follow this, the MapServer map image that is exported and then printed from the pdf retains the correct map scale for features in the map image.

Of course, you have to set your map scale before you export the map image from MapServer, that is if you want to create a print of a known map scale.

View solution in original post

1 Reply
LeoDonahue
Occasional Contributor III
With the help of Ameya N. from ESRI tech support I think we have it figured out.

Before you export the map image from MapServer, you need to know how much space the image is going to take up.  In my case, I was exporting the MapServer map image to be added to a pdf document.  In the pdf document, I had placed 36 pt (1/2 inch margins), so I know that I only have 7.5 inches to work with in the width area now, slightly less if I add a border to the map area in the pdf. 

Basically you multiply 7.5 times the device resolution you want your image to have (say 100), and that gives you the width of the IImageDisplay width property, in this case 750.

When I follow this, the MapServer map image that is exported and then printed from the pdf retains the correct map scale for features in the map image.

Of course, you have to set your map scale before you export the map image from MapServer, that is if you want to create a print of a known map scale.