<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
To build a map, you must have all the components:<br>
1. FeatureSource, references data<br>
2. LayerDefinition, references a FeatureSource<br>
3. MapDefinition, references multiple LayerDefinitions<br>
4. WebLayout, references a MapDefinition<br>
<br>
All these items must be in a repository (either Library or Session),
otherwise they can't be referenced.<br>
<br>
When you write that you want to "create a WebLayout programatically",<br>
do you want to create ALL the above items, or do you have layers and
featuresources?<br>
<br>
(1) If you want to generate a WebLayout ResourceID, you should use:<br>
<pre wrap="">Dim res As New ResourceIdentifier("Filebased data/Maps/mapdata", ResourceTypes.WebLayout)</pre>
If you want to read the name of an existing MapDefinition from another
layout, you must do:<br>
<tt>Dim weblayout as WebLayout =
con.GetWebLayout("Library://mylayout.WebLayout")<br>
Dim res as String = webLayout.Map.ResourceId</tt><br>
<br>
(2) I don't understand the question.<br>
<br>
(3) The MapDefinition is an Xml document. Inside, it references layers,
<br>
which references featuresources, as described above. It is very slow to<br>
do this, so when you open a map in the browser, the xml is transformed
into<br>
a binary object. This object contains all the info from the
MapDefinition and <br>
some info from the layers and featuresources.<br>
<br>
You need to know this, because if you try to toggle layer visibility in
the MapDefinition, <br>
nothing happens. In short, the Runtime Map is a binary object that you
can manipulate<br>
using the MapGuide (and Maestro)-API, and it only works for a displayed
map.<br>
Upon startup, the Runtime Map is identical to the MapDefinition it was
created from.<br>
<br>
<br>
A short example of using an existing WebLayout:<br>
<br>
<pre wrap="">Dim host As New Uri(<a class="moz-txt-link-rfc2396E" href="http://localhost/mapguide/mapagent/mapagent.fcgi">"http://localhost/mapguide/mapagent/mapagent.fcgi"</a>)
Dim conn As New HttpServerConnection(host, "Administrator", "admin", "en", True)

'You have to change the string below to point at a valid WebLayout
</pre>
<tt>Dim weblayout as WebLayout =
con.GetWebLayout("Library://mylayout.WebLayout")<br>
Dim mapdefinition as MapDefinition =
con.GetMapDefinition(weblayout.Map.ResourceId)<br>
weblayout.Map.InitialView = new MapViewType()<br>
weblayout.Map.InitialView.Scale = 2000 'Zoom to 1:2000<br>
weblayout.Map.InitialView.CenterX = (mapdefinition.Extents.MaxX -
mapdefinition.Extents.MinX) + mapdefinition.Extents.MinX<br>
weblayout.Map.InitialView.CenterY = (mapdefinition.Extents.MaxY -
mapdefinition.Extents.MinX) + mapdefinition.Extents.MinY<br>
Dim tempid as ResourceIdentifier = new
ResourceIdentifier(Guid.NewGuid(),
OSGeo.MapGuide.MaestroAPI.ResourceTypes.WebLayout, con.SessionID)<br>
</tt>
<pre wrap="">Response.Redirect("/mapguide/ajaxviewer/?WEBLAYOUT=" &amp; Server.UrlEncode(tempid) &amp; "&amp;USERNAME=Anonymous&amp;PASSWORD=")</pre>
<br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
padmini godavarthi skrev:
<blockquote cite="mid:20790458.post@talk.nabble.com" type="cite">
  <pre wrap="">Hi,
Thanks for u r reply

actually i wrote the code as


    Dim host As New Uri(<a class="moz-txt-link-rfc2396E" href="http://localhost/mapguide/mapagent/mapagent.fcgi">"http://localhost/mapguide/mapagent/mapagent.fcgi"</a>)
        Dim conn As New HttpServerConnection(host, "Administrator", "admin",
"en", True)
        Dim res As New ResourceIdentifier("Filebased data/Maps/mapdata",
ResourceTypes.MapDefinition)
        Dim mapId As String = res.ResourceId


with that i got the map resource id.

But actually to run the application the url in the browser must be like


<a class="moz-txt-link-freetext" href="http://localhost/mapguide/mapviewerajax/?WEBLAYOUT=Library%3a%2f%2fFilebased+data%2fLayout%2flayout.WebLayout">http://localhost/mapguide/mapviewerajax/?WEBLAYOUT=Library%3a%2f%2fFilebased+data%2fLayout%2flayout.WebLayout</a>

1) How can i get this weblayout (like
Library%3a%2f%2fFilebased+data%2fLayout%2flayout.WebLayout) programmetically

2) I want to redirect to the ajax viewer sample application through asp.net
(like given by u )
     Response.Redirect("/mapguide/ajaxviewer/?WEBLAYOUT=...resourceId for
your WebLayout...&amp;USERNAME=Anonymous&amp;PASSWORD=");

3) Can u plz tell me the purpose of runtime map (actualli iam in configusing
state)





Kenneth Skovhede, GEOGRAF A/S wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Instead of re-posting the original question,
could you try to explain what parts of my previous reply
that are unclear or wrong?

<a class="moz-txt-link-freetext" href="http://www.nabble.com/How-to-Load-Runtime-map-in-mapviewerajax-to20704038.html#a20769349">http://www.nabble.com/How-to-Load-Runtime-map-in-mapviewerajax-to20704038.html#a20769349</a>

Regards, Kenneth Skovhede, GEOGRAF A/S



padmini godavarthi skrev:
    </pre>
    <blockquote type="cite">
      <pre wrap=""> Hi ,
iam using mapguide open source 2.0( with .Net 2.0 + IIS 5.1)
Iam using dotnet viewer sample while running the application i observed
that
the layout path given in the application.

as

String webLayout =
"Library://Samples/Sheboygan/Layouts/SheboyganAspTiled.WebLayout";

 it works but now i want to create this weblayout in run time (by code)
using mapguide maestro api

for this purpose i followed the link

<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/RuntimeMap">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/RuntimeMap</a>

but i didnt get any out.

can u plz tell me

1) how to create this weblayout in run time
2) How it will works

If u know this plz tell me the procedure.


Regards,
Padmini.






  
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>