You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
circle polygon looks less like a circle in newer Mapbox version on Android #13125
I am upgrading the Android Mapbox SDK from version 4.2.2 to 6.6.0.
In order to draw circles around a specific coordinate I'm calculating 180 perimeter points and drawing a polygon.
On version 4.2.2 the circle (with a radius of 10 meters) looks good:
Whereas in version 6.6.0 it looks like either less points were used or their positions are not accurate:
Here is the code I'm equally using in both versions:
changed the title [-]circle polygon looks less like a circle in newer Mapbox version[/-][+]circle polygon looks less like a circle in newer Mapbox version on Android[/+]on Oct 18, 2018
Hey @p-fischer , thanks for using Mapbox. You should use a CircleLayer.
Build a Feature object with the coordinates that you want to be the middle of the circle. Feature singleFeature = Feature.fromGeometry(Point.fromLngLat(LONG,LAT));. If you want multiple circles, do this for each long/lat pair.
Add that Feature to a List<Feature> (or all Feature objects to the same list).
Use that list to create a FeatureCollection.
Use that FeatureCollection to create a GeoJsonSource. Add the GeoJsonSource to the map.
Use that GeoJsonSource to create a CircleLayer.
Use data-driven styling to customize the look of the circle(layer).
Hi @langsmith
I know I'm quite late to the discussion. I haven't switched to the annotation API yet.
But I'm upgrading to the mapbox-android SDK version 7.2.0 and I saw that the "polygon drawing API" is marked as deprecated now.
My question for CircleLayer is: Does the API (or the plugin API) provide the possibility to set the radius in both "pixels" and "meters"?
My original example draws a circle based the latter (by calculating the LatLng coordinates).
Since my map is zoomable, I need define the circles' radiuses in both ways at different places. Is this possible?
Hey @p-fischer , thanks for using Mapbox. You should use a CircleLayer.
Build a Feature object with the coordinates that you want to be the middle of the circle. Feature singleFeature = Feature.fromGeometry(Point.fromLngLat(LONG,LAT));. If you want multiple circles, do this for each long/lat pair.
Add that Feature to a List<Feature> (or all Feature objects to the same list).
Use that list to create a FeatureCollection.
Use that FeatureCollection to create a GeoJsonSource. Add the GeoJsonSource to the map.
Use that GeoJsonSource to create a CircleLayer.
Use data-driven styling to customize the look of the circle(layer).
Activity
[-]circle polygon looks less like a circle in newer Mapbox version[/-][+]circle polygon looks less like a circle in newer Mapbox version on Android[/+]langsmith commentedon Nov 6, 2018
Hey @p-fischer , thanks for using Mapbox. You should use a
CircleLayer.Featureobject with the coordinates that you want to be the middle of the circle.Feature singleFeature = Feature.fromGeometry(Point.fromLngLat(LONG,LAT));. If you want multiple circles, do this for each long/lat pair.Featureto aList<Feature>(or allFeatureobjects to the same list).FeatureCollection.FeatureCollectionto create aGeoJsonSource. Add theGeoJsonSourceto the map.GeoJsonSourceto create aCircleLayer.https://www.mapbox.com/android-docs/maps/examples/style-circles-categorically/
https://www.mapbox.com/android-docs/maps/overview/runtime-styling/#geojson
Mapbox Annotation Plugin for Android (cuts down on boilerplate code that I wrote above): https://www.mapbox.com/android-docs/plugins/overview/annotation/#manager
p-fischer commentedon Mar 8, 2019
Hi @langsmith
I know I'm quite late to the discussion. I haven't switched to the annotation API yet.
But I'm upgrading to the mapbox-android SDK version 7.2.0 and I saw that the "polygon drawing API" is marked as deprecated now.
My question for CircleLayer is: Does the API (or the plugin API) provide the possibility to set the radius in both "pixels" and "meters"?
My original example draws a circle based the latter (by calculating the LatLng coordinates).
Since my map is zoomable, I need define the circles' radiuses in both ways at different places. Is this possible?
langsmith commentedon Mar 12, 2019
Work in progress @p-fischer . Discussion happening at #4312 . @tobrun @LukasPaczos , any more up-to-date thoughts about this?
miladsalimiiii commentedon Dec 13, 2021
@langsmith
Thanks for your comment.
But i dont understand this line :
CircleLayerdoes not have any dependency toGeoJsonSourceas i seeAnd what id the
source_idandlayer_id?