Show/Hide Toolbars

MPExporter

Navigation: Examples

Example: Exporting an SVG Map

Scroll Prev Top Next More

This example shows you how to use MPExporter to export a shaded area data map. The example uses a US County Population map, us_county_pop.ptm and the albers_conic.prj projection file, both of which can be found in the MPExporter examples file:

 

http://www.mpexporter.com/downloads/examples_mpexporter.zip

 

Note that this map file requires MapPoint North America 2013, and looks like this:

 

us_county_pop_mp

 

In order to create a shaded area map, MPExporter requires the area shape definitions (counties in this example). This are available in the Professional and Trial licenses. You can still run this SVG example if you are using the Basic license, but the counties will be marked with colored circles instead of colored areas.

 

To export this data, display the main MPExporter panel by selecting MPExporter... on the MapPoint Tools menu:

 

mainpanel_sample_svg

 

Here we are using SVG for the output. Select the Output File. This is usually easier by pressing the "..." button to display the standard Windows File dialog box.

 

Enter the coordinate system information. First set the External PRJ file to tell MPExporter that we wish to use a coordinate system defined in an external file. Then press the Select PRJ File button to select the albers_conic.prj file in the examples archive. This file defines the North American Albers Equal Area Conic (ESRI 102008) coordinate system, which is also defined at: http://spatialreference.org/ref/esri/north-america-albers-equal-area-conic/

 

These map coordinates can get rather large, and many SVG display systems will have trouble with them. MPExporter has two ways of handling this: both are set by the Final Coordinates: option. Set this to Translate and Scale Coordinates to tell MPExporter to scale and translate the final coordinates into a more acceptable range. The alternative (Scale Coordinates to a Window) will scale the final coordinates to an explicit range defined in pixels. This is particularly useful for Web browsers which expect a pixel coordinate system with the origin in the upper left corner. However, Translate and Scale Coordinates will preserve the aspect ratio whilst Scale Coordinates to a Window will not.

 

After setting Translate and Scale Coordinates, set the required scale and translation. Set the scale to 0.0001. This will multiple all coordinates by 0.0001. You can also apply an origin translation (Origin) if you wish to display the SVG in a web browser. Unlike most drawing packages, most if not all web browsers cannot handle negative SVG coordinates and they interpret 1 unit = 1 pixel.

 

Most of the other settings are as before. However when you selected SVG, a Shapes option named Line Thickness was enabled. This defines the line thickness in terms of map coordinates (before the scale is applied). Here we have set the line thickness to 1.0, but you will probably want to use a much smaller thickness (e.g. 0.01) if you have selected Geographic Coordinates because the map units are degrees.

 

Press Export to start the export process. The resulting SVG file can then be viewed in a vector editing program such as Adobe Illustrator or Inkscape:

 

sample_us_albers

 

Notice that the map projection is different to anything possible with MapPoint, Bing Maps, or Google Maps. This is because we have used the Albers Equal Area projection. This has the remarkable property that all relative areas remain unchanged. Alaska really is that big!