<!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">
Alright, that looks odd.<br>
It seems that the outermost div (named olMap) is hidden for some reason.<br>
have you tried to manually set the size and position for the div?<br>
like: <div id="olMap" style="display: block; position: absolute;
top: 0px; left: 0px; width: 500px; height: 500px"><br>
<br>
The trace shows that the image is 300x300 but placed at -145 and -222
wich means that at most 155x78 pixels would be visible, wich is very
weird.<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
Rodolfo Moreno skrev:
<blockquote cite="mid:1227114043448-1519783.post@n2.nabble.com"
type="cite">
<pre wrap="">Kenneth,
In debug mode the init function is being used.
In order to know whether mapguide server is requested I was seeing the HTML
firebug tab (see image attached) and it's possible see the image that
mapguide server has sent.
Zac,
There is nothing in the firebug console tab
maybe the image attached could be a clue what the viewer, in this case open
layers is failing.
Regards,
zspitzer wrote:
</pre>
<blockquote type="cite">
<pre wrap="">anything in the firebug console tab?
On Wed, Nov 19, 2008 at 2:41 AM, Kenneth Skovhede, GEOGRAF A/S
<a class="moz-txt-link-rfc2396E" href="mailto:ks@geograf.dk"><ks@geograf.dk></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">The Firebug shows that you newer send a request to the MapGuide server.
Is there something missing, or are you never calling the init() function?
Regards, Kenneth Skovhede, GEOGRAF A/S
Rodolfo Moreno skrev:
Hi Kenneth,
Here is the javascript code. It's similar to the posted in the wiki
(<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/attachment/wiki/CodeSamples/JavaScript/OpenlayersExample/sheboygan.php">http://trac.osgeo.org/mapguide/attachment/wiki/CodeSamples/JavaScript/OpenlayersExample/sheboygan.php</a>)
<script type="text/javascript">
var map, map2, layer;
//var url =
<a class="moz-txt-link-rfc2396E" href="http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi">"http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi"</a>;
//you can use this URL when MapGuide OS is installed locally
                var url = <a class="moz-txt-link-rfc2396E" href="http://localhost/mapguide/mapagent/mapagent.fcgi">"http://localhost/mapguide/mapagent/mapagent.fcgi"</a>;
var metersPerUnit = 111319.4908; //value returned from mapguide
var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;
OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit;
OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;
OpenLayers.DOTS_PER_INCH = 96;
function init(){
        var mapBounds = new
OpenLayers.Bounds(-87.764986990963,43.691398128788,-87.6955215109,43.79752000048);
        var fixedScales
=[1000,1930.6977300000001,3727.5937199999998,7196.8567300000004,13894.95494,26826.95795,51794.746789999997,100000];
var mapOptions = {
maxExtent: mapBounds,
scales: fixedScales
};
                        
map = new OpenLayers.Map( 'map', mapOptions );                        
                        
         //tiled map
var tiledParams = {
mapdefinition:
'Library://Samples/Sheboygan/MapsTiled/Sheboygan.MapDefinition',
basemaplayergroupname: "Base Layer Group",
         session: '<%=sessionId%>'
}
var tiledOptions = {
units: "dd",
singleTile: false
}
                        
var tiledLayer = new OpenLayers.Layer.MapGuide( "GetTileImage",
                                url,
                                tiledParams,
                                tiledOptions );
map.addLayer(tiledLayer);
                        
//un-tiled versions
var dynamicOverlayOptions = {
buffer: 1,
singleTile: true,
         isBaseLayer : false,
         visibility : false
};
var mapImageOptions = {
buffer: 1,
singleTile: true,
         isBaseLayer : true
};
var untiledParams = {
        session: '<%=sessionId%>',
mapname: 'Sheboygan'
};
var dynamicLayer = new OpenLayers.Layer.MapGuide(
"GetDynamicMapOverlayImage",
        url,
        untiledParams,
        dynamicOverlayOptions );
map.addLayer(dynamicLayer);
                        
var mapImageLayer = new OpenLayers.Layer.MapGuide( "GetMapImage",
        url,
        untiledParams,
        mapImageOptions );
map.addLayer(mapImageLayer);
map.zoomToMaxExtent();
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.Scale());
                        
var switcher=new OpenLayers.Control.LayerSwitcher();
map.addControl(switcher);
switcher.maximizeControl();
}
</script>
The sessionId is returned as parameter to openlayers and the mapname is
hard-coded as 'Sheboygan'
only for the untiled version layer.
Also I have tested it with FF and firebug, I have gotten the same result
(see the image attached).
Regards,
Kenneth Skovhede, GEOGRAF A/S wrote:
How do you return the map name and sessionId to OpenLayers?
If you use Firebug (in Firefox), the "Net" tab will show you any errors
thrown by MapGuide.
<a class="moz-txt-link-freetext" href="http://getfirebug.com/">http://getfirebug.com/</a>
Regards, Kenneth Skovhede, GEOGRAF A/S
Rodolfo Moreno skrev:
Hi all,
I have tried to port the wiki sample "display mapguide maps using
openlayers" from PHP to .NET without successful.
The javascript code is the same of the example, the difference is the
SERVER
CODE. It's my .NET CODE:
public partial class OLViewer : System.Web.UI.Page
{
public String sessionId;
protected void Page_Load(object sender, EventArgs e)
{
try
{
// Initialize the web tier
Utility utility = new Utility(Request);
utility.InitializeWebTier();
MgUserInformation userInfo = new
MgUserInformation("Anonymous",
"");
MgSiteConnection siteCnn = new MgSiteConnection();
siteCnn.Open(userInfo);
MgSite site = siteCnn.GetSite();
sessionId = site.CreateSession();
userInfo.SetMgSessionId(sessionId);
MgResourceService resourceService =
(MgResourceService)siteCnn.CreateService(MgServiceType.ResourceService);
MgMappingService mappingService =
(MgMappingService)siteCnn.CreateService(MgServiceType.MappingService);
MgResourceIdentifier resId = new
MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
MgMap map = new MgMap();
map.Create(resourceService, resId, "Sheboygan");
MgSelection sel = new MgSelection(map);
sel.Save(resourceService, "Sheboygan");
MgResourceIdentifier mapStateId = new
MgResourceIdentifier("Session:" + sessionId + "//" + "Sheboygan." +
MgResourceType.Map);
map.Save(resourceService, mapStateId);
}
catch (Exception er)
{
Response.Write(er.Message);
}
}
}
when I run the sample the Page is shown but not the map. (see attached
image).
<a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n1511002/MGusingOL.jpg">http://n2.nabble.com/file/n1511002/MGusingOL.jpg</a>
I don't know what is the error.
I'd appreciate so much your suggestions.
-----
Rodolfo Moreno
CivilEng
_______________________________________________
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>
<a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n1514643/FirebugTest.jpg">http://n2.nabble.com/file/n1514643/FirebugTest.jpg</a>
-----
Rodolfo Moreno
CivilEng
_______________________________________________
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="">
--
Zac Spitzer -
<a class="moz-txt-link-freetext" href="http://zacster.blogspot.com">http://zacster.blogspot.com</a>
<a class="moz-txt-link-freetext" href="http://ennoble.dreamhosters.com/mapguide-central/">http://ennoble.dreamhosters.com/mapguide-central/</a>
+61 405 847 168
_______________________________________________
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=""><!----><a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n1519783/HTMLfirebugTab.jpg">http://n2.nabble.com/file/n1519783/HTMLfirebugTab.jpg</a>
-----
Rodolfo Moreno
CivilEng
</pre>
</blockquote>
</body>
</html>