How to use OSM map in an android application.? Is there any tutorial to learn about using OSM in android.? -
hi guys past 1 week i'm searching tutorial/manual or steps include open street map android application. found either big project lot more functionality on it, otherwise many questions ended without proper conclusion "how"..!
is there proper blog/site or document can fresher can refer.?
i don't know of tutorials here's code wrote minimal example using osmdroid.
// need display osm map using osmdroid package osmdemo.demo; import org.osmdroid.tileprovider.tilesource.tilesourcefactory; import org.osmdroid.util.geopoint; import org.osmdroid.views.mapcontroller; import org.osmdroid.views.mapview; import android.app.activity; import android.os.bundle; public class osmdroiddemomap extends activity { private mapview mmapview; private mapcontroller mmapcontroller; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.osm_main); mmapview = (mapview) findviewbyid(r.id.mapview); mmapview.settilesource(tilesourcefactory.default_tile_source); mmapview.setbuiltinzoomcontrols(true); mmapcontroller = (mapcontroller) mmapview.getcontroller(); mmapcontroller.setzoom(13); geopoint gpt = new geopoint(51500000, -150000); mmapcontroller.setcenter(gpt); } } /* have osm_main.xml ---------------------------------------------------------- xml start <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <org.osmdroid.views.mapview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" /> </linearlayout> ---------------------------------------------------------- xml end include slf4j-android-1.5.8.jar , osmdroid-android-4.1.jar in build path (google search them from) */
note must use latest version (4.1) avoid getting blocked downloading tiles osm.
also note moving repositries github , process isn't complete yet. page downloads holds links jars
Comments
Post a Comment