Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for Google Maps #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Formatc1
Copy link

@Formatc1 Formatc1 commented Aug 5, 2015

It's required following Plugin for Leaflet:
https://github.com/shramov/leaflet-plugins/blob/master/layer/tile/Google.js

In settings.py shows up new additional options:
'TILES': [('Google Roadmap', 'GOOGLE-ROADMAP', {'attribution': '© Google'}),
('Google Terrain', 'GOOGLE-TERRAIN', {'attribution': '© Google'}),
('Google Satellite', 'GOOGLE-SATELLITE', {'attribution': '© Google'})]

And it's possible to use maps from Google like other Leaflet Tiles Maps.

More info about this plugin on author's page:
https://github.com/shramov/leaflet-plugins

It's required following Plugin for Leaflet:
https://github.com/shramov/leaflet-plugins/blob/master/layer/tile/Google.js

In settings.py shows up new additional options:
'TILES': [('Google Roadmap', 'GOOGLE-ROADMAP', {'attribution': '© Google'}),
          ('Google Terrain', 'GOOGLE-TERRAIN', {'attribution': '© Google'}),
          ('Google Satellite', 'GOOGLE-SATELLITE', {'attribution': '© Google'})]

And it's possible to use maps from Google like other Leaflet Tiles Maps.

More info about this plugin on author's page:
https://github.com/shramov/leaflet-plugins
@leplatrem
Copy link
Collaborator

Thanks for this contribution !

As you can see from the delay in responding you, this library is not receiving as much love and care as it deserves :)

I would prefer to let the guyz at Makina Corpus merge the pull requests. But meanwhile, I'll give a small code review !
Thanks again for taking the time to improve django-leaflet !


We would welcome any help for maintaining this library. If you use it and find it useful, please Watch it on Github, help us review contributions or comment issues :) Thousand thanks in advance.

@@ -116,6 +116,11 @@ L.Map.DjangoMap = L.Map.extend({
minZoom: this.options.minZoom,
maxZoom: this.options.maxZoom
});
// Google maps Plugin
if (layer.url.substr(0,6) == 'GOOGLE') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit fragile.
I would rather test with a regular expression : if (/^GOOGLE/.test(layer.url)) {

@dyve
Copy link
Contributor

dyve commented Sep 7, 2015

If we are going to have multiple layer types, we'd need the default Leaflet WMS layer as well.

@kosmos342
Copy link

About google layer and tile layer:

'TILES': [
    ('Google Roadmap', ('Google', 'ROADMAP'), {'attribution': '© Google'}),
    (_('OSM'), ('TileLayer', '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'), {'attribution': ''© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}),
]

in l2d function add check for typeof l[1] === 'string' for adding backward compatibility, add returning layerClass and arg. Then you can create layer by new L[layer.layerClass](layer.arg, layer.options)

@Gagaro Gagaro force-pushed the master branch 17 times, most recently from 96ea661 to 854ac59 Compare November 30, 2020 11:08
@Gagaro Gagaro force-pushed the master branch 2 times, most recently from f6487c7 to 0376c15 Compare May 17, 2021 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants