banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

Annonce

State Of The Map 2024

#1 Wed 29 October 2008 21:09

Jean marie
Participant assidu
Lieu: Moissy Cramayel
Date d'inscription: 15 Feb 2007
Messages: 309
Site web

MapGuide (1.2 et 2.xx) et OpenLayer

bonjour à vous

je cherche désespérément à comprendre comment reverser une carto de MapGuide sous OpenLayer
je suis tombé sur plusieurs sujet qui parle de la manipulation à faire
comme http://dev.openlayers.org/releases/Open … de-js.html
ou encore http://zacster.blogspot.com/2008/04/map … d-map.html
et encore http://georezo.net/forum/viewtopic.php?pid=117113 (bonjour à Nath ;-) )
mais hélas ce n'est pas très claire pour moi

je vous laisse aussi un tutoriel (source OpenLayer )
ma question est d'avoir un petit retour d'expérience sur ce sujet  et un peu plus d'éclaircissement

et un grand merci à vous
Jean-Marie

Code:

Line   
1 <html xmlns="http://www.w3.org/1999/xhtml"> 
2   <head> 
3     <style type="text/css"> 
4         #map { 
5             width: 600px; 
6             height: 600px; 
7             border: 1px solid black; 
8             float:left; 
9         } 
10         #map2 { 
11             width: 600px; 
12             height: 600px; 
13             border: 1px solid black; 
14             float:left; 
15         } 
16     </style> 
17     <script src="http://openlayers.org/dev/lib/OpenLayers.js"></script> 
18     <script type="text/javascript"> 
19      
20         var map, map2, layer; 
21         var url = "http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi"; 
22         //you can use this URL when MapGuide OS is installed locally 
23         var url = "http://127.0.0.1:8018/mapguide/mapagent/mapagent.fcgi"; 
24          
25         //tiled version 
26         function initTiled(){ 
27          
28             OpenLayers.DOTS_PER_INCH = 96; 
29             var extent = new OpenLayers.Bounds(-87.865114442365922,43.665065564837931,-87.595394059497067,43.823852564430069);         
30             var tempScales =[1000,1930.6977300000001,3727.5937199999998,7196.8567300000004,13894.95494,26826.95795,51794.746789999997,100000]; 
31              
32             var mapOptions = { 
33                 maxExtent: extent,  
34                 scales: tempScales 
35             }; 
36             map = new OpenLayers.Map( 'map', mapOptions ); 
37              
38              var params = { 
39               mapdefinition: 'Library://Samples/Sheboygan/MapsTiled/Sheboygan.MapDefinition', 
40               basemaplayergroupname: "Base Layer Group" 
41             } 
42              
43             var options = { 
44               singleTile: false  
45             } 
46             var layer = new OpenLayers.Layer.MapGuide( "MapGuide OS tiled layer", url, params, options ); 
47             map.addLayer(layer); 
48             map.addControl(new OpenLayers.Control.MousePosition());             
49             map.zoomToMaxExtent(); 
50         } 
51  
52         //un-tiled version 
53         function initUntiled() { 
54          
55           OpenLayers.DOTS_PER_INCH = 96; 
56           var extent = new OpenLayers.Bounds(-87.865114442365922,43.665065564837931,-87.595394059497067,43.823852564430069); 
57           var mapOptions = { 
58                 maxExtent: extent,  
59                 maxResolution: 'auto' 
60           }; 
61           map2 = new OpenLayers.Map( 'map2', mapOptions ); 
62              
63           var options = { 
64               buffer: 1, 
65               singleTile: true 
66           }; 
67            
68           var params = { 
69               mapdefinition: 'Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition' 
70           }; 
71           /* 
72                     The MapGuide layer can also be created using mapname and session as follows provided there 
73                     is some wrapper code to obtain a valid session id and mapname 
74           var params = { 
75               mapname: 'Sheboygan47b3560bf1071', 
76               session: '043bb716-0000-1000-8000-0017a4e6ff5d_en_7F0000010AFC0AFB0AFA' 
77           }; 
78           */ 
79           var layer = new OpenLayers.Layer.MapGuide( "MapGuide OS untiled baselayer", url, params, options ); 
80           map2.addLayer(layer); 
81            
82           //this is how to set up the layer for transparent overlays.  Requires a valid session ID  
83           //and mapName stored in that session. 
84           //If the mapagent URL is on a different server than this OL layer, the OpenLayers proxy script 
85           //must be used since this layer must perform an additional AJAX request before requesting the 
86           //map  image 
87           /*  
88             var options = { 
89               isBaseLayer: false, 
90               transparent: true, 
91               buffer: 1, 
92               singleTile: true 
93             }; 
94             var params = { 
95               mapName: 'Sheboygan', 
96               session: '0b8cb80e-0000-1000-8003-0017a4e6ff5d_en_C0A802AD0AFC0AFB0AFA', 
97             }; 
98             layer = new OpenLayers.Layer.MapGuide( "MapGuide OS Overlay layer", url, params, options ); 
99             map.addLayer(layer); 
100           */  
101             map2.addControl(new OpenLayers.Control.MousePosition());         
102           map2.zoomToMaxExtent(); 
103     } 
104      
105  
106  
107     </script> 
108   </head> 
109   <body onload="initUntiled(); initTiled()"> 
110     <p>If prompted for a password, username is Anonymous and an empty password</p> 
111      
112     Modified example by Zac Spitzer, first map is tiled, second map is not tiled,<br> 
113     note that the mouse position doesn't match between the different versions 
114     <div id="map"></div> 
115     <div id="map2"></div> 
116      
117     <br> 
118      
119   </body> 
120 </html>

