Stophface Stophface - 6 months ago 20
HTML Question

Make SVG transparent with d3 on leaflet

I am following Mike Bostock's tutorial on how to display a

(geo)json
on a
leaflet map
through
d3
.

It works - sort of.
When I try to display this file here (the geoJSON "US States") I get a black block on my map isntead of the outlines of the states.screenshot

Any ideas why?

Answer

You may have an issue with you stylesheet.

The source code of your tutorial has the following :

<style>
path {
  fill: #000;
  fill-opacity: .2;
  stroke: #fff;
  stroke-width: 1.5px;
}

path:hover {
  fill: brown;
  fill-opacity: .7;
}
</style>

You should play with the fill and fill-opacity properties to match your needs.

Comments