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

KML Style Color should to be inverted for CSS (bbggrr to rrggbb) #56

Closed
marcimat opened this issue Jan 27, 2013 · 8 comments
Closed

KML Style Color should to be inverted for CSS (bbggrr to rrggbb) #56

marcimat opened this issue Jan 27, 2013 · 8 comments

Comments

@marcimat
Copy link

On vector/KML.js (

options.color = "#" + value.substring(2, 8);
) you extract color from color tag by value.substring(2, 8) but as says this KML documentation https://developers.google.com/kml/documentation/kmlreference#style , this tag is an « hexBinary value: aabbggrr », not, so rrggbb as in CSS.

I think that this line should be :

options.color = "#" + value.substring(6, 8) + value.substring(4, 6) + value.substring(2, 4);
@brunob
Copy link
Collaborator

brunob commented Feb 25, 2013

👍 for this :)

@hdmann
Copy link

hdmann commented Mar 10, 2013

Either way mine is still using the default blue for lines.

@brunob
Copy link
Collaborator

brunob commented Sep 18, 2013

Et hop, 7537796. Merci @marcimat :)

@brunob brunob closed this as completed Sep 18, 2013
@nickponline
Copy link

Mine just uses the default blue no matter what ..

@brunob
Copy link
Collaborator

brunob commented Sep 20, 2013

Can you provide a jsfiddle or a demo online showing your bug please @nickponline ?

@nickponline
Copy link

Just the kml example from this repository using this KML file will show the problem:

https://www.dropbox.com/s/jo2s36yh7j6899d/example.kml

In Google Earth it shows with correct colours whereas with leaflet-plugins it shows in blue.

@brunob
Copy link
Collaborator

brunob commented Sep 23, 2013

Here is a screenshot of what i see with the demo files, as you can see colors are there.

kml

@nickponline
Copy link

Here is an example. The code below produces a blue path, but in GoogleEarth it's coloured.

<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="../layer/vector/KML.js"></script>
</head>
<body>

<div style="width:100%; height:100%" id="map"></div>
<script type='text/javascript'>
var map = new L.Map('map', {center: new L.LatLng(38.145263,-122.856537), zoom: 11});
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
var track = new L.KML("https://s3.amazonaws.com/drone_logs/still-sun-659.kml", {async: true});
map.addLayer(track);
map.addLayer(osm);
map.addControl(new L.Control.Layers({}, {'Track':track}));
</script>

google_earth
leaflet_plugin

coomsie pushed a commit to coomsie/leaflet-plugins that referenced this issue Nov 28, 2013
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

4 participants