I figured it out. Posting my problems here tends to help me organize my 
thoughts and solve problems. Hope you don't mind.

The solution was from an old mapguide user post: 
http://osgeo-org.1560.x6.nabble.com/scale-bar-always-says-Meters-td4203151.html

I edited rest\app\controller\mappingservicecontroller.php. Look for the 
function GeneratePlot(). This function affects DWFs created from runtime maps. 
To change the scale units for DWFs created from the library you would have to 
edit GeneratePlotFromMapDefinition(). The source code is pretty similar in 
both. One gets the map from Session, the other gets it from Library:\\.

Find the lines:

if ($printLayoutStr != null) {
         $layoutRes = new MgResourceIdentifier($printLayoutStr);
         $layout = new MgLayout($layoutRes, $title, MgPageUnitsType::Inches);
}

This checks if you're your REST request includes the path to a printlayout 
resource in Library:\\.  If so, it creates an MgLayout object. The third 
parameter in the constructor is what we're concerned with.

The parameter appears to be a constant, so you would think that the units would 
be imperial to start with. According the post, the constant doesn't work 
properly and we can work around it by including the actual string: "US-English"

Now the code reads:

if ($printLayoutStr != null) {
         $layoutRes = new MgResourceIdentifier($printLayoutStr);
         $layout = new MgLayout($layoutRes, $title, "US-English");
}

If I could request a change to make this less confusing, it would be that the 
third parameter for the MgLayout object be dependent on some kind of global 
configuration so it doesn't need to be edited manually.
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to