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
Create GEOSwiftCoreGraphics Add-On Library #129
Comments
Check out Polygon's draw function in https://github.com/GEOSwift/GEOSwift/blob/master/GEOSwift/QuickLook.swift#L111 for an example. Given a MKMapRect, it renders the shape into a graphics context. While you probably won't want to use this function itself, you should be able to adapt the code to your use case. |
Thank you for your reply. However I'm not really sure how I go from having a Geometry object to having a Polygon object? Could you maybe show a code-example? I can see that I can reach the "debugQuickLookObject" by writing geometry.debugQuickLookObject(), but the Polygon object I get from this object is a MKPolygon. So some assistance would be greatly appreciated :) |
This question would be more appropriate on Stack Overflow, where you could get help from more people that just the ones watching the issues in this repo.
Analogous to the implementation of `debugQuickLookObject`, you can create your own function that outputs a data structure that you can use to draw the polygon.
… On 11 Dec 2018, at 1:43 pm, siltrifork ***@***.***> wrote:
Thank you for your reply. However I'm not really sure how I go from having a Geometry object to having a Polygon object? Could you maybe show a code-example?
I can see that I can reach the "debugQuickLookObject" by writing geometry.debugQuickLookObject(), but the Polygon object I get from this object is a MKPolygon.
So some assistance would be greatly appreciated :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I already asked on Stack Overflow (https://stackoverflow.com/questions/53613266/swift-convert-mkpolygon-to-uibeizerpath-and-draw-path-on-uiview). The questions is with a bit different approach than asked here, but I thought it would be more likely to get an answer from you guys than the Stack Overflow community. Anyway I will try and see if I can make magic happen. |
@siltrifork I have the exact same use case, want to render a complete world map directly from GeoJSON -- did you manage to find some easy way to do so? |
I’ll mark this as a feature request. Perhaps we can add something to make this easier in the future. Sent with GitHawk |
@alexcurylo - No unfortunately not. I still use MapKit, but I ended up with a solution where I render every tile on the map with an overlay so the entire map becomes blank. Then I draw the polygons with mapkit and kind of get the result I wanted. So I'm happy that this has become a feature request, so we can work smarter in the future 👍 |
It actually turned out not too hard to parse GeoJSON into reasonable looking UIBezierPaths, at least with my particular file; take a look at WorldMap.swift here if you like, I imagine it'd be more performant than MapKit rendering... |
I'd love to see this functionality provided in an add-on library in the GEOSwift family. Maybe something like GEOSwiftCoreGraphics? |
Hi,
I would like to draw my Polygons directly on an UIView. I don't have the need for an underlying map since the geojson file I'm parsing is basically represeting paths for drawing a polygon for every single country in the world. So the end result would be a world map drawn with polygons.
The reason why I don't want an underlying map:
I use below methods to parse the geojson file and get geometries from it:
So I hope you have a solution for this :)
The text was updated successfully, but these errors were encountered: