反应本地地图获得左上角和右下角的纬度和经度



我正在使用一个使用React-Native-Maps的React Antive应用程序,目前我一直坚持使用当前的区域左上角(LAT& long)和右下角(lat& long)

<MapView.Animated
        onRegionChange={this.onRegionChange.bind(this)}
        showsUserLocation
        initialRegion={{
          latitude: coords.latitude,
          longitude: coords.longitude,
          latitudeDelta: LATITUDE_DELTA,
          longitudeDelta: LONGITUDE_DELTA,
        }}
        style={{ flex: 1 }}
      >
      <MapView.Marker
          coordinate={{ latitude: coords.latitude, longitude: coords.longitude }}
      >
      <MapView.Callout style={{ position: 'relative', width: 150}}>
        <PlaceCard />
      </MapView.Callout>
    </MapView.Marker>
</MapView.Animated>

有什么想法?!

if( REGION.latitudeREGION.longitude)是地图的中心,而三角洲是地图上显示的最小值和最大lat/long之间的距离(以度为单位),那么您应该能够要获得下面的底线和底部右点:

            {
                latlng: {
                    latitude: REGION.latitude+(REGION.latitudeDelta/2),
                    longitude: REGION.longitude-(REGION.longitudeDelta/2)
                },
                title:'topLeft'
            },
            {
                latlng: {
                    latitude: REGION.latitude-(REGION.latitudeDelta/2),
                    longitude: REGION.longitude+(REGION.longitudeDelta/2)
                },
                title:'bottomRight'
            }

最新更新