var infoWin = new google.maps.InfoWindow({disableAutoPan: true});
A expert on system architect with full SDLC and Agile development experience. Skills: , C# C++ Scrum OOA/OOD javascript ASP.Net MVC XML, HTML Web Service, RESTful, WCF, Android and etc. Email me if you need help on development.
Showing posts with label Google Maps API. Show all posts
Showing posts with label Google Maps API. Show all posts
Wednesday, 19 October 2011
Avoid InfoWindow from shifting Google Maps
It's kind of inconsistent in some cases that Google InfoWindow would shift the map while panning. That's a huge user experience if this map behaviour is not your intention. There a couple ways to resolve it, either close the InfoWindow when panning the map way far causing it invisible, or set the proper value to an attribute of InfoWindow, which I believe it is the easiest and most solid solution. Here is the code snippet for the 2nd solution.
Sunday, 16 October 2011
Convert Latitude and Longitude to android.maps.GeoPoint
Use the following code snippets
GeoPoint point = new GeoPoint((int)(latitude * 1e6), (int)(longitude * 1e6));
Obtain Android Google Maps SDK Debug Certificate
For developing your Google Maps application for android, I would like to obtain a debug Google Maps SDK debug certificate before production release. Android.com provides a very thorough instruction for helping newbies and beginners. Here I just list the steps that I went through in my own development environment: Windows 7 32bit + JDK1.7.0. Hope it would help simplify your learning curve.
1. Locate your debug.keystore.
By default, build tools create the debug keystore in the active AVD directory which varies by platform:
1. Locate your debug.keystore.
By default, build tools create the debug keystore in the active AVD directory which varies by platform:
- Windows Vista/7: c:\users\<user>\.android\debug.keystore
For eclipse/ADT user, go to Windows -> Preferences -> Android -> Build for the full path of debug.keystore.
2. After the debug.keystore was located, use keytool utility to obtain the MD5 fingerprint of the debug certificate.
Replace the below command with your JDK installation path and your actual user id
"c:\program files\java\jdk1.7.0\bin\keytool" -v -list -alias androiddebugkey -keystore c:\users\<user>\.android\debug.keystore -storepass android -keypass android
Note: only the MD5 fingerprint is recognized by Google. Other version, such as SHA1/256, is new since JDK 1.7, and cannot be used for registering Google Maps API.
Note: only the MD5 fingerprint is recognized by Google. Other version, such as SHA1/256, is new since JDK 1.7, and cannot be used for registering Google Maps API.
3. Now, follow steps below to register your debug certificate with Google Maps Service
- Go to http://code.google.com/android/maps-api-signup.html
- If you don't have a Google account, use the link on the page to set one up.
- Read the Android Maps API Terms of Service carefully. If you agree to the terms, indicate so using the checkbox on the screen.
- Paste the MD5 certificate fingerprint of the certificate that you are registering into the appropriate form field.
- Click "Generate API Key"
Monday, 15 August 2011
Hide/remove transit stations from Google Map
I have been searching for the solution for a while on my recent real time transit project. The solution doesn't appear to be documented clearly. Here is my simplified working solution and hope it helps.
var latLng = new google.maps.LatLng(49.22587, -123.14044000000001);
var mapOptions = {
zoom: 16,
minZoom: 10,
center: latLng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var node = document.getElementById("map_canvas");
var map = new google.maps.Map(node, mapOptions);
var ntss = [{
featureType: 'transit.station',
elementType: 'all',
stylers: [{ visibility: 'off' }]
}];
var mapType = new google.maps.StyledMapType(ntss, { name: 'ntsss' });
map.mapTypes.set('nstps', mapType);
map.setMapTypeId('nstps');
Subscribe to:
Posts (Atom)