I want to bound google map in android around the UK,so the user can’t pan the map to go outside uk.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is definitely a way (or several ways) to do this for the maps web api (see links: http://econym.org.uk/gmap/range.htm and http://econym.org.uk/gmap/epoly.htm). However, I don’t know of a built-in way to do this on android, so it may take some hackery.
You will likely have to rewrite part of the mapview class… I’d try either overwriting the getMaxZoomLevel (as suggested in the first link – simpler but may not work) or trying to somehow intercept all the map movement requests and checking them to see if they fall outside of certain coordinates (harder/may not even be possible – probably have to do something like call getLongituteSpan every time the map moves and maybe try moving the map back if the span is outside your desired area?)