<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I wrote a follow up, with corrected code.<br>
You are using the initial one, and you are missing a "?" mark in the
redirect URL.<br>
<br>
Try to use the updated version, and beware of the question mark in the
Response.Redirect call.<br>
<pre class="moz-signature" cols="72">

Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
padmini godavarthi skrev:
<blockquote cite="mid:20809622.post@talk.nabble.com" type="cite">
  <pre wrap="">Hi,
Thanks for u r reply.


I tried this code but i got an error that

Server Error in '/maestro' Application.
--------------------------------------------------------------------------------

HTTP Error 400 - Bad Request. 

--------------------------------------------------------------------------------
Version Information: ASP.NET Development Server 8.0.0.0 


my code was 

    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 = conn.GetWebLayout("Library://Filebased
data/Layout/layout.WebLayout")
        Dim mapdefinition As MapDefinition =
conn.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("layout",
OSGeo.MapGuide.MaestroAPI.ResourceTypes.WebLayout, conn.SessionID)

        Response.Redirect("/mapguide/ajaxviewer/WEBLAYOUT=" &amp;
Server.UrlEncode(tempid)

joscsu wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">
 Or this:
System.Guid.NewGuid().ToString()


----- Ursprungligt meddelande ----
Från: Maksim Sestic <a class="moz-txt-link-rfc2396E" href="mailto:max@geoinova.com">&lt;max@geoinova.com&gt;</a>
Till: MapGuide Users Mail List <a class="moz-txt-link-rfc2396E" href="mailto:mapguide-users@lists.osgeo.org">&lt;mapguide-users@lists.osgeo.org&gt;</a>
Skickat: tisdag 2 december 2008 16:49:21
Ämne: RE: [mapguide-users] Runtime map problem

Try this:

System.Guid.NewGuid() 



-----Original Message-----
From: <a class="moz-txt-link-abbreviated" href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a>
[<a class="moz-txt-link-freetext" href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</a>] On Behalf Of padmini
godavarthi
Sent: Tuesday, December 02, 2008 15:35
To: <a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
Subject: Re: [mapguide-users] Runtime map problem


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=" &amp;
Server.UrlEncode(tempid) &amp; "&amp;SESSION=" &amp; 
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=" &amp;
Server.UrlEncode(tempid) &amp; "&amp;USERNAME=Anonymous&amp;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%2fF">http://localhost/mapguide/mapviewerajax/?WEBLAYOUT=Library%3a%2f%2fF</a>
ilebased+data%2fLayout%2flayout.WebLayout

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-to20">http://www.nabble.com/How-to-Load-Runtime-map-in-mapviewerajax-to20</a>
704038.html#a20769349

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/Run">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/Run</a>
timeMap

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="">--
View this message in context:
<a class="moz-txt-link-freetext" href="http://www.nabble.com/Runtime-map-problem-tp20789983p20793385.html">http://www.nabble.com/Runtime-map-problem-tp20789983p20793385.html</a>
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
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>

__________ Information from ESET NOD32 Antivirus, version of virus
signature
database 3658 (20081202) __________

The message was checked by ESET NOD32 Antivirus.

<a class="moz-txt-link-freetext" href="http://www.eset.com">http://www.eset.com</a>



_______________________________________________
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>



      __________________________________________________________
Låna pengar utan säkerhet. Jämför vilkor online hos Kelkoo.
<a class="moz-txt-link-freetext" href="http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014">http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014</a>
_______________________________________________
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>