Skip to content

Commit f92c67b

Browse files
readme updates v1
1 parent 7298a63 commit f92c67b

3 files changed

Lines changed: 38 additions & 11 deletions

File tree

README.md

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,35 @@ Offline map usage is kind a problem for developers and there are rare documentat
1515

1616
You need to download offline map-tiles as SQLite format. And you should put it under assets folder. Let me explain how to download offline map-tiles step-by-step;
1717

18-
1. First you need to download Mobile Atlas Creator from [HERE](https://sourceforge.net/projects/mobac/files/Mobile%20Atlas%20Creator/MOBAC%202.0/Mobile%20Atlas%20Creator%202.1.2.zip/download)
18+
##### 1. First you need to download Mobile Atlas Creator from [HERE](https://sourceforge.net/projects/mobac/files/Mobile%20Atlas%20Creator/MOBAC%202.0/Mobile%20Atlas%20Creator%202.1.2.zip/download)
1919

20-
2. Open MOBAC and select Osmdroid SQLite
20+
##### 2. Open MOBAC and select Osmdroid SQLite
2121
<img src="picsfortut/q1.png" width="650">
2222

23-
3. Select map source (selecting osm is better) and zoom-levels (15-14-13-12 are ideal) as you desire from left panel.
23+
##### 3. Select map source (selecting osm is better) and zoom-levels (15-14-13-12 are ideal) as you desire from left panel.
2424
<img src="picsfortut/q2.png" width="650">
2525

26-
4. Draw a area (small areas consume less storage). And press add selection button from left panel.
26+
##### 4. Draw a area (small areas consume less storage). And press add selection button from left panel.
2727
<img src="picsfortut/q3.png" width="650">
2828

29-
5. As you can see layers are selected. After selecting layers press Create Atlas button.
29+
##### 5. As you can see layers are selected. After selecting layers press Create Atlas button.
3030
<img src="picsfortut/q4.png" width="350">
3131

32-
6. Select 'Ignore download errors and continue automatically' and continue.
32+
##### 6. Select 'Ignore download errors and continue automatically' and continue.
3333
<img src="picsfortut/q5.png" width="650">
3434

35-
7. After finishing download process rename the SQLite file as 'map.sqlite' and copy it into assets folder.
35+
##### 7. After finishing download process rename the SQLite file as 'map.sqlite' and copy it into assets folder.
3636
<img src="picsfortut/q6.png" width="450">
3737

38-
And yes! You completed the hard part. Rest of the steps just coding few lines.
38+
##### 8. And yes! You completed the hard part. Rest of the steps just coding few lines.
3939

4040
#### Java
4141

4242
```java
4343
public class MainActivity extends AppCompatActivity implements MapListener, GeoPointListener {
4444

4545
OfflineMapView offlineMapView;
46+
MapUtils mapUtils;
4647

4748
@Override
4849
protected void onCreate(Bundle savedInstanceState) {
@@ -57,9 +58,21 @@ public class MainActivity extends AppCompatActivity implements MapListener, GeoP
5758
public void mapLoadSuccess(MapView mapView, MapUtils mapUtils) {
5859

5960
// GeoPoint belongs to ISTANBUL heart of the world :)
61+
this.mapUtils = mapUtils;
62+
offlineMapView.setInitialPositionAndZoom(new GeoPoint(41.025135, 28.974101), 14.5);
6063

61-
offlineMapView.setInitialPositionAndZoom(new GeoPoint(41.011099, 28.996885), 15.5);
62-
offlineMapView.setAnimatedLocationPicker(true, this, mapUtils);
64+
// 41.025135, 28.974101 Galata Tower
65+
66+
Marker marker = new Marker(mapView);
67+
marker.setPosition(new GeoPoint(41.025135, 28.974101));
68+
marker.setIcon(getResources().getDrawable(R.drawable.galata_tower));
69+
70+
// marker.setImage(drawable);
71+
72+
marker.setTitle("Hello Istanbul");
73+
marker.showInfoWindow();
74+
mapView.getOverlays().add(marker);
75+
mapView.invalidate();
6376
}
6477

6578
@Override
@@ -74,6 +87,11 @@ public class MainActivity extends AppCompatActivity implements MapListener, GeoP
7487

7588
Toast.makeText(this, geoPoint.toDoubleString(), Toast.LENGTH_SHORT).show();
7689
}
90+
91+
public void activateAnimatePicker(View view) {
92+
if (mapUtils != null)
93+
offlineMapView.setAnimatedLocationPicker(true, this, mapUtils);
94+
}
7795
}
7896
```
7997

@@ -114,6 +132,8 @@ class MainActivityKotlin : AppCompatActivity(), MapListener, GeoPointListener {
114132
}
115133
```
116134

135+
136+
#### Or XML
117137
```xml
118138
<egolabsapps.basicodemine.offlinemap.Views.OfflineMapView
119139
android:id="@+id/map"
@@ -124,6 +144,11 @@ class MainActivityKotlin : AppCompatActivity(), MapListener, GeoPointListener {
124144
app:zoomLevel="15" />
125145
```
126146

147+
###### Result: Say Hi to ISTANBUL :)
148+
149+
<img src="picsfortut/q7.png" width="350"> <img src="picsfortut/q8.gif" width="350">
150+
151+
127152
## Implementation
128153

129154
###### Add it in your root build.gradle at the end of repositories
@@ -137,7 +162,9 @@ class MainActivityKotlin : AppCompatActivity(), MapListener, GeoPointListener {
137162
###### Add the dependency
138163

139164
```groovy
140-
165+
166+
implementation 'com.github.MKergall:osmbonuspack:6.6.0'
167+
implementation 'org.osmdroid:osmdroid-android:6.1.0'
141168
```
142169

143170
## License

picsfortut/q7.png

1.35 MB
Loading

picsfortut/q8.gif

9.96 MB
Loading

0 commit comments

Comments
 (0)