Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 4    Views: 103

Rishav
Code is Art
Profile
Posts: 153
Reg: Jan 26, 2012
Dubai
8,780
02/06/13 12:33 AM (12 years ago)

Location Map in Android - Issues

Firstly don't know why it display my location not accurate at all( always displays the pointer 400-700m from my actual position where as google maps application displays it accurately upto 2-4m). Secondly when I try to pinch zoom the pointer also moves and is displayed at different points at different zoom level. Regards, Rishav
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/06/13 12:41 AM (12 years ago)
Hi @Rishav, Is the drift in location due to the zoom at all? I have noticed on Android lately that the pins do indeed seem to float around a bit as longer zooms, but the closer you get to the actual point, the more accurate the pin becomes. Eventually, when you get close enough, the pin is exactly where it should be. Is this not the case on your device? What hardware are you using? I noticed this problem on the Nexus 7 tablet. Mark
 
Rishav
Code is Art
Profile
Posts: 153
Reg: Jan 26, 2012
Dubai
8,780
like
02/06/13 01:01 AM (12 years ago)
I just noticed that after zooming the pin is coming closer to real location..but still not accurate as required by my apps. Can we get a more accurate co-ordinate by anymodification in the code. I suppose the drift in the location is due to the zoom level only.. I tried it on Samsung - Galaxy S3 Galaxy Beam Galaxy Note Galacy Note2 same result in all. For the timing i use this code to get the directions try{ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?f=d&daddr="+tappedLocation.getLatitude()+","+tappedLocation.getLongitude())); intent.setComponent(new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity")); startActivity(intent); } instead of try{ //currentDevice.location > Obj_MapLocation.location Uri uri = Uri.parse("http://maps.google.com/maps?saddr=" + tmpLatitude + "," + tmpLongitude + "&daddr=" + tappedLocation.getLatitude() + "," + tappedLocation.getLongitude()); Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri); startActivity(intent); } this code lets the map application find my co-ordinates instead of my app finding it..so its more accurate..
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/06/13 03:48 AM (12 years ago)
I'm not sure if I can help; I've just finished my mapping woes on iOS and am about to hit Android. While on iOS, nothing I did with respect to map zoom seemed to work until I defined a 'region'. It may be similar in Android. I don't have Java code for it, but in iOS I did something like this: double myDouble = [latString doubleValue]; double my2Double = [lngString doubleValue]; MKCoordinateRegion region; region.center.latitude = myDouble; region.center.longitude = my2Double; region.span.latitudeDelta = 0.05; region.span.longitudeDelta = 0.05; region = [mapView regionThatFits:region]; [mapView setRegion:region animated:TRUE]; [mapView release]; It may not make sense for Android (heck, it barely makes sense in iOS) but what is happening is "LatString" and "LngString" are the coordinates I center my map on. After that, I 'played' with the settings of the 'Delta' (region.span.lat/lng Delta = 0.05) until I got it to a level that worked for me. It wasn't scientific at all. But it worked. Don't know if it will help, but I thought I'd toss it out there. Cheers! -- Smug
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
02/06/13 04:10 AM (12 years ago)
This is also a long standing issue I have had. It appears the map uses the top left hand side of the map marker.png. Someone suggested before to change it to an arrow pointing top left as a fix as it then uses tip arrow. It would be much better if someone could tweak the code so it uses the base point of a map pin.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.