Not sure this is what you are asking but, this is how I understand your question.

Basically the output of an ASPX page is html (or any format really).
Since you want to output the scale, you would want the following html output:
<html><body><script>
var maxScale = <%=serverGeneratedMaxScale%>;
GetMap().ZoomToView(x, y, maxScale);
</script></body></html>

(I've left out the GetMap() and x, y code).

The <%=serverGeneratedMaxScale%> gets processed by the ASP.Net runtime,
and inserts the value of the variable named "serverGeneratedMaxScale" in th output.

In your codebehind file, just declare a public instance variable with that name,
and insert the above code in the aspx (below the codebehind declaration),
and it should come out.


Another slightly more sophisticated way of doing this, is to issue and AJAX call
and have the page return a JSON object string like:
{x: 333, y: 444, maxScale: 555}

Then in your Ajax callback handler do this:
var obj = eval('(' + responseText + ')');
GetMap().ZoomToView(obj.x, obj.y, obj.maxScale);

I can't remember what the AJAX stuff is called in the viewer, but there are
plenty of free AJAX helper code avalible online.

The benefit of using an AJAX call is that the user cannot pres "back",
there is no "click" sound, and you don't need to mess with hidden frames.

Regards, Kenneth Skovhede, GEOGRAF A/S

On 15-02-2010 16:25, Johannes Foell wrote:
Hi List,

I'm new to MG (and JS) and have a question about the layer's maxscale. I can
read the maxscale out of the Layerdefinition using a XML-File. Having the
maxscale read out for each layer, I need the highest maximum for the
layergroup at the Viewer API to zoom to a given coordinate and this
maxscale.
Currently i compare the different maxscales and save the largest number as
double. Writing this double to a new XML-File, i can't read it to the Viewer
API.

Is there a way to get this maxscale to the Viewer API and the method
ZoomToView()?

I'm using VB.Net and JS.

Or is there just another solution?

Thanks for any hint in advance.
Best regards,
Johannes Foell
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to