= !MapGuide RFC 4 - KML Support = This page contains an change request (RFC) for the !MapGuide Open Source project. More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date||unknown|| ||Last Modified||jasonbirch [[Timestamp]]|| ||Author||Chris Claydon|| ||RFC Status||(as designed)|| ||Implementation Status||completed|| ||Proposed Milestone||1.1|| ||Assigned PSC guide(s)||n/a|| ||'''Voting History'''||n/a|| == Overview == Google Earth allows external data to be overlaid upon its own vast collection of satellite imagery and vector graphics. It does this by supporting KML - an XML-based format that can be used to define how external vector and raster data may be dynamically loaded and displayed within the Google Earth application. == Motivation == By integrating !MapGuide with Google Earth, we provide a compelling way for users to visualize their data in relation to the planet as a whole. In addition to satellite imagery, Google provides a large amount of useful content, such as road networks, points of interest, voting districts etc. By serving up !MapGuide data via KML (and its compressed form, KMZ) we allow users to incorporate their specific data set with Google's. So, for example, if a !MapGuide data set contained information about underground pipes and sewers, this information could be overlaid on a satellite image showing individual streets and houses. This would greatly facilitate the process of estimating exactly which homes and streets would be affected by any maintenance required on those pipes. == Proposed Solution == A new service will be added to !MapGuide that supports three request types - !GetMapKml, !GetLayerKml and !GetFeaturesKml. '''!GetMapKml''' is designed to be the single point of user-initiated contact with the server. It takes the following parameters: OPERATION = !GetMapKml VERSION = 1 MAPDEFINITION = DPI = (defaults to 96) FORMAT = KML, KMZ or XML This request can be made from a URL link in a web page. It generates a KML document representing the requested map definition. This document contains one !NetworkLink element for each layer in the map. Google Earth uses these elements to make !GetLayerKml requests back to !MapGuide to retrieve further dynamic data for each layer. If the format is KMZ, the KML document is compressed inside a zip file before being returned in the response. The mime types returned for KML and KMZ responses cause Google Earth to start up automatically and display the content of the document. If the requested format is XML, the mime type returned is text/xml, and the text of the KML document is typically displayed directly in the browser window. '''!GetLayerKml''' is designed to be called only by Google Earth. Its format may change in order to accomodate future enhancements to our KML support. It is therefore not recommended to call this operation directly. It supports the following parameters: OPERATION = !GetLayerKml VERSION = 1 LAYERDEFINITION = DPI = (defaults to 96) FORMAT = KML, KMZ or XML BBOX = the current map extent in WGS84 lat/lon coordinates WIDTH = the current map width in pixels HEIGHT = the current map height in pixels The KML generated by the !GetMapKml request populates the first 5 of these parameters, and the link is formatted in such a way that Google Earth provides the BBOX, WIDTH and HEIGHT parameters corresponding to its current view. !GetLayerKml returns a KML document containing a element corresponding to each scale range supported by the layer that is currently visible. elements are used to instruct Google Earth only to request data via these links when the current scale falls within the scale range and when the current map extent intersects the extent of the data. '''!GetFeaturesKml''' is designed to be called only by Google Earth. Its format may change in order to accomodate future enhancements to our KML support. It is therefore not recommended to call this operation directly. It supports the following parameters: OPERATION = !GetFeaturesKml VERSION = 1 LAYERDEFINITION = DPI = (defaults to 96) FORMAT = KML, KMZ or XML BBOX = the current map extent in WGS84 lat/lon coordinates WIDTH = the current map width in pixels HEIGHT = the current map height in pixels !GetFeaturesKml returns the actual content to be rendered on the map. For feature layers, a KML document is returned that contains the features represented in vector format, plus style information such as the color, line width etc. For raster layers, the raster image is returned in PNG format. Drawing layers (from DWF files) will not be supported (yet). Here is an example of a sample request that will bring up Google Earth on the Sheboygan sample map: http://callt72-le:8008/mapguide/mapagent/mapagent.fcgi?OPERATION=GetMapKml&VERSION=1.0.0&MAPDEFINITION=Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition&FORMAT=KML&LOCALE=en == Implications == n/a == Test Plan == n/a == Funding/Resources == Resources supplied by Autodesk.