I'm using PlacePicker
API in my app and want to change it's map type from simple to satellite.
PlacePicker is an API offered by Google.
Here's how I'm using it:
// Construct an intent for the place picker
try {
PlacePicker.IntentBuilder intentBuilder =
new PlacePicker.IntentBuilder();
Intent intent = intentBuilder.build(this);
// Start the intent by requesting a result,
// identified by a request code.
startActivityForResult(intent, PLACE_PICKER_REQUEST);
} catch (GooglePlayServicesRepairableException e) {
Snackbar snackbar = Snackbar
.make(coordinatorLayout, e.getMessage(), Snackbar.LENGTH_SHORT);
snackbar.show();
// ...
} catch (GooglePlayServicesNotAvailableException e) {
Snackbar snackbar = Snackbar
.make(coordinatorLayout, e.getMessage(), Snackbar.LENGTH_SHORT);
snackbar.show();
// ...
}
and then in onActivityResult()
:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PLACE_PICKER_REQUEST
&& resultCode == Activity.RESULT_OK) {
// The user has selected a place. Extract the name and address.
final Place place = PlacePicker.getPlace(data, this);
final CharSequence name = place.getName();
final CharSequence address = place.getAddress();
LatLng latLng = place.getLatLng();
final double lat = latLng.latitude;
final double lng = latLng.longitude;
String attributions = PlacePicker.getAttributions(data);
if (attributions == null) {
attributions = "";
}
// mViewName.setText(name);
// mViewAddress.setText(address);
// mViewAttributions.setText(Html.fromHtml(attributions));
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
It only shows the simple map type. I want to show satellite type map.
Please let me know how to?
The API uses a MapType object to hold information about these maps. A MapType is an interface that defines the display and usage of map tiles and the translation of coordinate systems from screen coordinates to world coordinates (on the map).
You modify the map type in use by the Map by setting its mapTypeId property, either within the constructor via setting its Map options object, or by calling the map's setMapTypeId () method. The mapTypeID property defaults to roadmap.
Try searching or browse recent questions. Community content may not be verified or up-to-date. Learn more. There isn't really a 'map' mode in Google Earth.
All map types (base and overlay) are rendered within the mapPane layer. Overlay map types will display on top of the base map they are attached to, in the order in which they appear in the Map.overlayMapTypes array (overlays with higher index values are displayed in front of overlays with lower index values).
It's not currently possible to change the map type in Place Picker. You can add a feature request on the Place API's public issue tracker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With