android - Mapbox Android SDK 使用的 CarmenFeature 是什么?

标签 android mapbox

我试图理解 Mapbox 中一些使用 CarmenFeature 的示例代码,但我不明白它是什么或它的用途。

我所指的方法在上下文中显示如下,尽管我不是在寻找方法本身的解释。

谢谢!

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE_AUTOCOMPLETE) {

        // Retrieve selected location's CarmenFeature
        CarmenFeature selectedCarmenFeature = PlaceAutocomplete.getPlace(data);

        // Create a new FeatureCollection and add a new Feature to it using selectedCarmenFeature above.
        // Then retrieve and update the source designated for showing a selected location's symbol layer icon

        if (mapboxMap != null) {
            Style style = mapboxMap.getStyle();
            if (style != null) {
                GeoJsonSource source = style.getSourceAs(geojsonSourceLayerId);
                if (source != null) {
                    source.setGeoJson(FeatureCollection.fromFeatures(
                            new Feature[] {Feature.fromJson(selectedCarmenFeature.toJson())}));
                }

                // Move map camera to the selected location
                mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(
                        new CameraPosition.Builder()
                                .target(new LatLng(((Point) selectedCarmenFeature.geometry()).latitude(),
                                        ((Point) selectedCarmenFeature.geometry()).longitude()))
                                .zoom(14)
                                .build()), 4000);
            }
        }
    }
}

最佳答案

CarmenFeature 是保存来自 a Mapbox Geocoding API response 的信息的类的名称.

Here's the CarmenFeature class, which comes from the Mapbox Java SDK .

您会在 the Java SDK's GeocodingResponse class 中看到多次提到 CarmenFeature .

关于android - Mapbox Android SDK 使用的 CarmenFeature 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57718695/

相关文章:

java - 加载多个 AdMob 视频

java - 在 Android 上使用 KSOAP2 发送 SOAP 消息

Android MapBox 膨胀错误。没有找到类 MapView

ios - 在注释标注内有一个 UITableViewcontroller

javascript - MapBox GL JS 标记偏移

javascript - 按下按钮后如何重新定位mapbox js?

mapbox - Mapbox Tilequery API 的高程错误

java - Gradle项目中的Gradle项目?

java - 从 TextView 文本设置 TimePicker 时间

java - Android fragment 演示错误