mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

Draw circle with latitude , longitude and radius

Open miladsalimiiii opened this issue 4 years ago • 0 comments

I want to draw circle with latitude , longitude and radius i used this issue and implement these codes :

                Feature singleFeature = Feature.fromGeometry(Point.fromLngLat(drawCircleCommand.latitude,drawCircleCommand.longitude));
                FeatureCollection featureCollection2 = FeatureCollection.fromFeatures(Arrays.asList(singleFeature));


                GeoJsonSource geoJsonSource = new GeoJsonSource("source-id", featureCollection2);

                mapboxMap.getStyle().addSource(geoJsonSource);

                CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");

                circleLayer.withProperties(
                        PropertyFactory.circleRadius(drawCircleCommand.radius.floatValue()),
                        PropertyFactory.circleOpacity(10f),
                        PropertyFactory.circleColor(drawCircleCommand.fillColor),
                        PropertyFactory.circleStrokeColor(drawCircleCommand.strokeColor)
                );

                mapboxMap.getStyle().addLayer(circleLayer);

But when i run the app i dont have any circle.

So my first question is why? And my second question is what are these "source-id" and "layer-id" and how can i fill them?

Platform: Android Mapbox SDK version: 8.6.3

miladsalimiiii avatar Dec 14 '21 11:12 miladsalimiiii