MapGuide Untiled

This example uses OpenLayers v4.0.1. The latest is v.

#### MapGuide Untiled

Example of a untiled MapGuide map.

Example of a untiled MapGuide map.

Related API documentation:

- ol.Map
,
- ol.View
,
- ol.layer.Image
,
- ol.source.ImageMapGuide

Copy Edit
MapGuide Untiled Example of a untiled MapGuide map. var mdf = 'Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition'; var agentUrl = 'http://data.mapguide.com/mapguide/mapagent/mapagent.fcgi?USERNAME=Anonymous'; var bounds = [ -87.865114442365922, 43.665065564837931, -87.595394059497067, 43.823852564430069 ]; var map = new ol.Map({ layers: [ new ol.layer.Image({ extent: bounds, source: new ol.source.ImageMapGuide({ projection: 'EPSG:4326', url: agentUrl, useOverlay: false, metersPerUnit: 111319.4908, //value returned from mapguide params: { MAPDEFINITION: mdf, FORMAT: 'PNG' }, ratio: 2 }) }) ], target: 'map', view: new ol.View({ center: [-87.7302542509315, 43.744459064634], projection: 'EPSG:4326', zoom: 12 }) }); <div id="map" class="map"></div>

    <!DOCTYPE html>
    <html>
      <head>
        <title>MapGuide Untiled</title>
        <link rel="stylesheet" href="https://openlayers.org/en/v4.0.1/css/ol.css" type="text/css">
        <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
        <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
        <script src="https://openlayers.org/en/v4.0.1/build/ol.js"></script>
      </head>
      <body>
        <div id="map" class="map"></div>
        <script>
          var mdf = 'Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition';
          var agentUrl =
              'http://data.mapguide.com/mapguide/mapagent/mapagent.fcgi?USERNAME=Anonymous';
          var bounds = [
            -87.865114442365922,
            43.665065564837931,
            -87.595394059497067,
            43.823852564430069
          ];
          var map = new ol.Map({
            layers: [
              new ol.layer.Image({
                extent: bounds,
                source: new ol.source.ImageMapGuide({
                  projection: 'EPSG:4326',
                  url: agentUrl,
                  useOverlay: false,
                  metersPerUnit: 111319.4908, //value returned from mapguide
                  params: {
                    MAPDEFINITION: mdf,
                    FORMAT: 'PNG'
                  },
                  ratio: 2
                })
              })
            ],
            target: 'map',
            view: new ol.View({
              center: [-87.7302542509315, 43.744459064634],
              projection: 'EPSG:4326',
              zoom: 12
            })
          });
        </script>
      </body>
    </html>