Center a map in d3 given a geoJSON object

后端 未结 11 2213
慢半拍i
慢半拍i 2020-11-21 22:55

Currently in d3 if you have a geoJSON object that you are going to draw you have to scale it and translate it in order to get it to the size that one wants and translate it

11条回答
  •  一向
    一向 (楼主)
    2020-11-21 23:37

    There is a center() method you can use that accepts a lat/lon pair.

    From what I understand, translate() is only used for literally moving the pixels of the map. I am not sure how to determine what scale is.

提交回复
热议问题