Re: [mapguide-users] MapGuide REST units for DWF scale using printLayout

2014-10-07 Thread Berg, James
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
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

[mapguide-users] MapGuide REST units for DWF scale using printLayout

2014-10-03 Thread Berg, James
Windows Server 2008 64-bit
MapGuide Open Source 2.5.2
MapGuide REST 0.10
Maestro 5.1

Hi,

I'm using the following REST GET request:

localhost/mapguide/rest/session/[SessionId]/[MapName].Map/plot.dwf?papersize=A3printlayout=Library://Shared/Layouts/Print.PrintLayout

Library://Shared/Layouts/Print.PrintLayout is just a library path to a copy of 
the Sheboygan print layout.

The scale that is supplied by the print layout is in metric. Is there any way 
to display a scale in inches or feet?

Thanks
[cid:image001.png@01CFDF11.767EC010]
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users