mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.34k stars 1.33k forks source link

Draw circle with latitude , longitude and radius #16632

Open miladsalimiiii opened 2 years ago

miladsalimiiii commented 2 years ago

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