移动设备的开放层

时间:2011-08-05 02:27:33

标签: google-maps mobile sencha-touch openlayers mashup

一个新手问题:在使用openlayers的移动Web开发中,我需要在头文件中包含哪个lib文件?我的意思是,是openlayers.js还是openlayers.mobile.js?

<script type="text/javascript" src="lib/OpenLayers.mobile.js"></script>

<script type="text/javascript" src="lib/OpenLayers.js"></script>

在练习中是否会有所不同?

我之所以这么说是因为我想用GoogleMaps开发mashup应用程序;但是,如果我不包含openlayers.js,而是放置openlayer.mobile,那么“Openlayers.layer.Google”将无法被识别。

感谢您的回复!

1 个答案:

答案 0 :(得分:7)

默认OpenLayers.mobile.js使用'mobile.cfg'配置文件构建,如下所示:

[first]

[last]

[include]
OpenLayers/Map.js
OpenLayers/Kinetic.js
OpenLayers/Projection.js
OpenLayers/Layer/SphericalMercator.js
OpenLayers/Layer/XYZ.js
OpenLayers/Layer/Bing.js
OpenLayers/Layer/WMS.js
OpenLayers/Format/WMSGetFeatureInfo.js
OpenLayers/Control/TouchNavigation.js
OpenLayers/Control/Geolocate.js
OpenLayers/Control/ZoomPanel.js
OpenLayers/Control/Attribution.js
OpenLayers/Control/SelectFeature.js
OpenLayers/Control/DrawFeature.js
OpenLayers/Control/ModifyFeature.js
OpenLayers/Control/WMSGetFeatureInfo.js
OpenLayers/Control/Panel.js
OpenLayers/Handler/Point.js
OpenLayers/Handler/Path.js
OpenLayers/Handler/Polygon.js
OpenLayers/Layer/Vector.js
OpenLayers/Layer/TileCache.js
OpenLayers/Renderer/SVG.js
OpenLayers/Renderer/Canvas.js
OpenLayers/Format/GeoJSON.js
OpenLayers/Format/KML.js
OpenLayers/Protocol/HTTP.js
OpenLayers/Protocol/WFS.js
OpenLayers/Protocol/WFS/v1_0_0.js
OpenLayers/Strategy/Fixed.js

[exclude]

正如您所看到的,其中没有OpenLayers.Layer.Google。这就是你收到错误的原因。 所以我建议你继续构建自己的OpenLayers版本,它只包含你需要的东西(例如,你可能想要删除OpenLayers.Layer.Bing)。

Here is a good guide你是怎么做到的。