Hors ligne

 

#2 Thu 16 April 2009 09:02

nath73
Participant occasionnel
Date d'inscription: 18 Sep 2008
Messages: 27

Re: MapGuide (1.2 et 2.xx) et OpenLayer

Bonjour,

Je lis ce message aujourd'hui (hello Jean-Marie !), j'avais mis de coté cette problématique depuis un moment, et j'y reviens maintenant. As-tu trouvé des réponses ?
Mon but était alors de remonter des couches mapguide dans l'api du géoportail. J'en suis à me poser la question, faut-il continuer dans cette voie, ou abandonner mapguide pour travailler directement avec l'api ?
Si quelqu'un a des réponses ou de l'expérience sur ces sujets, je suis preneuse.
Merci à tous

Nath

Hors ligne

 

#3 Thu 16 April 2009 10:28

Jean marie
Participant assidu
Lieu: Moissy Cramayel
Date d'inscription: 15 Feb 2007
Messages: 309
Site web

Re: MapGuide (1.2 et 2.xx) et OpenLayer

Bonjour Nath

Hélas je n'ai pas plus d'info que toi sur ce sujet et je n'ai pas avancer non plus
bonne journée

Hors ligne

 

#4 Thu 16 April 2009 20:59

Gwenael Bachelot
Participant assidu
Lieu: Bureau Autodesk : Paris 12ème
Date d'inscription: 5 Sep 2005
Messages: 608
Site web

Re: MapGuide (1.2 et 2.xx) et OpenLayer

Bonsoir,
Il y a un exemple en ligne à l'URL suivante :
http://enterprise.mapguide.com/googleopenlayers

Le code source de la page est lisible directement.

Cordialement,
Gwenael
PS : soyez patient, le serveur ne semble pas très rapide.

Dernière modification par Gwenael Bachelot (Thu 16 April 2009 21:01)

Hors ligne

 

#5 Thu 16 April 2009 21:20

Jean marie
Participant assidu
Lieu: Moissy Cramayel
Date d'inscription: 15 Feb 2007
Messages: 309
Site web

Re: MapGuide (1.2 et 2.xx) et OpenLayer

Bonsoir à  vous et merci à toi Gwenael
voila le code source  pris de FF3


Code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MapGuide and Google</title>
<style type="text/css">
body  {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    background: #667788;
    margin: 0 auto; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    color: #000000;
}
.thrColFixHdr #container {
    height:600;
    width: 800;
}
.thrColFixHdr #header {
    background: #CBCEF8;
    height: 25px;
}
.thrColFixHdr #mainContent {
    background:#8080FF;
}
.thrColFixHdr #footer {
    background:#CBCEF8;
    height: 25px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    clear:both;
    height:0;
    font-size: 1px;
    line-height: 0px;
}
.olControlPanel div {
    position: absolute;
    left: 14px;
    height: 16px;
    width: 16px;
    margin: 5px;
    background-color:red;
}

.olControlPanel .olControlMouseDefaultsItemActive {
  top: 120px;
  background-image: url("images/pan.png");
}
.olControlPanel .olControlMouseDefaultsItemInactive {
  top: 120px;
  background-color: blue;
  background-image: url("images/pan.png");
}
.olControlPanel .olControlZoomBoxItemInactive {
  top: 140px;
  background-color: blue;
  background-image: url("images/zoom-in.png");
}
.olControlPanel .olControlZoomBoxItemActive {
  top: 140px;
  background-image: url("images/zoom-in.png");
}
.olControlPanel .olControlZoomToMaxExtentItemInactive {
  top: 160px;
  background-image: url("images/zoom-full.png");
}

</style>


<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAtGc1Bw-KR4G0twM8p8DxvBQO_0oW9AuwWD_8dG9g505dbuw-xxT4AAmglVXFtiPQoHXpFs4DwUMClg"
      type="text/javascript"></script>
