Actualmente estoy trabajando en la creación de un mapa web y tengo problemas para aplicar estilos con un archivo geojson de polígonos. Supongo que el problema está en la sección L.geoJSON(condados, {... porque cuando lo reemplazo con condados.addTo(mapa) se dibuja bien con la representación predeterminada. He estado probando diferentes cosas para mejorar del día y todavía no lo he hecho bien. ¿Alguna idea?
<html> <head> <title>Testing Web Mapping</title> <link rel="stylesheet" href="leaflet/leaflet.css" /> </head> <body> <script src="leaflet/leaflet.js"></script> <div id="map" style="width:700px; height: 850px"></div> <script> var map = L.map('map',{center:[44.4340101, -90.0139754], zoom:7}); varusgs = L.tileLayer.wms("http://basemap.nationalmap.gov/ArcGIS/services/USGSImageryOnly/MapServer/WMSServer", {layers:'0', format: 'image/png', transparent: true, attribution: "USGS"}).addTo(map); </script> <script src="leaflet/leaflet.ajax.min.js"></script> <script> var counties = new L.geoJSON.ajax('GIS/Counties_geojson.geojson'); var CountiesStyle = { "color": "#ffffff", "fillColor": "#ffffff", "weight": 1, "opacity": 1, "fillOpacity": 0 }; L.geoJSON(counties, { style: CountiesStyle }).addTo(map); counties.on('data:loaded', function(){map.fitBounds(counties.getBounds())}); </script> </body> </html>