MyGit

mapgears/ol3-google-maps

Fork: 89 Star: 184 (更新于 2024-11-17 05:39:12)

license: NOASSERTION

Language: JavaScript .

OpenLayers - Google Maps integration

最后发布版本: v1.8.0 ( 2023-08-01 03:34:19)

GitHub网址

OL-Google-Maps

Build Status

OL-Google-Maps is deprecated

OpenLayers - Google Maps integration library, which is now deprecated.

The OpenLayers library now supports the possibility to use Google Maps as base maps from version v9.0.0+.

In the past, Google Maps did not provide an API to requests tiles directly. You had to use the Google Maps API for that. OLGM provided a way to indirectly use tiles from Google Maps by using its Maps API.

Now, Google have a Map Tiles API, which is what OpenLayers uses. Therefore, the use of the OLGM library is no longer recommended. You should upgrade to the latest version of OpenLayers.

Features

Synchronizes:

  • Layers (Google, Vector)
  • Vector features (style, geometry)

Getting started

For use with webpack, Rollup, Browserify, or other module bundlers, install the olgm package.

npm install olgm

You must also install the ol package.

To use OL-Google-Maps, first you need to load Google Maps API. It's important to load Google Maps API before OL-Google-Maps. You also need to use your own Google Maps API key.

<script
  type="text/javascript"
  src="https://maps.googleapis.com/maps/api/js?v=3&key=<YOUR_KEY>">
</script>

It is recommended to load the CSS file included in there as well.

<link rel="stylesheet" href="ol3gm.css" type="text/css" />

Then, in your existing OpenLayers application, activate OL3-Google-Maps. Here's a simple example:

import Map from 'ol/Map.js';
import GoogleLayer from 'olgm/layer/Google.js';
import {defaults} from 'olgm/interaction.js';
import OLGoogleMaps from 'olgm/OLGoogleMaps.js';
import View from 'ol/View';

var center = [-7908084, 6177492];

// This dummy layer tells Google Maps to switch to its default map type
const googleLayer = new GoogleLayer();

var map = new Map({
  // use OL3-Google-Maps recommended default interactions
  interactions: defaults(),
  layers: [
    googleLayer
  ],
  target: 'map',
  view: new View({
    center: center,
    zoom: 12
  })
});

var olGM = new OLGoogleMaps({map: map}); // map is the ol.Map instance
olGM.activate();

Live examples

See the following example for more detail on bundling OL3-Google-Maps with your application:

See OL3-Google-Maps in action (version v0.20.0):

See all other examples at: http://mapgears.github.io/ol3-google-maps/examples/

The End

OLGM no longer needs development as it is now deprecated. Upgrade to the latest version of OpenLayers instead.

Thanks to everyone who contributed during the lifespan of the library!

最近版本更新:(数据更新于 2024-10-20 06:46:49)

2023-08-01 03:34:19 v1.8.0

2021-07-02 22:22:30 v1.7.1

2020-09-17 19:38:44 v1.7.0

2020-01-18 20:40:02 v1.6.0

2019-09-15 20:39:25 v1.5.0

2019-09-01 20:31:19 v1.4.0

2019-08-24 20:23:58 v1.3.0

2019-04-04 22:31:59 v1.2.0

2019-02-20 21:41:08 v1.1.1

2019-01-03 21:08:57 v1.1.0

mapgears/ol3-google-maps同语言 JavaScript最近更新仓库

2024-11-21 23:03:24 bia-pain-bache/BPB-Worker-Panel

2024-11-21 22:46:48 MHSanaei/3x-ui

2024-11-21 07:00:59 nodejs/node

2024-11-21 00:49:46 FortAwesome/Font-Awesome

2024-11-18 14:26:02 projectdiscovery/nuclei-templates

2024-11-17 14:42:23 koodo-reader/koodo-reader