Show Gps location on the map

741 views
Skip to first unread message

oren.s...@gmail.com

unread,
Jan 11, 2013, 11:22:13 AM1/11/13
to mapsfo...@googlegroups.com
Hi guys,
I'm pretty new at android development so maybe my question will sound dumb but still..
I build a basic class with my map inside it - i attached the java file.
now i want to get information from the gps - longitude and latitude, and draw a circle overlay on top of my map.
What should i do? i saw their is a java file called MyLocationOverlay.java, but i dont understand how to integrate it into my system.
any help will be great!!

Thx,

Oren

Map.java

Hila

unread,
Jan 11, 2013, 2:35:51 PM1/11/13
to mapsfo...@googlegroups.com
Hi oren, 

Inorder to get the current GPS location, see this link

this gives you a GeoPoint (GPS location).
add that point to  overlayItems or your own overlay, see in mapsforge samples.

and if you want help in hebrew,
contant me by my mail.
Hila.

علی بهزادیان نژاد

unread,
Jan 16, 2013, 2:47:22 AM1/16/13
to mapsfo...@googlegroups.com
If you are using head version: (0.3.1-SNAPSHOT):

Inside your Activity class define a MyLocationOverlay as below:

MyLocationOverlay myLocationOverlay;

And inside onCreate method and after initializing your mapView:

myLocationMarker = this.getResources().getDrawable(R.drawable.person);
myLocationOverlay = new MyLocationOverlay(this, mapView, myLocationMarker);
myLocationOverlay.enableMyLocation(true);
mapView.getOverlays().add(myLocationOverlay);


--
 
 

Reply all
Reply to author
Forward
0 new messages