-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
derive x & y scale domains from geometry #1468
Conversation
07be0c6
to
d71e888
Compare
This makes it much easier to just pass in a GeoJSON file. No more quarter-Earth! |
d71e888
to
0dea987
Compare
follow-up in #1663 |
0dea987
to
a6d4533
Compare
* fix pending issues and add tests * optimize and comment * move hasProjection --------- Co-authored-by: Mike Bostock <[email protected]>
This looks good to me. What do you think @Fil? |
🎉 We should now be able to throw any valid GeoJSON file at Plot.geo(…).plot(), and have something show up on the screen—independently of the file’s coordinate reference system (CRS). Plus, the x and y axes will show the extent of the coordinates, which will help evaluate if the file is “unprojected” or “projected”, and even maybe (with a bit of practice) which CRS is more likely. |
* derive x & y scale domains from geometry * follow-up: derive x & y scale domains from geometry (#1663) * fix pending issues and add tests * optimize and comment * move hasProjection --------- Co-authored-by: Mike Bostock <[email protected]> --------- Co-authored-by: Philippe Rivière <[email protected]>
* derive x & y scale domains from geometry * follow-up: derive x & y scale domains from geometry (observablehq#1663) * fix pending issues and add tests * optimize and comment * move hasProjection --------- Co-authored-by: Mike Bostock <[email protected]> --------- Co-authored-by: Philippe Rivière <[email protected]>
While writing the documentation for the geo mark, I was thinking about how we can use the geo mark independent of a projection. It bothered me that you can use the geo mark in conjunction with predefined scales, or scales derived from other marks, but that the geo mark itself could not assist in the automatic definition of the scales like other marks.
So now it does. The geometry channel now produces derived x and y channels that can be used to initialize the x and y scales, just like normal marks. Which means you can now say
and it behaves almost identical to
This is still a draft because I think we should skip constructing the derived x and y channels in a couple cases:
This changes the behavior of one of the tests, but I think it makes sense, and you can still get the old behavior by setting the projection to identity if you want it.
Fixes #1507.