You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm currently trying to draw a tile filling it with a color, and i tried with getting latitude and longitude of the four points of tile
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, FINE_PERMISSION_CODE);
return;
}
mMap.setMyLocationEnabled(true);
// inside on map ready method
// we will be displaying polygon on Google Maps.
// on below line we will be adding polyline on Google Maps.
double latitude = 63.98862388;
double longitude = 29.06755082;
LatLng latLng = new LatLng(latitude, longitude);
MGRSTileProvider tileProvider = MGRSTileProvider.create(this, GridType.METER);
// Draw a rectangle on the canvas with the paint color
LatLng southWest = new LatLng(tileProvider.getMGRS(latLng).getGridZone().getBounds().getSouthwest().getLatitude(),tileProvider.getMGRS(latLng).getGridZone().getBounds().getSouthwest().getLongitude());
LatLng northWest = new LatLng(tileProvider.getMGRS(latLng).getGridZone().getBounds().getNorthwest().getLatitude(),tileProvider.getMGRS(latLng).getGridZone().getBounds().getNorthwest().getLongitude());
LatLng southEast = new LatLng(tileProvider.getMGRS(latLng).getGridZone().getBounds().getSoutheast().getLatitude(),tileProvider.getMGRS(latLng).getGridZone().getBounds().getSoutheast().getLongitude());
LatLng northEast = new LatLng(tileProvider.getMGRS(latLng).getGridZone().getBounds().getNortheast().getLatitude(),tileProvider.getMGRS(latLng).getGridZone().getBounds().getNortheast().getLongitude());
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(latLng) // Sets the center of the map to location user
.zoom(10) // Sets the zoom
.bearing(90) // Sets the orientation of the camera to east
.tilt(40) // Sets the tilt of the camera to 30 degrees
.build();
// Add polylines to the map.
// Polylines are useful to show a route or some other connection between points.
mMap.addPolyline(new PolylineOptions()
.clickable(true)
.add( southWest, northWest, northEast, southEast, southWest)
);
mMap.addTileOverlay(new TileOverlayOptions().tileProvider(tileProvider));
mMap.addMarker(new MarkerOptions().position(latLng).title(""));
mMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
The result was that it draw correctly the borders of the tile that i'm interested, but if i want a tile with a higher zoom level it doesn't have any method that supports it, something like this
LatLng northEast = new LatLng(tileProvider.getMGRS(latLng).getGridZone(Gridtype.TEN_METER).getBounds().getNortheast().getLatitude(),tileProvider.getMGRS(latLng).getGridZone(Gridtype.TEN_METER).getBounds().getNortheast().getLongitude());
Can you please tell me if there is a way to know to get the four points of a smaller tile with higher level of zoom?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
i'm currently trying to draw a tile filling it with a color, and i tried with getting latitude and longitude of the four points of tile
The result was that it draw correctly the borders of the tile that i'm interested, but if i want a tile with a higher zoom level it doesn't have any method that supports it, something like this
Can you please tell me if there is a way to know to get the four points of a smaller tile with higher level of zoom?
Thank you very much
Beta Was this translation helpful? Give feedback.
All reactions