react-simple-maps icon indicating copy to clipboard operation
react-simple-maps copied to clipboard

Fit the map?

Open alinpetrusca opened this issue 5 years ago • 7 comments

Hello,

Is there a way to make the map fit the parent container ? I want it to be entirely visible on all screen resolutions, without manually panning & zooming.

I don't know how to center and zoom the map to do this. I tried to change this manually using:

  • scale and offsets on projectionConfig
  • scale on projectionConfig and center on ZoomableGroup But with no success, it only works for a specific screen size.

Thanks for your time :)

Topo json: france-topo.txt

alinpetrusca avatar Oct 04 '19 08:10 alinpetrusca

@Alin13 did you find a solution ?

edouarobin avatar Dec 20 '19 01:12 edouarobin

@edouarobin No I didn't. I just used a simple SVG map, without using this library.

alinpetrusca avatar Dec 20 '19 08:12 alinpetrusca

@Alin13 If you are interested, I found a projection config that perfectly fit the france-topo map. Here is my ComposableMap component:

<ComposableMap
   projection="geoAzimuthalEqualArea"
   projectionConfig={{
        rotate: [-4.0, -46.2, 0],
        scale: 3400
    }}
   style={{
        maxHeight: "500"
   }}
>
       <Geographies geography={geoUrl}>
               // bla bla bla
      </Geographies>
</ComposableMap>

edouarobin avatar Dec 21 '19 00:12 edouarobin

Hey @edouarobin I'm not using this library anymore. But thank you very much, it may help in the future! :)

alinpetrusca avatar Dec 28 '19 12:12 alinpetrusca

Hey. how can i filter the Australia content and put maker each coordinates.

stephenPolFajardo avatar May 20 '21 01:05 stephenPolFajardo

And this might be projection config for USA states in NA:

projectionConfig={{
        rotate: [97, -40, 0],
        scale: 1100,
      }}

david-vendel avatar May 30 '22 12:05 david-vendel

To centralize Canada using its topojson: https://gist.githubusercontent.com/Brideau/2391df60938462571ca9/raw/f5a1f3b47ff671eaf2fb7e7b798bacfc6962606a/canadaprovtopo.json

 <ComposableMap
      projection='geoMercator'
      projectionConfig={{
        rotate: [105, -65, 0],
        scale: 800,
        center: [8, 0],
      }}
      style={{
        width: '800',
      }}
    >

gsscruz avatar May 26 '23 18:05 gsscruz