Open rbent98 opened 4 years ago
Hi @rbent98, Currently, react-simple-maps does not handle these multilayered topojson/geojson files. You can do two things though:
Geographies
. You can use more than one <Geographies />
component in your map and load the files separately. This will give you geography "layers" in react-simple-maps. Export your layers as separate files and then reference each file separately:...
<Geographies geography={file1url}>
{({geographies}) => geographies.map(geo >
<Geography key={geo.rsmKey} geography={geo} />
)}
</Geographies>
<Geographies geography={file2url}>
{({geographies}) => geographies.map(geo >
<Geography key={geo.rsmKey} geography={geo} />
)}
</Geographies>
<Geographies geography={file3url}>
{({geographies}) => geographies.map(geo >
<Geography key={geo.rsmKey} geography={geo} />
)}
</Geographies>
...
Geographies
. That way you can still do the rendering with react-simple-maps, but you take care fo the file loading and topojson conversion yourself.
I used map shapper to convert many layers into a topoJSON file. I can see see the multiple layers in the mapshapper visual but when I import the geography into the simple-maps geography components only polygons of one of the layers show up and function as intended. When I read through the topoJSON file I can see that the information from the other layers are indeed there.