Bing 使用 openlayers 的带有搜索控件和当前位置的地图

Bing map with search control and current location using openlayers

我们可以使用 bing 带有搜索控件的地图(搜索位置 - 如伦敦)和使用 openlayers 的当前位置。我们用于添加标记的 openlayer。

Openlayers 3 有一个名为 Geocoder 的扩展,感谢开发它的 Jonatas Walker,这是他制作的 jsFiddle,(我刚刚分叉)您可以通过 osm、photon 或如果您有 google 地理编码 api.

的密钥
//Instantiate with some options and add the Control
  var geocoder = new Geocoder('nominatim', {
    provider: 'osm',
    lang: 'en',
    placeholder: 'Search for ...',
    limit: 5,
    keepOpen: true
  });
  map.addControl(geocoder);

现在对于当前位置,您可以使用地理定位 example 它允许您根据网络位置获取您的位置,或者如果您在 cordova 移动设备中使用它,您可以获得精确的网络+gps 位置