[mapguide-users] Zoom to selected feature with Fusion MGOS 2.1 Beta

Mike Adair madair at dmsolutions.ca
Fri Jul 10 15:19:43 EDT 2009


That's what I was gong to suggest, but you can also set your initial map 
extents in the ApplicationDefinition file like so:

    <MapGroup id="gmapLL" xsi:type="MapType">
      <Map xsi:type="MapLayerType">
        <Type>MapServer</Type>
        <SingleTile>true</SingleTile>
        <Extension>
          <MapFile>/ms4w/apps/gmap/htdocs/gmapLonLat.map</MapFile>
          <LayerMetadata>wms_metadataurl_href</LayerMetadata>
        </Extension>
      </Map>
      <InitialView>
        <MinX>-71.8</MinX>
        <MinY>40.5</MinY>
        <MaxX>-42</MaxX>
        <MaxY>63.5</MaxY>
      </InitialView>
    </MapGroup>


Mike

GreenMapSanMiguel wrote:
> An update - I am working around this problem by defining the map extents to
> include all features then zooming to my desired initial extent on mapLoaded:
>
> function mapLoaded()
> {
>     var mapWidget = Fusion.getMapById('Map');
>     var extent = mapWidget.getExtentFromPoint(-100.743812,20.914291,5000);
>     mapWidget.setExtents(extent);
> }
>
> This feel wrong to me, so please let me know if you have a better way.
>
> Thanks!
>
> Andy
>   

-- 
   Michael Adair
   Senior Software Architect
   DM Solutions Group Inc.

   Office: (613) 565-5056 x26
   madair at dmsolutions.ca
   http://www.dmsolutions.ca
   http://research.dmsolutions.ca




More information about the mapguide-users mailing list