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

How to use with leaflet-grayscale? #143

Closed
josdejong opened this issue Apr 18, 2016 · 4 comments
Closed

How to use with leaflet-grayscale? #143

josdejong opened this issue Apr 18, 2016 · 4 comments

Comments

@josdejong
Copy link

Thanks or writing react-leaflet, works like a charm!

I was trying to use leaflet-grayscale within react-leaflet, but I have no clue how to translate L.titleLayer.grayscale(url, options) to an equivalent React syntax.

var map = L.map('map').setView([25, -4], 3);
L.tileLayer.grayscale('http://tile.openstreetmap.org/{z}/{x}/{y}.png', {
  attribution: 'Map data &copy; <a href="http://openstreetmap.org/">OpenStreetMap</a> contributors',
  maxZoom: 14, minZoom: 2
}).addTo(map);

Any ideas?

@PaulLeCam
Copy link
Owner

Hi, please refer to the creating custom components section of the documentation.

@josdejong
Copy link
Author

Ok thanks, will fiddle around with it.

@stefangordon
Copy link

Hey @josdejong, saw your issue when I was looking for tips on how to do the same thing. I got a custom component working with leaflet-bing, might help you http://www.stefangordon.com/display-bing-tiles-in-react-leaflet/

@josdejong
Copy link
Author

Thanks @stefangordon, good to know.

I solved it by applying a simple css grayscale transform using a regular, colored tile set:

.leaflet-tile-pane {
  -webkit-filter: grayscale(100%);
  filter: grayscale(100%);
}

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

No branches or pull requests

3 participants