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.
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'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.
How can I draw the line between one Geo point to another in Google maps version 2? I know some accepted answers are available here. According to those answers I have to override draw() function. But I Used fragments for displaying Google maps. so I can not override that function from my activity.Can any one help me out?
How can I draw the line between one Geo point to another in Google maps version 2?
GeoPoint is only for Maps V1. To draw lines in Maps V2, you would add a Polyline to your GoogleMap:
PolylineOptions line=
new PolylineOptions().add(new LatLng(40.70686417491799,
-74.01572942733765),
new LatLng(40.76866299974387,
-73.98268461227417),
new LatLng(40.765136435316755,
-73.97989511489868),
new LatLng(40.748963847316034,
-73.96807193756104))
.width(5).color(Color.RED);
map.addPolyline(line);
(from this sample app, described in detail in this book)
I need to solve a simple problem regarding Showing Map on Swing based application in java.
I am having list of latitudes and longitudes (GPS Tracks) , I need to draw some routes using these routes and probably want to draw maps like GoogleMaps.
Is it possible to draw Google Maps using GPS info (latitude, longitude) via OpenMapStreet API. Based on different user selection over JFrame control (e.g Row containing Route Info) one of specific area (panel) a map should be drawn (probably a Google Map).
I read the OpenMapStreet API. But I don't found a concrete example drawing the map over the Swing application using given latitudes/longitudes (GPS Info).
Any idea (probably some code sample) I would be obliged and thankful.
Edit:
Let say I have the following longitudes/latitudes info.
Longitudes Latitudes
2546789.510 ,7894125.10 ( Linhaeim)
1547897.111 ,4569872.10 ..
2546789.510 ,2365478.79 ..
2314561.510 ,7894125.11
5467891.510 ,7894125.22
4578933.510 ,2647835.33
6547891.510 ,2254776.44
3211457.510 ,7899901.37
6987888.510 ,2010009.78
3654789.510 ,9876510.61
5547890.510 ,3145678.39
1789000.510 ,4698333.58
2778900.510 ,3254788.97
7455555.510 ,3378945.27 ( XYZ )
Moreover some StopNames of Journey also associates with these gps coordinates ( like Linhaeim, Im Saal, KreiserStr, ABC,XYZ, ........)
I have above data stored inside databases with some other additional information ( e.g JourneyId,JourneyStartTime,JourneyEndTime.....). So, I need the map like which shows above coordinates as route connecting these coordinates.
If GoogleMap API works for this , then it would too be acceptable for me. Usage of Google Maps API for this context , Please point me small tutorial even to look for for incarporating above map problem.
If still not clear, I would happy to edit it again :-)