Leaflet / Leaflet.VectorGrid

Display gridded vector data (sliced GeoJSON or protobuf vector tiles) in Leaflet 1.0.0
593 stars 192 forks source link

Add tooltip #197

Closed 2803media closed 5 years ago

2803media commented 5 years ago

Hi i wonder if it's possible to add permanent tooltip inside each polygons? I search but I can't find a way to do that. I need to display the polygon id for each polygon. Thanks for your help

IvanSanchez commented 5 years ago

Hi, great to hear that you find Leaflet useful!

However, this issue tracker is used for reporting bugs and discussing new features. For questions on using Leaflet, please use gis.stackexchange.com or stackoverflow.

If you are really sure that this is a bug in leaflet, or a feature request, please change the wording to make it look like a bug report.

2803media commented 5 years ago

This an issue related to vectorgrid and not leaflet so I guess this is the right place.

IvanSanchez commented 5 years ago

Nope.

2803media commented 5 years ago

@IvanSanchez I use vectorgrid to diplay my geojson and I want to add labels inside each polygon like the onEachFeature of leaflet by I can't find a way to do that. So for you it's not a feature offer by this plugin so I need to find another way to display those polygons and labels?


jQuery.ajax({
  type: "POST",
  url: '<?php bloginfo('stylesheet_directory'); ?>/datas/parcelles.json',
  dataType: 'json',
  success: function (response) {
    var geojsonLayer = response;
      vectorGrid = L.vectorGrid.slicer( geojsonLayer, {
        rendererFactory: L.canvas.tile,
        vectorTileLayerStyles: {
          sliced: {
          fillOpacity: 0.3,
          color: 'orange',
          weight: 1,
          stroke: true,
          fill: false,
          }
        },
        interactive: true,
        maxZoom: 19, // max zoom to preserve detail on
        tolerance: 20, // 5 simplification tolerance (higher means simpler)
        extent: 4096, //4096, // 4096 tile extent (both width and height)
        buffer: 64, // 64 default 64tile buffer on each side
        indexMaxZoom: 0, // 0 max zoom in the initial tile index
        indexMaxPoints: 100000, // 100000 max number of points per tile in the index
      }).addTo(map);

    layerControl.addOverlay(vectorGrid, "Parcelles");

    })
IvanSanchez commented 5 years ago

Pal, precalculate the centroid of the polygons and symbolize them centroids. But this is not a bug nor a feature request.

2803media commented 5 years ago

Thanks, Can I symbolize those centroid with text?

rajanski commented 2 years ago

Pal, precalculate the centroid of the polygons and symbolize them centroids. But this is not a bug nor a feature request.

this doesnt seem to be possible? how can i get the geometries from the tile layer?