Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

343
Vistas
Folleto: más íconos diferentes en el mapa

Actualmente estoy usando esta biblioteca para mi proyecto.

https://github.com/codersgyan/leaflet-store-locator

Quiero agregar diferentes íconos para categorías, como aquí mapas de categorías

Lo agregué a JSON, pero no puedo mostrar el ícono

 { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ xxxxx, xxxxxx] }, "properties": { "name": "xxx", "city": "xxx", "address": "xxx", "icon": { "iconUrl": "https icon url", "iconSize": [55, 55], "iconAnchor": [50, 50], "popupAnchor": [-15, -50], "className": "dot" } } },
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Hay un lugar en este código que debe cambiarse: prospecto-tienda-ubicador

 var myIcon = L.icon({ iconUrl: 'marker.png', iconSize: [30, 40] }); const shopsLayer = L.geoJSON(storeList, { onEachFeature: onEachFeature, pointToLayer: function(feature, latlng) { return L.marker(latlng, { icon: myIcon }); } });

En lugar de un marcador establecido globalmente, debe agregarlo a la función pointToLayer.

 const shopsLayer = L.geoJSON(storeList, { onEachFeature: onEachFeature, pointToLayer: function(feature, latlng) { // check what you have exactly in the 'feature' // console.log(feature); var myIcon = L.icon({ // I'm not sure of the path, that's why it's above console.log(feature); iconUrl: feature.properties.icon.iconUrl, iconSize: feature.properties.icon.iconSize, // and here is the rest of the icon configuration }); return L.marker(latlng, { icon: myIcon }); } });
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda