以前,我通过硬编码在Google地图中使用缩放级别。但是现在它来自回应。
那么如何通过传递到缩放级别来转换米?在我的代码中,我显示了一个大圆圈图标并指向。因此,对于两者,我都使用硬编码的缩放级别。但是现在它来自回应。
LatLng retailerPosition = new LatLng(Double.parseDouble(retailerLatitude), Double.parseDouble(retalerLongitude));
mMap.addMarker(new MarkerOptions().position(retailerPosition).title("").icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_circle_red)));
mMap.moveCamera(CameraUpdateFactory
.newLatLngZoom(retailerPosition, 3)); //3 hardcoded one.
for (int i = 0; i < listLocation.size(); i++) {
LatLng sitePosition = new LatLng(Double.parseDouble(listLocation.get(i).getRetLatitude()), Double.parseDouble(listLocation.get(i).getRetLongitude()));
mMap.addMarker(new MarkerOptions().position(sitePosition).title("").icon(BitmapDescriptorFactory.fromResource(R.drawable.round)));
mMap.moveCamera(CameraUpdateFactory
.newLatLngZoom(sitePosition, 3)); //3 hardcoded one
}
3是硬编码的。但是现在它来自回应。
“ range”:“ 1000” //这是“ meters”的响应
那么,如何将其应用到上述逻辑中以将米转换为缩放级别呢?
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句