I am develpoing a map application with OpenStreetMaps. I am trying to generate a tap on a point from a org.osmdroid.views.MapView like can be done in Google Maps for Android:
HelloItemizedOverlay o = new HelloItemizedOverlay(drawable,getApplicationContext());
o.onTap(GeoPoint p, MapView mapView);
So far I haven't found an equivalent solution.
I realized that what I wanted to do was triggering a call to my implementation of onItemSingleTapUp on a specified item, so i did it:
this.onItemSingleTapUp(0, itemizedoverlay.getItem(0));
Related
Im creating an app where users need to walk to a point on a map. But they need to find a route to the point by them selves.
Ive created a map with markers but by default if a user clicks on the marker a "start navigation" and "view in google maps" option is shown. Is it possible to disable these options ?
The options that are shown on marker click
This thing is called Map Toolbar. You can disable it by calling UiSettings.setMapToolbarEnabled(false):
GoogleMap map;
....... //init map
map.getUiSettings().setMapToolbarEnabled(false);
You can also define setMapToolbarEnabled() from the XML using the following property:
map:uiMapToolbar="false"
In kotlin you can do:
map.apply {
uiSettings.isMapToolbarEnabled = false
}
If anyone needs to do this in Google Maps v2, you set it in the map options instead of setting it on the map directly. So like this:
var mapOptions = new GoogleMapOptions().InvokeMapToolbarEnabled(false);
I have my own offline map data in my app but only for a small region. Now I'd like to overlay this data onto my Google Map V2. This also already works. The only thing missing now is that GoogleMaps still overlays it's road names / city names above my tiles.
Is it possible to display a google map V2 in Android with MAP_TYPE_NORMAL and overlay custom tiles above roads?
TileOverlay overlay = map.addTileOverlay(new
TileOverlayOptions().tileProvider(provider).zIndex(2000));
The zIndex does't seem to help me here.
I think there is no way to display your tile-layer over the road names/city names.
How about display your offline map as Marker?
It should be displayed on the top.
try this link for https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/TileOverlay &
EXAMPLE :
GoogleMap map; // ... get a map.
TileProvider tileProvider; // ... create a tile provider.
TileOverlay tileOverlay = map.addTileOverlay(
new TileOverlayOptions().tileProvider(tileProvider));
Hope this helps.
As far as I know, you cannot place TileOverlays or GroundOverlays on top of labels. Your best option might be to use a different map type. This can be changed after the map has been created (i.e. in the onMapReady method by using the mMap.setMapType(...) method). Here are some possibilities:
MAP_TYPE_NORMAL + Custom Map Style
You can easily create your own map styles by using the Styling Wizard. It allows you to create a style that excludes labels entirely (among other things). Once you've created a style you like, you can copy the JSON code generated by that website and add it to the project file res/raw/style_json.json. The style can then be applied like this:
mMap.setMapType( GoogleMap.MAP_TYPE_NORMAL );
try
{
boolean success = mMap.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
getContext(), R.raw.style_json ) );
if( !success )
{
Log.e( TAG, "Style parsing failed." );
}
}
catch( Resources.NotFoundException e )
{
Log.e( TAG, "Can't find style. Error: ", e );
}
MAP_TYPE_NONE + Custom Map Tiles
If you need to have labels outside of your TileOverlay, you could add a second TileOverlay of non-Google map tiles (like those provided by OpenStreetMap). These typically include the labels within the map tiles themselves. So if your TileOverlay is added with a higher z-index, it will appear on top of these other map tiles!
Map Types Without Labels
MAP_TYPE_SATELLITE and MAP_TYPE_NONE don't include labels. If you don't need any map data outside of your TileOverlay, using MAP_TYPE_NONE will save on mobile data.
I think that it is a really noob question but i could not do it.
In new Google maps API for Android (v2) you can get you location right now touching the new button that appears on the map when you code:
myMap.setMyLocationEnabled(true);
That's works fine but I want to "catch" the event when the user touch this button because i want to add more actions and I don't know how to reference that button in code.
Anyone knows?
Thanks in advance.
GoogleMap.OnMyLocationButtonClickListener was just announced. probably going to be released today in the next Google APIs version.
This is not currently possible via the api.
A feature request is already pending and I think this will be added soon.
See this: http://code.google.com/p/gmaps-api-issues/issues/detail?id=4789
Oh yes, sorry. I should have read your question more clearly.
In order to your question:
In those situations, I recommened that you layout out your own my-location-button on the mapView and add a clicklistener on that and over location-listener, you can get the current position.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), zoom));
I'm trying to use the method zoomToSpan() from the Google MapView, but as I have read, this only works, if the MapView is fully loaded, so I want to know if there is a possibility to add a Listener to my Mapview to get a message, when it is done.
I use addListener to place an infowindow on my maps after the map loads, so that that the map will reposition and display the entire infowindow. I do this on a standard web browser, and I am not sure that it applies to the Android platform:
google.maps.event.addListener(map, 'tilesloaded', function(event) {
infowindow.open(map, marker);
// only do this the first time tiles are loaded
google.maps.event.clearListeners(map, 'tilesloaded');
});
Here's my response to another question where you can see more of the code: How to Display Multiple Google Maps per page with API V3
I am currently creating an Android application, that shows the user its current location on Google Maps. I currently have it working so brings up the location, zoomed in.
However, I want the location to be pin-pointed. I have attempted to try and follow the HelloMapView tutorial, but have been having difficulty. How do I modify what the tutorial is saying, to make the Overlay, show the current location?
Also, I have been getting an error, with the getDrawable part of the following:
Drawable drawable = ((Object) this.getResources()).getDrawable(R.drawable.androidmarker);
ItemizedOverlay itemizedoverlay = new ItemizedOverlay(drawable, this);
Also, whereabouts do I paste this:
itemizedoverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedoverlay);
Thank you.