Santosh Patel
Santosh Patel

Reputation: 1189

Does Leafletjs Map works on china?

Google Maps are blocked in china. So, we are looking for alternate solutions that have similar features like Google map. I found leafletjs for Map. but want to make sure that it works in china.

Upvotes: 3

Views: 1684

Answers (2)

Phil Glen
Phil Glen

Reputation: 24

Yes, you can use many different maps with Leafletjs. I use Open Street maps in my app.

https://www.openstreetmap.org

You can specify open street as your base map:

var openStreet = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
    {
        maxZoom: 18,
        subdomains: ['a', 'b', 'c'],
        attribution: 'Map data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
    });

You can add to leaflet with:

openStreet.addTo(map);

Upvotes: 0

Svinjica
Svinjica

Reputation: 2519

It should work. Leaflet as library should work without any restrictions I believe that tile maps should be the problem. Lucky, you have an extension to Leaflet that contains configurations for various Chinese tile providers.

But more about that on this site.

Hope it helps

Upvotes: 4

Related Questions