<script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">

    var url = "http://enterprise.mapguide.com/mapguide2010/mapagent/mapagent.fcgi";
    var mapDefinition = "Library://Samples/Sheboygan/Maps/SheboyganSphericalMercator.MapDefinition";

    var metersPerUnit = 1;
    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(-9774168.50738698,5415995.25637308,-9754637.25738698,5434757.02491306);

        var mapOptions = {
            projection: new OpenLayers.Projection("EPSG:900913"),
            displayProjection: new OpenLayers.Projection("EPSG:4326"),
            units: "m",
            numZoomLevels: 20,
            minResolution: 0.01 / metersPerUnit,
            maxExtent: mapBounds
        };

        // Create the map in the mainContent div
        map = new OpenLayers.Map( 'mainContent', mapOptions );

        // Create a Google streets layer
        var googleLayer = new OpenLayers.Layer.Google('Google Streets', {type : G_NORMAL_MAP, isBaseLayer: true, sphericalMercator: true});
        map.addLayer(googleLayer);

        // Create a Google satellite layer
        var googleLayer = new OpenLayers.Layer.Google('Google Satellite', {type : G_SATELLITE_MAP, isBaseLayer: true, sphericalMercator: true});
        map.addLayer(googleLayer);

        // Create a Google hybrid layer
        var googleLayer = new OpenLayers.Layer.Google('Google Hybrid', {type : G_HYBRID_MAP, isBaseLayer: true, sphericalMercator: true});
        map.addLayer(googleLayer);

        // Dynamic map params
        var dynamicParams = {
            session: '06d8a338-0ce9-102c-8000-0050569a3bff_en_7F0000010AFC0AFB0AFA',
            mapname: 'SheboyganSphericalMercator1'
        };

        // Dynamic map options
        var dynamicMapOptions = {
          buffer: 1,
          singleTile: true,
          isBaseLayer : false,
          visibility : true,
          transitionEffect: 'resize'
         };

        // Create the dynamic layer
        var dynamicLayer = new OpenLayers.Layer.MapGuide( "MapGuide Map",
            url,
            dynamicParams,
            dynamicMapOptions );
        map.addLayer(dynamicLayer);

        map.zoomToMaxExtent();

        // Set up the footer to display the mouse position
        var footerDiv = document.getElementById("footer");
        var mousePosition = new OpenLayers.Control.MousePosition({div: footerDiv})
        map.addControl(mousePosition);

        // Add a scale display to the map itself
        map.addControl(new OpenLayers.Control.ScaleLine());

        // Add a layer switcher to the map
        var switcher=new OpenLayers.Control.LayerSwitcher();
        map.addControl(switcher);

        // Add some tools
        var zoomBox = new OpenLayers.Control.ZoomBox(
            {title:"Zoom Rectangle: Use this tool to zoom to an area by clicking and dragging."});
        var mouseDefaults = new OpenLayers.Control.MouseDefaults(
            {title:'Pan: Use this tool to pan around the map.'});
        var zoomExtents = new OpenLayers.Control.ZoomToMaxExtent(
            {title:"Zoom Extents: Zoom to the max extent of the map"}) ;
        var panel = new OpenLayers.Control.Panel({defaultControl: zoomBox});
        panel.addControls([mouseDefaults, zoomBox, zoomExtents]);
        map.addControl(panel);

    }


</script>

</head>

<body onload="init()" class="thrColFixHdr">

<div id="container" align="center">
  <div id="header">Google Maps, Autodesk MapGuide Enterprise using Open Layers</div>
  <div id="panel"></div>
  <div id="mainContent"></div>
    <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
    <br class="clearfloat" />

  <!--
  <div id="footer">Footer</div>
</div>-->
</body>
</html>

Dernière modification par Jean marie (Thu 16 April 2009 21:21)

Hors ligne

 

#6 Fri 17 April 2009 08:35

nath73
Participant occasionnel
Date d'inscription: 18 Sep 2008
Messages: 27

Re: MapGuide (1.2 et 2.xx) et OpenLayer

Merci de votre aide

Nath

Hors ligne

 

#7 Wed 31 March 2010 10:48

sma
Juste Inscrit !
Date d'inscription: 26 Sep 2009
Messages: 6

Re: MapGuide (1.2 et 2.xx) et OpenLayer

Bonjour,

J'aimerais pouvoir récupérer la carte courante et les calques affichés dans MapGuide (sans codage en dur!), mais comment faire concrètement? Ne pourrait-on pas utiliser l'id session?
En lisant les codes sources proposés par Jean-Marie au-dessus, il y a des choses intéressantes mais que je ne comprends pas...

/*
The MapGuide layer can also be created using mapname and session as follows provided there
is some wrapper code to obtain a valid session id and mapname
var params = {
mapname: 'Sheboygan47b3560bf1071',
session: '043bb716-0000-1000-8000-0017a4e6ff5d_en_7F0000010AFC0AFB0AFA'
};
=> ???  D'où sort ce numéro de session?

Merci d'avance pour votre aide!

Sébastien

Hors ligne

 

Pied de page des forums

Powered by FluxBB