Changes between Version 2 and Version 3 of MapGuideRfc72
- Timestamp:
- 07/30/09 02:46:07 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MapGuideRfc72
v2 v3 22 22 == Overview == 23 23 24 Commercial tiled map layers can be used as base layers within MapGuide flexible layouts. Users can use MapGuide overlays with commercial map service layers(Google maps, Yahoo maps and Virtual Earth).24 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). 25 25 26 26 == Motivation == 27 27 28 Fusion provide a solution to integrate the commercial map services into standard template: [[BR]]28 Fusion provide a solution to integrate the commercial map services into the standard template: [[BR]] 29 29 30 1. Add some script tags to index.html manually. These scripts indicate commercial mapping api providers and unique api keys supplied by these providers.[[BR]]30 1. Add some script tags to index.html. These scripts indicate commercial mapping api providers and unique api keys supplied by these providers.[[BR]] 31 31 32 32 2. Modify the application definition to include the commercial map service layers. [[BR]] 33 33 34 [Detailed Information] http://trac.osgeo.org/fusion/wiki/MapGuideCommercialOverlays 34 35 35 MapGuide templates should have the capability to support the commercial map services too , and we also need to provide a more convenient approach to addscripts.36 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. 36 37 37 38 == Proposed Solution == 38 39 39 1. Save the commercial mapping api providers and keys as extension inapplication definition.[[BR]]40 1. Save the commercial mapping api scripts and keys in the extension part of application definition.[[BR]] 40 41 41 42 2. MapGuide templates load the extension information from the application definition , and add the script tags into index.html on demand. [[BR]] 42 43 43 So users just need to provide an application definition with extension, then they will obtain the commercial mapping services. 44 So users just need to provide an application definition with the extension, then they will obtain the commercial mapping services. 45 46 To load scripts from the application definition, MapGuide template file need to add a script like 47 48 {{{ 49 <script type="text/javascript"> 50 // Add script elemtent 51 var addElement = function(element) { 52 if (!element) { 53 return; 54 } 55 var src = element.textContent; 56 57 // For IE Browser 58 if (!src) { 59 src = element.text; 60 } 61 62 var e = document.createElement("script"); 63 e.src = src; 64 e.type = "text/javascript"; 65 66 document.getElementsByTagName("head")[0].appendChild(e); 67 } 68 69 // Get ApplicationDefinition 70 var appDefUrl = Fusion.getQueryParam('ApplicationDefinition'); 71 var xhr = new XMLHttpRequest(); 72 73 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); 74 xhr.send(null); 75 var appDefXML = xhr.responseXML.documentElement; 76 77 // Get Google element 78 var googleElement = appDefXML.getElementsByTagName("Google")[0]; 79 addElement(googleElement); 80 81 // Get Yahoo element 82 var yahooElement = appDefXML.getElementsByTagName("Yahoo")[0]; 83 addElement(yahooElement); 84 85 // Get Virtual Earth element 86 var veElement = appDefXML.getElementsByTagName("VirtualEarth")[0]; 87 addElement(veElement); 88 89 // If there's no commercial layers, then register the onload event immediately. (Lazy load if there's any commercial layers) 90 if(!googleElement && !yahooElement && !veElement) { 91 window.onload = init; 92 } 93 </script> 94 }}} 95 96 The original Window.onload event will be replaced by init function which will be called on demand. 44 97 45 98 == Implications == 46 99 47 Just add a script tag into index.html of MapGuide templates, which used for loading extension information from application definition. [[BR]] 48 For those application definitions which do not have extenstion information, there's no additional burden. 100 Existed MapGuide templates(aqua, limegold, maroon, slate and turquoiseyellow) need to be updated to support load commercial api from application definition. 49 101 50 102 == Test Plan ==