移动设备的开放层



一个新手问题:在使用openlayers的移动web开发中,我需要在header中包含哪个库文件?它是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;然而,如果我不包括openlayers.js,而是把openlayer. js。移动,然后是"Openlayers.layer"。"Google"将无法识别。

谢谢你的回复!

默认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)。

相关内容

  • 没有找到相关文章

最新更新