Can I always keep some static Markers in Android Map? - android

I'm a newbie into Android programming... Here's what I'm trying to do for a small academic project:
A google map displayed on screen: Done
Get user's current location and show on the map: Done
We've a list of Latitudes and Longitudes coming from a webservice, which forms a pre-defined path. I need to display an always-shown path on the map with static markers as per the list of Lat-Longs given. How?
I tried various ways, and searched various places, but couldn't find a satisfactory code or tutorial that has achieved the same. Can someone please point me to an appropriate resource that I can use to get the above?

Download and check for static marker..................
https://github.com/commonsguy/cw-android/tree/master/Maps/NooYawk
http://android-codes-examples.blogspot.com/2011/04/google-map-example-in-android-with-info.html

You need to implement Overlay and draw the path in the draw() method.
Use this SO post to get an idea of how to do it.

Related

How do I make multiple graphs without coding every data of the graphs?

I'm trying to make an app that shows a graph for each location on the map that I set. But the data for each location is obviously different, and I'm trying to use a way to minimize code length. I don't want to code in every piece of data I need. Instead, I want to get the data from an external file that represents the location's data. Or I heard there was something you could do with JSON files? Please give me some advice on this matter.

How to get location from the ploy line in android studio

I am creating an android app which is notify location to get off from the bus. It shows bus route by using poly lines and when user enter the destination, it also shows the path from current location. My question is how can I get the location of intercept point. I have attached a screen shot here.enter image description here
This question is a bit ambiguous, I recommend you first search and show your effort (or code) or whatever you did to solve your problem and give more context,for instance, ¿are the routes are in lat,lng format? etc.
Regarding this, there is a lot of algorithms to acomplish what you are looking, like:
How to find if an intersection occurs between two line segments represented by a Latitude and Longitude
Efficient list intersection algorithm
or a mathematic aproach in case you want to programme it by youself:
http://www.wikihow.com/Algebraically-Find-the-Intersection-of-Two-Lines
IMHO I would pre-calculate the intersections points before, store it and then compare it with the realtime position (lat,lng) of the users. If the user is near one of the intersections (with algorithms like: How to calculate the bounding box for a given lat/lng location?), show it.
Hope it helps.

Path between two very far points on google map in android

I am trying to develop very basic GPS App and want to highlight path between two cities. I used the code in the following post
Answer : Draw path between two points using Google Maps Android API v2
by zeeshan0026.
And the code works fine but when you highlight path between two very far cities then it shows the straight kind of path. I think the problem with the number of LatLng points return by the decodepoly function i am trying to change the shift but nothing helps.
Please somebody help me in this regard.
Thanks in Advance
Directions API URLs are restricted to approximately 2000 characters, after URL Encoding. As some Directions API URLs may involve many locations along a path, be aware of this limit when constructing your URLs.
For more accurate path between very far cities, we need to use the polyutil.encode and decode functions.

Get location from photo then use it to place a marker on map

I am trying to figure out if it is possible to grab the location from a photo then use the information to place a marker on my map overlay. Has anyone done this. I dont really know where to being. I will provide the full source to my app if anyone is interested in helping me out. Basically i'd like to make a program that shows a map, and this map displays markers that other users have added. A marker can only be placed from a photo. I have the map set up and how i'd like to call the camera and take the picture, but i'm not sure how to proceed from there.
Are you using Google Maps as the Map API?
If so then when the picture is taken store the latitude and longitude values in a database (or an array or where ever you please)
Then when the map is viewed show the marker according to those stored locations.
Without more information that is the most I can provide t you at the moment
Regards
RF
Based on your "other users" statement, you should see if it's possible to get at the EXIF data stored as metadata in most JPG photos. This is how the Flickr API allows you to search for photos based on location. By using EXIF data, you can use any photo, not just the ones taken from your app. If you do want everything to go through your own app though, you could make a database linking user photos with lat/long information obtained through a LocationListener. Just know the device's location won't be terribly accurate if GPS isn't turned on.

getting multiple marker coordinates in google map android

Hi to all the members of this great community!
This is my first question so forgive me for possible mistakes. I hope that from this day on i can be helpful for some of you as hopefully you will be for me.Getting to the question:
I am building an android app whose purpose is to search for nearest fuel-points and nearest care-repair-centers. I am very new to android and thx to the numerous posts about android in here I have managed to reach the point where i have build the map and animate it to my current location while updating my location.
Now i have to add the markers of the points of interest. Since they are at least 10 (I will add them only for demonstration purposes) i think it's not wise to add them through 10+ repetitive calls to itemizedOverlay.addOverlayItem(). My idea was to save them in a file in the format ( " latitude " , "longitude" , simple_description_title , other info ) and than in some way import the first 2 fields for the geopoint and the 3rd for the title.
I will use than the 4th later for some type of tooltip text (for example tel_number).
Do you think this is a good approach? And how can I implement the file reading(if) in the code that extends ItemizeOverlay().
I didn't post the code until this point since it's irrelevant.
Welcome to SO, let's jump right into your problem/question.
1.) Since you are only adding 10 points of interest it won't matter if you just call itemizedOverlay.addOverlayItem() for all 10 because the trick is to call itemizedOverlay.populate() only after you have added all the overlayItems using itemizedOverlay.addOverlayItem(), this way you don't compromise on performance.
2.) Now, once again, since you are only doing a demonstration I would advise you to simply hard-code all the 10 overlays with their respective geolocations into the Android code itself. This way you WON'T have to worry about reading data. Also, using a txt file to store data isn't the best option both performance and convenience wise. This is what databases exist for.
3.) If, and when you do this in the future, you do need to use some dynamic data to populate your markers with, then I'd STRONGLY advise you to use either
SQLite: The embedded database that Android offers, it's great for storing small bits of information that's required for your application such as description title, other info, the latitude, longitude, however, if you have some sort of a connection based application where you need to update globally accessible data every once in a while I'd advise you to use the next option,
MySQL: This is an online database that you have to interface with using a server and PHP. The advantage of using an online database is that you can now share information between different users (friends, contacts, followers etc.) by reading and writing to and from the database.

Categories

Resources