[mapguide-users] Change map scale or get min and max scale from layer

Lukas Hybner hybner at atlas.cz
Tue Oct 14 07:12:57 EDT 2008


Hi all,

I have a problem when I show tree of layers. I need to know if the layer
is Visible or not. 

For Example client send scale=5000000 and some layers is visible from 1
to 4000. When I want to know if the layers is visible, I use method
isVisible(). This method return always true because map.getViewScale()
returns 1.0 (not 5000000).

My code is (in jsp):

String mapDefinition = "some map definition";
MgMap map = new MgMap();
MgResourceIdentifier resId = new MgResourceIdentifier(mapDefinition);
String mapName = resId.GetName();
map.Create(resourceSrvc, resId, mapName);

MgGeometryFactory factory = new MgGeometryFactory();
MgCoordinate centerCoord = factory.CreateCoordinateXY(centerx,centery); 


//here is scale property from client
MgByteReader mgImage = renderingSrvc.RenderMap( map, null, centerCoord,
scale,width, height, color, "JPG" );

out.println(map.GetViewScale()); //returns 1.0

MgLayerCollection layers = map.GetLayers();
for (int i = 0; i < layers.GetCount(); ++i)
	out.println( (layers.GetItem(i).isVisible ? "on" : "off") );
//this write on


How can I change scale in object map? Or is some other solution? Or can
I read from layer object min and max scale?

Lukas Hybner




More information about the mapguide-users mailing list