29 messages in com.googlegroups.android-developersRe: MapView with driving directions| From | Sent On | Attachments |
|---|---|---|
| macpuddin | 29 Nov 2007 01:41 | |
| Seb | 29 Nov 2007 03:46 | |
| gpsmobiler | 29 Nov 2007 04:18 | |
| macpuddin | 29 Nov 2007 07:36 | |
| neil | 29 Nov 2007 08:35 | |
| Bob Snopes | 29 Nov 2007 23:30 | |
| ceph...@gmail.com | 29 Nov 2007 23:54 | |
| neil | 30 Nov 2007 00:31 | |
| ceph...@gmail.com | 01 Dec 2007 22:48 | |
| ceph...@gmail.com | 02 Dec 2007 12:33 | |
| neil | 02 Dec 2007 14:13 | |
| ceph...@gmail.com | 02 Dec 2007 15:28 | |
| macpuddin | 03 Dec 2007 16:59 | |
| macpuddin | 12 Dec 2007 23:38 | |
| neil | 13 Dec 2007 11:46 | |
| Cow Bay | 13 Dec 2007 22:06 | |
| macpuddin | 18 Dec 2007 00:34 | |
| neil | 18 Dec 2007 04:23 | |
| macpuddin | 18 Dec 2007 08:11 | |
| neil | 18 Dec 2007 09:34 | |
| tga...@gmail.com | 29 Dec 2007 01:28 | |
| tga...@gmail.com | 29 Dec 2007 02:26 | |
| tga...@gmail.com | 30 Dec 2007 14:20 | |
| ceph...@gmail.com | 30 Dec 2007 14:25 | |
| tga...@gmail.com | 30 Dec 2007 15:49 | |
| cocaIce | 28 Jan 2008 06:13 | |
| neil | 28 Jan 2008 23:42 | |
| neil | 30 Jan 2008 00:43 | |
| neil | 31 Jan 2008 08:49 |
| Subject: | Re: MapView with driving directions![]() |
|---|---|
| From: | neil (neil...@freenet.de) |
| Date: | 01/31/2008 08:49:46 AM |
| List: | com.googlegroups.android-developers |
If you mean "Give me all Pizzas around 1 mile" or so then the answer is Yes.
Regards
On 31 Jan., 16:57, "harry liu" <harr...@gmail.com> wrote:
hey neil, do u think it's possible to ask Google about business via http? something like 'Find business' on Google maps web site... also couldn't find API for that, thanks.
Harry
On Jan 30, 2008 4:43 PM, neil <neil...@freenet.de> wrote:
Thanks a lot :)
Regards
On 30 Jan., 04:13, "harry liu" <harr...@gmail.com> wrote:
well done! cool, really cool, man... i also saw the 'my location' things,really helpful, thank u very much for sharing ur great effort with us!
On Jan 29, 2008 3:42 PM, neil <neil...@freenet.de> wrote:
Yes, it is easy too. Check out my website http://freenet-homepage.de/neilyoung/index.html menue "Directions I". And check out the legal aspects too :)
I'm still looking for a motivation to continue this series of articles with Directions II, describing, how to interpret the polyline sequence. So if it's of interest, let me know.
Regards
On 28 Jan., 15:14, cocaIce <harr...@gmail.com> wrote:
hi neil, any idea about how to use similar way to get driving directions directly via http requests? i'm more comfortable to implement it by this way, because i found googlenav api is not so stable, sometimes works, sometimes doesn't...
On Dec 14 2007, 3:47 am, neil <neil...@freenet.de> wrote:
If it is not too complicated you may ask Google directly, e.g. by attempting to obtain the geocode for a given street address.
<your_query>&key=<your_google_key>
Substitue <your_query> with a street address and <your_google_key> with a valid key obtained from Google, send this as plain HTTP request and parse the returned JSON. Because you are not primarily interested in the geocode itself you may check the validness in a two step approach
1) Returned HTTP status must be 200 OK 2) The value of Status within the returned JSON must be 200
This is done in a "3 liner" and straight forward. Nothing special required. Check it out with your browser first.
For example for the city of Berlin/Germany, where I live, the result for <your_query> = "berlin" and a valid key provided is:
{"name":"berlin","Status":{"code":200,"request":"geocode"},"Placemark":
[{"id":"p1","address":"Berlin, Germany","AddressDetails":{"Country": {"CountryNameCode":"DE","AdministrativeArea": {"AdministrativeAreaName":"Berlin","SubAdministrativeArea": {"SubAdministrativeAreaName":"Berlin","Locality": {"LocalityName":"Berlin"}}}},"Accuracy": 4},"Point":{"coordinates": [13.411494,52.523480,0]}}]}
AFAIK there is a JSON deserializer, which should do the job to provide you with the objects contained.
But probably this could be done even simpler :)
Regards
On 13 Dez., 08:38, macpuddin <mcpu...@gmail.com> wrote:
So I gave cephdon's code a whirl like I said, and it worked great! You did all the hard work! Thanks!
I do have a quesiton now regarding this line of code:
getDispatcher().addDataRequest(mDD);
It seems like you use this to start sending out mDD to find the directionsfrom the net. Unfortunately getDispatcher is only defined for MapActivity. Does anyone know of a way to get add this data request for mDD to finddirectionswithout using getDispatcher? For example, I'm trying to just use googlenav to tell me if an
address
is
valid or not (if it can find it there will be a starting route)
Thanks! James
On Dec 3, 4:59 pm, macpuddin <mcpu...@gmail.com> wrote:
Ah thats they key:
import com.google.googlenav.DrivingDirection;
I will give it a whirl!
On Dec 2, 2:13 pm, neil <neil...@freenet.de> wrote:
Hmm. A bit hard to follow you. Would you mind to publish
the
source?
Maybe this would make discussions easier.
Regards
Well, it appears that I can't attach files to this discussion.. suffice it to say here is an overlay that will do the job.. Part of the problem is that it doesn't seem to maintain my code formatting.. lets see if the html tag will work...
<code>
method in MyMapView to get thedirections // if you pass the start_location as an address or location name, then the DrivingDirection object will ignore the start_pos object. // you must pass a null string ( "" ) into either
start_location
or
end_location to make the start_pos (or end_pos relative to
the
pos
object you are using) count. private void startFetchDirections(MapPoint start_pos, String start_location, MapPoint end_pos, String end_location) { // getdirections // mDD is a class variable for the activity that will hold an instance of the DrivingDirection object created here. mDD = new
DrivingDirection(start_pos,start_location,end_pos,end_location);
if(mDD != null) { // add the request the
dispatcher
getDispatcher().addDataRequest(mDD);
Thread t = new Thread(new Runnable() { public void run() { // wait for the
search
to be
complete... while (!mDD.isComplete()) {} // check to see if any Placemarks were found.. if 0 then there is no route... if (
mDD.numPlacemarks()
0)
{ // set a flag
to
let the program know the
directionsare done... // this flag
is
created
in your main activity and just set here to let it know..
FoundDirections =
true;
} else // no route.. { // let the
user
know
that no route was found... } } }); t.start(); } } }
// this is defined in MyMapView to allow the overlay to have access to thedirectionsit will be rendering.. // you could also just have returned the route of MapPoint[]
if
you
wanted since thats what we will be drawing. public DrivingDirection getDrivingDirections() { return mDD; }
// overlay file.... package your.package.name;
import android.graphics.Canvas; import android.graphics.Paint;
import com.google.android.maps.Overlay; import com.google.android.maps.Point; import com.google.googlenav.DrivingDirection; import com.google.googlenav.map.MapPoint;
public class MapDrivingDirectionOverlay extends Overlay { MyMapView mMap; Paint paint1 = new Paint(); DrivingDirection dd = null;
public MapDrivingDirectionOverlay(MyMapView map) { mMap = map; }
public void draw(Canvas canvas, PixelCalculator pixelCalculator, boolean b) { super.draw(canvas, pixelCalculator, b); // holders of mapped coords... int[] screenCoords = new int[2]; int[] screenCoords2 = new int[2];
// method in the custom map view to return the DrivingDirection object. dd = mMap.getDrivingDirections(); if(dd != null) { // these methods are to illustrate some of what you can get
out
of the
system... MapPoint s = dd.getRouteStart(); String name = dd.getRouteStartLocation(); String distance = dd.getFormattedDistance();
...
Erfahren Sie mehr »- Zitierten Text ausblenden -




