question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

need help to figure out what's wrong with the map

See original GitHub issue

Hi,

so i have made a topojson it contains the counties of Hungary.

Tho, something is wrong, the map not getting rendered well. I have made a little repo for it, i’d appreciate if someone could point me to the right direction.

Thanks,

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
zilahircommented, May 4, 2020

Hi @zimrick ,

Thank you for your reply! And YES, this is exactly what I was missing, and now after reading your comment suddenly the documentation makes more sense also! 😃

Thank you!

1reaction
zimrickcommented, May 4, 2020

Hi @zilahir, This is related to how the center prop behaves in the projection config. The projection config object modifies the d3-geo projection under the hood, so the props in there should behave as they would in d3-geo. The center property on ZoomableGroup however lets you pinpoint the map to a specific location regardless of the projection rotation offset (it compensates for that under the hood).

Here’s how your config object modifies the underlying projection: https://codesandbox.io/s/map-config-rotation-and-center-l2nfd?file=/src/MapChart.js

I added all countries so you can see where you are on the world map. This configuration centers the map on western Kazakhstan.

So initially you use the rotate prop to rotate your projection, and then you modify the longitude by 19.5, and the latitude by 47.76 via the center prop. This means that your center gets moved to E49.5 (30 + 19.5) and N47.76. So you are adding these degrees, rather than setting the center of the map.

This is the default behaviour of d3-geo AFAIK and it will behave as expected if you are using a global map where the rotation is set to [0,0,0]. When you start moving the rotation, you have to compensate with the center accordingly. If you set your center to [-10.5, 47.76] you should be centered on Hungary (i.e. E19.5 N47.76).

Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find & improve your location's accuracy - Google Maps Help
Google Maps may have trouble finding your location. If the GPS location of your blue dot on the map is inaccurate or missing,...
Read more >
How to Report a Mapping Problem Affecting GPS Devices ...
Follow these instructions if you have a problem caused by a mapping error in most GPS devices/apps and online maps. For example:.
Read more >
Symptom Checker with Body from WebMD - Check Your ...
WebMD Symptom Checker is designed with a body map to help you understand what your medical symptoms could mean, and provide you with...
Read more >
Solving Map Problems - YouTube
Grade 7: Term 2.Natural Sciences.www.mindset.africawww.facebook.com/mindsetpoptv.
Read more >
Why all world maps are wrong - YouTube
Making accurate world maps is mathematically impossible.Follow Johnny on Instagram www.instagram.com/johnny.harris/ Help us make more ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found