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.
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 have an array of Marker (google maps markers) with longitude and latitude.
I want to create some sort of radar like view that'll display these markers as points where I'm looking toward their directions with an angle of 45°.
Do you guys have any idea how I can say "This marker is behind me, this marker is in front of me".
I guess I should apply cos and sin considering my orientation, but that's too blurry atm.
Hope you'll help :)
Thanks
I assume you already know your location and orientation. You can then calculate the directions of the array of markers using computeHeading() method of Google maps Geometry Library on your current location and the points. Then you can adjust those values based on your current orientation.
I want to do something like aerophotography simulator as my university project, using Google Maps Api. For this, I need dynamically change viewport of a map, but for this I have to get lat and long of center of my viewport. Is there any way to do that, using Google Maps Api standart functions?
In order to get the coordinates (LatLng) associated with the center point (x,y) of the MapView you can use the method getCameraPosition().
(Assuming your GoogleMap object is mMap)
LatLng latLng = mMap.getCameraPosition().target;
In order to animate the camera position use the method animateCamera(), something like this:
mMap.animateCamera(location);
where location is the next location you wish to show on the map (LatLng object).
I'm working on an Android project in which I will need to display the locations of various airports on Google Maps. I already have a list of latitude/longitude coordinates. My question is:
How do I get these coordinates to Display as a location in Google Maps on an Android Activity? What classes or other methods should I consider? Are there any templates or tutorials I could look at? Any help is most appreciated.
If you already have lat/lng for all required places, you can just use this in a loop for all coordinates:
LatLng loc = new LatLng(latitude,longitude);
map.addMarker(new MarkerOptions().position(loc).title("locationName"));
I think you need to use markers on your mapView
Here you can find the official documentation of the google map api, you'll find it's very easy to add marker on the map.
If you also need to use the current location, I suggest you to read This too.
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).