MapGuide与Google Maps集成(Integrate Google Maps into MapGuide Enterprise Fusion viewer)

简介:


As you know, Google Maps is more and more popular around the world. Is it possible to integrate Google Maps into my MapGuide Enterprise Fusion viewer as base map? Yes, it is!

As MapGuide Fusion viewer uses a subset of OpenLayers, it allows us to access to the underlying OpenLayers API. In this article, we will show you how to integrate Google Maps into our existing Fusion Viewer template. Of cause, you can do that similarly to integrate Yahoo Maps or Virtual Earth Maps as well.

 

Firstly, we need to make a copy of our existing Fusion template, such as Slate.

Copy and rename C:\Program Files\Autodesk\MapGuideEnterprise2010\WebServerExtensions\www\fusion\templates\mapguide\slate as GoogleSlate at the same fold with slate.

And copy and rename C:\Program Files\Autodesk\MapGuideEnterprise2010\WebServerExtensions\www\fusion\templates\mapguide\slate.xml as GoogleSlate.xml at the same folder with slate.xml (Please note that the filename of xml should be same with the template folder).

 

Secondly, we will make some changes in the GoogleSlate.xml. Open it in notepad or any other text editor you like, change the lines like this:

Code

 

Now, we need to add Google Maps in to this new template. To do that, we need to apply a Google Map API key. The Google Maps API lets you embed Google Maps in your own web pages with JavaScript. A single Maps API key is valid for a single "directory" or domain. You must have a Google Account to get a Maps API key, and your API key will be connected to your Google Account. You can refer to http://code.google.com/apis/maps/ for more information. When you are done with that, you will get a JavaScript library like this:

< script src = ' http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg ' ></ script >  

 

Let's open the index.html in GoogleSlate folder using notepad, add the Google Maps API library before the fusion script library.

Code

We need to register a MAP_LOADED event for the map when fusion is initialized:

Code

Create the Map_LOADED event handler to the add Google Maps as base map:

Code

If you changed the preview.pgn and refresh in MapGuide Studio, you will find a new Fusion template(GoogleSlate) available now. If Studio is already running, the list of available templates can be refreshed by right-clicking in the display of templates, and selecting "Refresh".

 

OK, we are almost there. You can put a map into this new template and try. But before that, there is still a one more thing we should pay attention to. As the Google Maps use EPSG:3785 (Popular Visualisation CRS / Mercator) coordinate system, in order to make your map match with Google Maps perfectly, you should use EPSG:3785 in your map as well. You can change the WKT of coordinate system by editing the XML of MapDefiniation. The OpenSource tool Meastro can do that conveniently.

 

 

You can change the value of <CoordinateSystem> as below:

Code

 

Now, select the new template and set the map, and review, you should see the Google Maps is integrated into your map allocation as base map. Is it cool? Try it now J

 

作者: 峻祁连
邮箱:junqilian@163.com 
出处: http://junqilian.cnblogs.com 
转载请保留此信息。



本文转自峻祁连. Moving to Cloud/Mobile博客园博客,原文链接:http://www.cnblogs.com/junqilian/archive/2009/09/10/1554469.html ,如需转载请自行联系原作者
目录
打赏
0
0
0
0
23
分享
相关文章
Java服务端集成Google FCM推送的注意事项和实际经验
本文分享了作者在公司APP海外发布过程中,选择Google FCM进行消息推送的集成经验。文章详细解析了Java集成FCM推送的多种实现方式,包括HTTP请求和SDK集成,并指出了通知栏消息和透传消息的区别与应用场景。同时,作者还探讨了Firebase项目的创建、配置和服务端集成的注意事项,帮助读者解决文档混乱和选择困难的问题。
252 1
Java服务端集成Google FCM推送的注意事项和实际经验
公司的app要上海外,涉及到推送功能,经过综合考虑,选择Google FCM进行消息推送。 查看一些集成博客和官方文档,看的似懂非懂,迷迷惑惑。本篇文章除了将我实际集成的经验分享出来,也会对看到的博客及其中产生的疑惑、注意事项一一评论。 从官方文档和众多博客中,你会发现Java集成FCM推送有多种实现方式,会让生产生文档很乱,不知作何选择的困惑。
146 0
谷歌地图接口Google Maps APIs中地图样式设计配置调整与JSON或URL导出
谷歌地图接口Google Maps APIs中地图样式设计配置调整与JSON或URL导出
184 1
SpringBoot【集成Thumbnailator】Google开源图片工具缩放+区域裁剪+水印+旋转+保持比例等(保姆级教程含源代码)
SpringBoot【集成Thumbnailator】Google开源图片工具缩放+区域裁剪+水印+旋转+保持比例等(保姆级教程含源代码)
397 0
Google Maps APIs地图样式的设计与导出方法
本文介绍在谷歌地图API(Google Maps APIs)中,设计地图样式并将设计好的样式通过JSON或URL导出的方法~
326 1
Google Maps APIs地图样式的设计与导出方法
最佳网络地图服务对比分析:Google Maps 与 OpenStreetMap
最佳网络地图服务对比分析:Google Maps 与 OpenStreetMap
604 0
最佳网络地图服务对比分析:Google Maps 与 OpenStreetMap
Google Guava之Maps&Lists&Sets
日常开发中,使用最多的就是集合了,所以避免不了对集合的各种操作,本篇文章来看一下,Guava中都有哪些常用的集合操作的API可以简化我们的代码。
269 0
Google Guava之Maps&Lists&Sets
EMQX Enterprise 4.4.11 发布:CRL/OCSP Stapling、Google Cloud Pub/Sub 集成、预定义 API 密钥
EMQX Enterprise最新的4.4.11版本发布了CRL(证书吊销列表)与OCSP Stapling为客户端提供更灵活的安全防护,新增Google Cloud Pub/Sub集成帮助用户通过Google Cloud各类服务发掘更多物联网数据价值。
EMQ
168 0
EMQX Enterprise 4.4.11 发布:CRL/OCSP Stapling、Google Cloud Pub/Sub 集成、预定义 API 密钥
Planet比Google earth更好用的地图下载神器Basemaps Viewer不用写代码全球高清影像框选下载tif格式
Planet比Google earth更好用的地图下载神器Basemaps Viewer不用写代码全球高清影像框选下载tif格式
707 0
Google Earth Engine(GEE)——Qgis-earthengine使用 Python API 集成 Google Earth Engine 和 QGIS
Google Earth Engine(GEE)——Qgis-earthengine使用 Python API 集成 Google Earth Engine 和 QGIS
583 0
Google Earth Engine(GEE)——Qgis-earthengine使用 Python API 集成 Google Earth Engine 和 QGIS

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等