I have been developing Android application and I can't make 1 thing - my application uses Google Maps (MapView), and one uses zoom elements for increase/decrease scale of Map. And I need to get center of Map - for example, I can move or increase the Map and than I need to get the central point. I know there is method setCenter() of MapController, but how can I get central point? Thank you.
mymapView.getCenter();
See this ....
http://android-er.blogspot.com/2009/11/mapview-to-center-on-current-location.html
public GeoPoint getMapCenter()
Returns the current center-point position of the map, as a GeoPoint (latitude and longitude).
Related
I would like to create a circular route from distance. First, I get current position, and then create a circular route based on the specified distance. But I don't know how to achieve this at all. I couldn't find any helpful methods in Google Maps API.
Is there any way to achieve this?
It sounds like you want to draw a Circle on a map, and based on your tags you might want to use the Maps SDK for Android. Here's the documentation for creating Circles on a Google Map for Android. https://developers.google.com/maps/documentation/android-sdk/shapes
If you want a polygon of exact points on roads based on distance from a center point, you might be looking for an Isodistance. Here is some open source code in JavaScript for building an isodistance polygon. You would use the same strategy in Java to do this in the Maps SDK for Android. https://github.com/dugwood/isochrone-isodistance-with-google-maps
I encountered a problem and failed to find a solution up until now:
Google´s Maps API uses Lat/Long coordinates to find a certain location.
I´m currently trying to write an app which displays a location after entering coordinates. The problem is the typ of coords I get:
Our Rescue Coordination Center only provids coords in SwissGrid(ch1903) e.g. 4416984.21 / 5392873.07.
Do you know a work-around or a solution to use these coords with the Anroid GM API.
Thanks and greetings from Germany.
You can convert SwissGrid(ch1903) to Lat/Lang.. This like might be useful
I'am new in android development my problem is.
I have to find nearby coordinates from a data in a given radius in android.
For example when i click a button. It will search nearby coordinates listed in an array or in a database.
Example: My current coordinates is 1.1
Nearby coordinates will show : 1.2,1.3,1.4,1.5 which is stored or from my database/array.
Is this possible? Can someone help me. Any answer is really appreciated.
Thanks!
One approach is to simply use a geographical distance function.
Have a look at: http://www.movable-type.co.uk/scripts/latlong.html
This will give you some background information on what you are trying to do. I've used this website many times during work with UAVs. Also, keep in mind that you might need to convert to/from Deg/Min/Sec Lat & Longitude <-> decimal Latitude/Longitude.
Find the method for calculating distance - and there are many coded examples already out there - and then run each of your target points through it to find out how far each is from you.
Good luck!
I would like to create a circular route from distance.
First, I get current position, and then create a circular route based on the specified distance.
But I don't know how to achieve this at all.
I couldn't find any helpful methods in Google Maps API.
Is there any way to achieve this?
You can do that easily as Android Google Maps provides that API.
GoogleMap map;
// ... get a map.
// Add a circle in Sydney
Circle circle = map.addCircle(new CircleOptions()
.center(new LatLng(-33.87365, 151.20689))
.radius(10000)
.strokeColor(Color.RED)
.fillColor(Color.BLUE));
Take a look at this official Doc.
The only change you need to make is to pass the current location's Lat/Lng to the center method.
You can follow this tutorial to get the current location coordinates of a person.
I am trying to create a Google Maps application that has the map of my house. (bedroom, wash room, kitchen etc)
Using GPS, I will find my present location in my house and try to get the direction/walking-distance to my bedroom. (You could use Google's API to get the direction)
What I need to know is:
How can I add a custom map of my house?
To get the direction and walking-distance? You will have to provide your current geo-coordinates (where I am right now) and your destinations (kitchen) geo-coordinates, so will Google be able to find the walking-distance and direction from where I am to the next place I want to go (to the kitchen)?
Using GPS, I will find my present location in my house and try to get the direction/walking-distance to my bedroom.
Considering that the error range of GPS (~30m diameter circle) might be bigger than the footprint of your house, this seems unlikely to work well.
How can I add a custom map of my house?
You don't. You are welcome to create your own activity with its own images and such, but that will not have anything to do with Google Maps.
To get the direction and walking-distance?
You will need to calculate that yourself.