Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Difference in label display between 0.7.* & 1.0 beta #141

Open
DaveF63 opened this issue Dec 19, 2015 · 1 comment
Open

Difference in label display between 0.7.* & 1.0 beta #141

DaveF63 opened this issue Dec 19, 2015 · 1 comment

Comments

@DaveF63
Copy link

DaveF63 commented Dec 19, 2015

Hi
I'm still learning the ropes of Javascript/Leafle/Label, so I'm unsure if this is problem or I'm doing something wrong. I'm loading a GeoJson file (available from here if you wish to run the code: https://github.com/martinjc/UK-GeoJSON/blob/master/json/electoral/eng/wards_by_lad/E06000022.json (Sorry, github wouldn't let me upload it as a zip)

<!DOCTYPE html>
<html>
  <head>
    <title>Wards Label</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
    <!-- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" /> -->
    <!-- <link rel="stylesheet" href="1_0/leaflet.label.css"/> -->
    <link rel="stylesheet" href="http://leaflet.github.io/Leaflet.label/leaflet.label.css" />    
        <style>
            body {padding: 0;margin: 0}
            html, body, #map {height: 100%;width: 100%}
        </style>        
  </head>
  <body>
    <div id="map"></div>
    <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
    <!-- <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script> -->
    <!-- <script src="1_0/leaflet.label-src.js"></script> -->
    <script src="http://leaflet.github.io/Leaflet.label/leaflet.label.js"></script>

    <script src="BANESWards2.geojson"></script> 

    <script>
      var osmMap = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')
      var map = L.map('map', {layers: [osmMap]});
      map.setView([51.35,-2.47], 12);

      function onEachFeatureBath(feature, layer) {
        WardName = feature.properties.WD13NM
        layer.bindLabel(feature.properties.WD13NM)
      }

      L.geoJson(BANESWards2, {
        onEachFeature: onEachFeatureBath
      }).addTo(map);
    </script>
  </body>
</html>

The leaflet label css/js files I downloaded were from here: https://github.com/Leaflet/Leaflet.label/tree/leaflet-master/dist. Are these the correct ones for running 1.0?

Using 0.7.* references, labels appear like this:
leaflet 0_73
Using 1.0.* references, labels appear like this:
leaflet 1_ 0

The problem appears to be in the css file, but beyond that, I'm lost. Any ideas?


To help me understand more, could it be explained why in this example https://github.com/Leaflet/Leaflet.label/blob/leaflet-master/example/label.html there's a long list Label .js files instead of a ref to Leaflet.Label.js?

Thanks
Dave F>

@zavan
Copy link

zavan commented Jan 6, 2016

There seems to be a problem with the z-index.

Put

.leaflet-label { z-index: 400; }

Increase the number as needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants