Use of Google Maps Library

Source: Internet
Author: User

Google Maps API is used in the company's projects, and marker is used for Google API development to label locations on Google Maps.

But Google marker also has a problem with the use of the process, that is, if the Google map to mark a large number of marker, one is easy to cause Google Maps load slow, the other is marker too much, the map is very

It's not nice, even if you can't see it, because you'll find the map is occupied by these marker.

In the Google Maps API, a cluster is provided to solve this problem, that is, Markerclusterer,

We used the library (provided by Google): https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/ Markerclusterer.js

Then the image tag URL on Google Maps is: https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m

In general, JS uses the following:

var mc = new Markerclusterer (map, markers, {

ImagePath: ' https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m '
});

However, in 12/05/2016, Google decommissioned the google-maps-utility-library-v3.googlecode.com source for this library. That said, Google stopped using the library on May 12 this year, and Google moved it to GitHub.

GitHub Address: Https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/src/markerclusterer.js

Https://github.com/googlemaps/js-marker-clusterer

Https://github.com/googlemaps/js-marker-clusterer/blob/gh-pages/src/markerclusterer.js

Picture address is Https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images

How do you use it in your development environment? Use the following steps:

1. Find your link on GitHub, and click to the "Raw" version of the file.

2. Copy the URL, and link to it

3. Change raw.githubusercontent.com to Rawgit.com (non-production) or cdn.rawgit.com (production)

So, in Markerclusterer.js, put the image address by https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images

Change to Https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/images

Use of Google Maps Library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.