-
Notifications
You must be signed in to change notification settings - Fork 602
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
Radius Drawing Tool #767
Comments
Chris, This is a sweet custom mode. I saw the medium post go around twitter a few weeks back and was hoping I'd hear about a open source version of it. So, thanks for the issue! :) Currently draw's built in modes only support strict GeoJSON spec features so we're not ready to add it at this time. That said, I think this is a great custom mode and would love to see it packaged into its own module and listed on our custom mode pages. In the long run, I think we need to start answering how custom shapes and consider moving from GeoJSON for internal feature storage to raw vector tiles if that move could help provide support for circles.
Adding symbol layers to the map as part of your mode is a really interesting idea. I'd like to hear/read-the-code for how you did this well since I don't think draw currently supports this that well.
This would be a cool custom mode on its own. I could see an API that looks something whats below as being really helpful to people.
I suspect there is space in the custom mode world of draw for a few different modes here. One that adds points, one that adds polygons and, to the comment above, one that doesn't add anything. |
I've seen it implemented independently a number of times, it would be good to have this supported out of the box to reduce need for everyone re-implementing this. Probably should be a separate tool which peerDep on mapbox-gl-draw/a plugin to -draw rather than part of -draw core. |
Hi, is there any way that you can keep circle after you draw it? I mean when you finish drawing you end up with line .... |
I was able to use this code here: https://stackoverflow.com/questions/37599561/drawing-a-circle-with-the-radius-in-miles-meters-with-mapbox-gl-js/39006388#39006388 To add a circle control that creates a polygon with 64 points.. It is missing the "preview" mode like the 'custom draw mode for drawing a radius' has, and test coverage. @chriswhong Maybe we can merge our efforts? Here is are the code changes (sorry, my linter was overzealous..): doublenot@24020ac |
Happy to help if there is energy around a plugin. |
I've published an npm module called mapbox-gl-draw-circle which lets you draw and edit a circle. Please do take a look and feel free to reach out to me if you find any issues. |
Another plugin which supports drawing circles is my https://github.com/zakjan/mapbox-gl-draw-geodesic |
As @mcwhittemore mentioned, There are few situations where a mode to draw but not add features may be handy:
I created the mapbox-gl-draw-passing-mode to handle these situations. take a look, and I'll be happy to hear feedbacks. |
@iamanvesh I was really interested in your version but I cannot seem to implement this on a normal webpage with mapbox-gl. The code is specific to React? Or can it be easily converted to be used by a normal webpage? Please advise? Thanks! |
We've implemented a custom draw mode for drawing a radius, and are wondering if there is interest in a PR.
You can see it in action in NYC Population Factfinder, and read a blog post about it here.
Some things to consider:
Point
visualized using a mapboxGL circle layer, or a circle-like polygon.The text was updated successfully, but these errors were encountered: