somethings like that:
https://maps.googleapis.com/
But not a static picture, although a "standard" google map link that open google map where i can zoom,scroll etc...
...
The second step will be to choose one of that point and navigate to it... (but i will work on it in a second phase)
Thanks to all in advanced!
You can do what you want to do with a Static Map with Google Maps or using a Fusion Table map. The basic Google Map API only can render two locations, your present location, and your destination if you use AI2.
The link you provided works with a static map using AI2. You are restricted to 2048 (? I think) characters in the url address. This works fine for a reasonable number of 'pins.'
Here is a Fusion Table solution with AI2: https://groups.google.com/ forum/#!searchin/ mitappinventortest/tips$20and$ 20tricks$20$20steve/ mitappinventortest/y61_ so09ClU/OQxDipfOAyEJ
You can show a Google Map showing directions using the Google Maps API 3 https://developers.google. com/maps/documentation/ javascript/tutorial.
sorry but probably i should explain you better my issue, or i didn't understand your answer (very probably!;-) )
I started with the "find my car tutorial" and now i have:
- a button --> where i save and store any gps point in a tiny db
- a list --> that show me all the point i stored into the db
- a button --> that show me the route from my actual position to one of the position i choose from the list
All of that works fine and the syntax is just an url that open google maps with saddr and daddr position. [http://maps.google.com/maps? saddr=....&daddr=....]
Now.... i would a "select all point" button from my list, i would that google maps opened with a mark on all point and i would be able to scroll the map, and choose one and navigate to it.
So... i think that the static map is not my solution right?
... I should use Fusion Table ?
Isn't there a easier way to open gmaps, and passing it just a url string like the example above ? Somethings like the static map ... but not static! :-)
Thanks a lot and sorry but i am very new in this world..
I started with the "find my car tutorial" and now i have:
- a button --> where i save and store any gps point in a tiny db
- a list --> that show me all the point i stored into the db
- a button --> that show me the route from my actual position to one of the position i choose from the list
All of that works fine and the syntax is just an url that open google maps with saddr and daddr position. [http://maps.google.com/maps?
Now.... i would a "select all point" button from my list, i would that google maps opened with a mark on all point and i would be able to scroll the map, and choose one and navigate to it.
So... i think that the static map is not my solution right?
... I should use Fusion Table ?
Isn't there a easier way to open gmaps, and passing it just a url string like the example above ? Somethings like the static map ... but not static! :-)
Thanks a lot and sorry but i am very new in this world..
You can not "google maps opened with a mark on all point and i would be able to scroll the map, and choose one and navigate to it." without a static map or a fusion map using AI2 at the present.
You can mark all the points with a static map but you can not scroll the map. It is possible to chose one of the pins if you place the static map image on a Canvas and write routines to convert the screen coordinates of the pin to the World location coordinates using a static map. Android Studio users use some Java code to do that. However, you still can not scroll the static map in AI2 in all dimensions using standard techniques.
There is no " easier way to open gmaps..." in AI2 that I know of and do exactly what you say you want to do with Google Maps..
One might be able to do something with Google's Business Map API, but you have to pay for that API and it might not be feasible in AI2. At the moment, you can do parts of what you want with a static map and might be able to do all of it with a fusion table map (I have never tried selecting one point).
One of the developers who used to work at MIT is experimenting with something similar to what you want but it is in development but might not be available for months, if at all.
Perhaps someone else knows of something else. I do not think you can do exactly what you want with AI2.
My suggestion is to set up a static map, try some blocks and get the functionality you want in a different way...perhaps label the pins and use a list picker to navigate to the location you select with the listpicker. Not as dramatic, but that can be done with AI2 fairly easily.
Ok, thank you so much for your answer. I'm going to try your suggest...
Forget static/fusion/api etc... I would just label my point and ordered them by distance in a list. In this way i could scroll the list, read the distance from me to them, and then select one and navigate to it.
Do you think is possible to do that with AI2 ?
Forget static/fusion/api etc... I would just label my point and ordered them by distance in a list. In this way i could scroll the list, read the distance from me to them, and then select one and navigate to it.
Do you think is possible to do that with AI2 ?
It is possible to label points in a static map. The link you posted shows how.
You have your points, put them in a List. Create a second List with the distance. You have to write a routine to calculate the distance from the users' location to each of the points. Use the look up in pairs block with the two lists, then sort the list based on distance. There are essentially two options when working with distance:
1) calculate the straight-line distances (using a math algorithm like Haversine). This works fine.
2) use the Google Map API to post driving distance between the points. I think this can be done with AI2 using either the Activity.Starter or Web component..it is a bit complicated.
Put the sorted list into a ListPicker. Use the ListPicker to chose the location , then use the selected location to get a normal Google Map to display using the ActivityStarter .... what that will do is actually allow you to show a route to that location. http://ai2.appinventor.mit. edu/reference/other/ activitystarter.html
and be aware of:
Show a map for a location
If you know the latitude and a longitude of a location, you can show a map using an activity starter with these properties to show a map of the area:
Action: android.intent.action.VIEW
DataUri: geo:37.8,-122.23?z=23
The format of the DataURI is specific to the app. In this example, the URI specifies a z (zoom) of 23, which is the largest zoom value. Zoom value is optional and ranges from 1 (the entire Earth) to 23.
If you know the zip code, you can set the activity starter properties as follows:
Action: android.intent.action.VIEW
DataUri: geo:0,0&q=94043
If you have a street address, you can use a DataUri that encodes the address with a scheme called URL encoding :
Action: android.intent.action.VIEW
DataUri: geo:0,0&q=5000% 20MacArthurBlvd%20Oakland%2CCA
Generally in URI encoding the only characters you have to replace are spaces (
%20
) and punctuation marks, such as comma ( %2C
) and period ( %2E
).
Yes, you can do this in this way.
Ok, you are very kindly, i'm working on it...
I hope to not disturb you again and again ;-)
I hope to not disturb you again and again ;-)
댓글 없음:
댓글 쓰기