Version 3 (modified by 15 years ago) ( diff ) | ,
---|
MapGuide RFC 72 - Commercial Map Service Support
This page contains an change request (RFC) for the MapGuide Open Source project. More MapGuide RFCs can be found on the RFCs page.
Status
RFC Template Version | (1.0) |
Submission Date | (Date/Time submitted) |
Last Modified | Arthur Liu Timestamp |
Author | Arthur Liu |
RFC Status | draft |
Implementation Status | under development |
Proposed Milestone | 2.2 |
Assigned PSC guide(s) | Tom Fukushima? |
Voting History | (vote date) |
+1 | |
+0 | |
-0 | |
-1 | |
no vote |
Overview
Commercial tiled map layers can be used as basemaps within MapGuide flexible layouts. Users can use MapGuide overlays with commercial map service layers(Google maps, Yahoo maps and Bing maps).
Motivation
Fusion provide a solution to integrate the commercial map services into the standard template:
- Add some script tags to index.html. These scripts indicate commercial mapping api providers and unique api keys supplied by these providers.
- Modify the application definition to include the commercial map service layers.
[Detailed Information] http://trac.osgeo.org/fusion/wiki/MapGuideCommercialOverlays
MapGuide templates should have the capability to support the commercial map services too. But it's not proper to add all the commercial api script tags into MapGuide templates by default. We need to provide a more convenient approach to add these scripts.
Proposed Solution
- Save the commercial mapping api scripts and keys in the extension part of application definition.
- MapGuide templates load the extension information from the application definition , and add the script tags into index.html on demand.
So users just need to provide an application definition with the extension, then they will obtain the commercial mapping services.
To load scripts from the application definition, MapGuide template file need to add a script like
<script type="text/javascript"> // Add script elemtent var addElement = function(element) { if (!element) { return; } var src = element.textContent; // For IE Browser if (!src) { src = element.text; } var e = document.createElement("script"); e.src = src; e.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(e); } // Get ApplicationDefinition var appDefUrl = Fusion.getQueryParam('ApplicationDefinition'); var xhr = new XMLHttpRequest(); xhr.open("GET", "http://127.0.0.1/mapguide2010/mapagent/mapagent.fcgi?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=" + appDefUrl + "&FORMAT=text%2Fxml", false); xhr.send(null); var appDefXML = xhr.responseXML.documentElement; // Get Google element var googleElement = appDefXML.getElementsByTagName("Google")[0]; addElement(googleElement); // Get Yahoo element var yahooElement = appDefXML.getElementsByTagName("Yahoo")[0]; addElement(yahooElement); // Get Virtual Earth element var veElement = appDefXML.getElementsByTagName("VirtualEarth")[0]; addElement(veElement); // If there's no commercial layers, then register the onload event immediately. (Lazy load if there's any commercial layers) if(!googleElement && !yahooElement && !veElement) { window.onload = init; } </script>
The original Window.onload event will be replaced by init function which will be called on demand.
Implications
Existed MapGuide templates(aqua, limegold, maroon, slate and turquoiseyellow) need to be updated to support load commercial api from application definition.
Test Plan
Test 5 MapGuide templates(aqua, limegold, maroon, slate and turquoiseyellow) to verify if they could support the commercial map services.
Funding/Resources
Supplied by Autodesk.