<!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">
Its a function that creates a GUID (Globally Unique ID).<br>
It creates a string like "xcsdfasd-sdfasdf-dsdfasf" but ensures that it
is mathematically <br>
certain that you will not get duplicates, even if you call it multiple
times on multiple machines.<br>
For the example I sent, you can replace it with any string, like:
"session map test".<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
padmini godavarthi skrev:
<blockquote cite="mid:20793385.post@talk.nabble.com" type="cite">
<pre wrap="">Hi,
Thanku very much for ur help
i tried this code
but i got an error in the line
Dim tempid as ResourceIdentifier = new ResourceIdentifier(Guid.NewGuid(),
OSGeo.MapGuide.MaestroAPI.ResourceTypes.WebLayout, con.SessionID)
because of this Guid.NewGuid()
1) Actually what is this?
2) Which paramater we have to pass in this place instead of Guid.NewGuid()
Regards,
Padmini
Kenneth Skovhede, GEOGRAF A/S wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I forgot to save the weblayout in the code below :(
Updated version is:
'Setup connection
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
Dim weblayout as WebLayout =
con.GetWebLayout("Library://mylayout.WebLayout")
Dim mapdefinition as MapDefinition =
con.GetMapDefinition(weblayout.Map.ResourceId)
'Modify the initial view of the weblayout
weblayout.Map.InitialView = new MapViewType()
weblayout.Map.InitialView.Scale = 2000 'Zoom to 1:2000
weblayout.Map.InitialView.CenterX = (mapdefinition.Extents.MaxX -
mapdefinition.Extents.MinX) + mapdefinition.Extents.MinX
weblayout.Map.InitialView.CenterY = (mapdefinition.Extents.MaxY -
mapdefinition.Extents.MinX) + mapdefinition.Extents.MinY
'Obtain a unique session based id for the temporary weblayout (which is
a copy of an existing WebLayout)
Dim tempid as ResourceIdentifier = new
ResourceIdentifier(Guid.NewGuid(),
OSGeo.MapGuide.MaestroAPI.ResourceTypes.WebLayout, con.SessionID)
'Save the layout, otherwise you can't reference it
con.SaveResourceAs(weblayout, tempid)
'Open the viewer, and use the temporary layout, since the map only
exists in the
'current session, we must use that session, and NOT supply
username/password
'BEWARE: The session belongs to the Administrator account, so the user
gets full access to MapGuide (delete, modify, etc.)
Response.Redirect("/mapguide/ajaxviewer/?WEBLAYOUT=" &
Server.UrlEncode(tempid) & "&SESSION=" & Server.UrlEncode(con.SessionID))
Regards, Kenneth Skovhede, GEOGRAF A/S
Kenneth Skovhede, GEOGRAF A/S skrev:
</pre>
<blockquote type="cite">
<pre wrap="">To build a map, you must have all the components:
1. FeatureSource, references data
2. LayerDefinition, references a FeatureSource
3. MapDefinition, references multiple LayerDefinitions
4. WebLayout, references a MapDefinition
All these items must be in a repository (either Library or Session),
otherwise they can't be referenced.
When you write that you want to "create a WebLayout programatically",
do you want to create ALL the above items, or do you have layers and
featuresources?
(1) If you want to generate a WebLayout ResourceID, you should use:
Dim res As New ResourceIdentifier("Filebased data/Maps/mapdata",
ResourceTypes.WebLayout)
If you want to read the name of an existing MapDefinition from another
layout, you must do:
Dim weblayout as WebLayout =
con.GetWebLayout("Library://mylayout.WebLayout")
Dim res as String = webLayout.Map.ResourceId
(2) I don't understand the question.
(3) The MapDefinition is an Xml document. Inside, it references layers,
which references featuresources, as described above. It is very slow to
do this, so when you open a map in the browser, the xml is transformed
into
a binary object. This object contains all the info from the
MapDefinition and
some info from the layers and featuresources.
You need to know this, because if you try to toggle layer visibility
in the MapDefinition,
nothing happens. In short, the Runtime Map is a binary object that you
can manipulate
using the MapGuide (and Maestro)-API, and it only works for a
displayed map.
Upon startup, the Runtime Map is identical to the MapDefinition it was
created from.
A short example of using an existing WebLayout:
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
Dim weblayout as WebLayout =
con.GetWebLayout("Library://mylayout.WebLayout")
Dim mapdefinition as MapDefinition =
con.GetMapDefinition(weblayout.Map.ResourceId)
weblayout.Map.InitialView = new MapViewType()
weblayout.Map.InitialView.Scale = 2000 'Zoom to 1:2000
weblayout.Map.InitialView.CenterX = (mapdefinition.Extents.MaxX -
mapdefinition.Extents.MinX) + mapdefinition.Extents.MinX
weblayout.Map.InitialView.CenterY = (mapdefinition.Extents.MaxY -
mapdefinition.Extents.MinX) + mapdefinition.Extents.MinY
Dim tempid as ResourceIdentifier = new
ResourceIdentifier(Guid.NewGuid(),
OSGeo.MapGuide.MaestroAPI.ResourceTypes.WebLayout, con.SessionID)
Response.Redirect("/mapguide/ajaxviewer/?WEBLAYOUT=" &
Server.UrlEncode(tempid) & "&USERNAME=Anonymous&PASSWORD=")
Regards, Kenneth Skovhede, GEOGRAF A/S
padmini godavarthi skrev:
</pre>
<blockquote 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...&USERNAME=Anonymous&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>
<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="">_______________________________________________
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>