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 :-)
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'm working on a project, which is basically to track a person in real-time via GPS. His position has to be updated at all times on Google maps (or any other). Here is how it looks like:
We are already set to receive the co-ordinates of the person (via GPS).
We want the maps available offline. (We're receiving GPS co-ordinates (X,Y) through a wire so lack of internet won't be a problem in that aspect).
Then we code in Java, such that the map is visible to us and the position of the person is marked by a dot (or circle).
My questions are:
Is it possible to download the Google maps (or any other) and then work on them to achieve what I've mentioned?
I'll be making the framework in swing. But for the dot-action, which other components will be required?
How will be the co-ordinates that I receive from GPS, interpreted on the maps? I mean in code I'll have to tell the program where to draw the dot, right? As of now I'm thinking, I'll program the position of the dot, such that (co-ordinates received from GPS = co-ordinates on google maps). But I've a feeling it won't be as simple. So please guide how can this be achieved.
From my research, no. It is not possible. The only 'offline' features is offline map caching INSIDE the Google Maps App for iOS and Android. If you're on Windows, you may want to try these applications that claim they can grab the maps. I'm on OSX, so I can't test them.
Since you'll have the offline map (a folder with an HTML), in Swing you will simply create a Browser component (it exists in SWT, don't know if they are in Swing too). The browser should have APIs like setUrl or/and setHtml. You will extract the HTML from the maps, draw the dots directly in the HTML code (with JavaScript), then include the resulting HTML in the Swing browser.
This is the easiest part. You can draw on the map with JavaScript (with GoogleMarker components - google it). When you instantiate those markers, you pass a latitude and a longitude from your GPS. Then the map will know where to draw them.
I am using eclipse with the adk android plugin and I am completely lost
That would depend on what do you mean by displaying their location:
Relative to each other on a blank screen.
Read up on distance calculation in coordinates and draw the locations relative to their distance from each other.
On a map, each one separately from the other or together.
Use a web/binary API for map display like Google Maps (don't want to spam and post links with my reputation), or write your app to display Open map data from sources like OpenStreetMap.
On a satellite/aerial images.
Pretty much the same as #3 just you have less options to investigate and try.
If you were a bit clearer in your question, I could have been more specific with the answers, if you edit your question and clarify more, I could be more specific.
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.