Add an Image from url into custom InfoWindow google maps v2

I’ve been building a similar app. First of all, the reason your InfoWindow is not showing the downloaded image is because the MapFragment renders the view into a Canvas, and then draws that. What you’re seeing in the info window aren’t the views you created, but a “picture” or “screenshot” of them. You basically need … Read more

Display toolbar for Google Maps marker automatically

The overlay that appears when a marker is clicked, is created and destroyed on-the-spot implicitly. You can’t manually show that (yet). If you must have this functionality, you can create an overlay over your map with 2 ImageViews, and call appropriate intents when they’re clicked: // Directions Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse( “http://maps.google.com/maps?saddr=51.5, 0.125&daddr=51.5, … Read more

Is it possible to write custom text on Google Maps API v3?

To show custom text you need to create a custom overlay. Below is an example adapted from official Google documentation. You could also use this library for more “stylish” info windows <html> <head> <script type=”text/javascript” src=”http://maps.google.com/maps/api/js?sensor=false”> </script> <script> //adapded from this example http://code.google.com/apis/maps/documentation/javascript/overlays.html#CustomOverlays //text overlays function TxtOverlay(pos, txt, cls, map) { // Now initialize all … Read more

Change map opacity outside circle of Google Maps JavaScript API v3

An example that puts a circular “hole” over New York City (modified from this Google Example): var citymap = {}; citymap[‘newyork’] = { center: new google.maps.LatLng(40.714352, -74.005973), population: 8143197 }; var cityCircle; var bounds = new google.maps.LatLngBounds(); function drawCircle(point, radius, dir) { var d2r = Math.PI / 180; // degrees to radians var r2d = … Read more

Get the distance between two locations in android?

Use the Google Maps Directions API. You’ll need to request the directions over HTTP. You can do this directly from Android, or via your own server. For example, directions from Montreal to Toronto: GET http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false You’ll end up with some JSON. In routes[].legs[].distance, you’ll get an object like this: “legs” : [ { “distance” : … Read more

How to connect two points in Google map..?

Geocoding is asynchronous. Try something like this (call the second geocoder operation from the call back of the first, use the results of both inside the call back of the second). function createLine() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(7.5653, 80.4303); var mapOptions = { zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } … Read more

myLocationOverlay change the marker

Thx @CommonsWare, you led me in the right direction. Spent quite a wile twiddling with this. The Javadoc on http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MyLocationOverlay.html is just wrong (or outdated) and messes with your brain where it says: drawMyLocation Also, if the user’s position moves near the edge of the screen, and we’ve been given a MapController in our constructor, … Read more

Google Maps API map doesn’t appear [duplicate]

Give your map_canvas div a fixed width and height, and your example will work fine: <div id=”map_canvas” style=”width: 500px; height: 400px;”></div> Otherwise, set the height to your html and body as Google does in the API tutorials: <style type=”text/css”> html { height: 100% } body { height: 100%; margin: 0px; padding: 0px } #map_canvas { … Read more