All Projects → AsynctaskCoffee → AndroidOfflineMapLibrary

AsynctaskCoffee / AndroidOfflineMapLibrary

Licence: Apache-2.0 License
Offline OpenStreet Map Library (No Internet Required) You dont have to even one-time connect!

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to AndroidOfflineMapLibrary

Libosmscout
Libosmscout is a C++ library for offline map rendering, routing and location lookup based on OpenStreetMap data
Stars: ✭ 159 (+893.75%)
Mutual labels:  map, offline, openstreetmap, osm
o.map
Open Street Map app - KaiOS
Stars: ✭ 51 (+218.75%)
Mutual labels:  map, openstreetmap, osm
Mapsui
Mapsui is a .NET Map component for WPF, Xamarin.Forms, Xamarin.Android, Xamarin.iOS and UWP
Stars: ✭ 447 (+2693.75%)
Mutual labels:  map, openstreetmap, osm
examples-android
Android demo application for GLMap framework
Stars: ✭ 14 (-12.5%)
Mutual labels:  map, offline, openstreetmap
Cyclosm Cartocss Style
Cycle oriented CartoCSS style.
Stars: ✭ 109 (+581.25%)
Mutual labels:  map, openstreetmap, osm
Aphotomanager
Manage local photos on Android: gallery, geotag with photomap, privacy, tags, find, sort, view, copy, send, ... .
Stars: ✭ 164 (+925%)
Mutual labels:  map, openstreetmap, osm
openfairdb
Open Fair DB is the CreativCommons Backend of Kartevonmorgen.org
Stars: ✭ 53 (+231.25%)
Mutual labels:  map, openstreetmap, osm
organicmaps
🍃 Organic Maps is a free Android & iOS offline maps app for travelers, tourists, hikers, and cyclists. It uses crowd-sourced OpenStreetMap data and is developed with love by MapsWithMe (MapsMe) founders and our community. No ads, no tracking, no data collection, no crapware. Your donations and positive reviews motivate and inspire our small team!
Stars: ✭ 3,689 (+22956.25%)
Mutual labels:  offline, openstreetmap
NotesReview
📝 Interface for searching and resolving OpenStreetMap notes
Stars: ✭ 34 (+112.5%)
Mutual labels:  openstreetmap, osm
oshdb
OpenStreetMap History Data Analysis Framework
Stars: ✭ 82 (+412.5%)
Mutual labels:  openstreetmap, osm
osm-data-classification
Migrated to: https://gitlab.com/Oslandia/osm-data-classification
Stars: ✭ 23 (+43.75%)
Mutual labels:  openstreetmap, osm
Delphi OSMMap
Visual control for Delphi and Lazarus to display OSM map
Stars: ✭ 27 (+68.75%)
Mutual labels:  openstreetmap, osm
s60-maps
Yet another maps for Symbian OS
Stars: ✭ 27 (+68.75%)
Mutual labels:  map, openstreetmap
mapcontrib
Thematic OpenStreetMap contribution
Stars: ✭ 63 (+293.75%)
Mutual labels:  openstreetmap, osm
freemap-mapnik
Outdoor map mainly for https://www.freemap.sk/
Stars: ✭ 16 (+0%)
Mutual labels:  map, openstreetmap
gazetteer
OSM ElasticSearch geocoder and addresses exporter
Stars: ✭ 93 (+481.25%)
Mutual labels:  openstreetmap, osm
HMap
:earth: HMap | 基于openlayers的封装组件
Stars: ✭ 64 (+300%)
Mutual labels:  map, openstreetmap
telegram-nearby-map
Discover the location of nearby Telegram users 📡🌍
Stars: ✭ 329 (+1956.25%)
Mutual labels:  map, osm
gosmparse
Processing OpenStreetMap PBF files at speed with Go
Stars: ✭ 55 (+243.75%)
Mutual labels:  openstreetmap, osm
openskimap.org
The front end for OpenSkiMap.org.
Stars: ✭ 23 (+43.75%)
Mutual labels:  map, openstreetmap

AndroidOfflineMapLibrary

Offline OpenStreet Map Library (No Internet Required) You dont have to even one-time connect!

Offline OpenStreetMap Library

Performance friendly and scalable

DETAILED MEDIUM POST

Why this project exists

Offline map usage is kind a problem for developers and there are rare documentations. I believe this library will helpful for developers.

Features and Usage

Implementation

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;

1. First you need to download Mobile Atlas Creator from HERE
2. Open MOBAC and select Osmdroid SQLite

3. Select map source (selecting osm is better) and zoom-levels (15-14-13-12 are ideal) as you desire from left panel.

4. Draw a area (small areas consume less storage). And press add selection button from left panel.

5. As you can see layers are selected. After selecting layers press Create Atlas button.

6. Select 'Ignore download errors and continue automatically' and continue.

7. After finishing download process rename the SQLite file as 'map.sqlite' and copy it into assets folder.

8. And yes! You completed the hard part. Rest of the steps just coding few lines.

Java

public class MainActivity extends AppCompatActivity implements MapListener, GeoPointListener {

    OfflineMapView offlineMapView;
    MapUtils mapUtils;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        offlineMapView = findViewById(R.id.map);
        offlineMapView.init(this, this);
    }


    @Override
    public void mapLoadSuccess(MapView mapView, MapUtils mapUtils) {

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

        // 41.025135, 28.974101 Galata Tower

        Marker marker = new Marker(mapView);
        marker.setPosition(new GeoPoint(41.025135, 28.974101));
        marker.setIcon(getResources().getDrawable(R.drawable.galata_tower));

        // marker.setImage(drawable);

        marker.setTitle("Hello Istanbul");
        marker.showInfoWindow();
        mapView.getOverlays().add(marker);
        mapView.invalidate();
    }

    @Override
    public void mapLoadFailed(String ex) {
        Log.e("ex:", ex);
    }

    @Override
    public void onGeoPointRecieved(GeoPoint geoPoint) {

        //Selected GeoPoint Returns Here

        Toast.makeText(this, geoPoint.toDoubleString(), Toast.LENGTH_SHORT).show();
    }

    public void activateAnimatePicker(View view) {
        if (mapUtils != null)
            offlineMapView.setAnimatedLocationPicker(true, this, mapUtils);
    }
}

Kotlin

class MainActivityKotlin : AppCompatActivity(), MapListener, GeoPointListener {

    lateinit var offlineMapView: OfflineMapView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main_kotlin)
        offlineMapView = findViewById(R.id.map)
        offlineMapView.init(this, this)
    }

    @SuppressLint("ShowToast")
    override fun onGeoPointRecieved(geoPoint: GeoPoint?) {

        //Selected GeoPoint Returns Here

        Toast.makeText(this, geoPoint?.toDoubleString(), Toast.LENGTH_SHORT).show()
    }

    override fun mapLoadSuccess(mapView: MapView?, mapUtils: MapUtils?) {

        // GeoPoint belongs to ISTANBUL heart of the world :)

        offlineMapView.setInitialPositionAndZoom(GeoPoint(41.011099, 28.996885), 15.5)
        offlineMapView.setAnimatedLocationPicker(true, this, mapUtils)

        
    }

    override fun mapLoadFailed(ex: String?) {
        Log.e("ex", ex.orEmpty())
    }
}

Or XML

<egolabsapps.basicodemine.offlinemap.Views.OfflineMapView
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:initialFocusLatitude="41.025818"
        app:initialFocusLongitude="28.973436"
        app:zoomLevel="15" />
Result: Say Hi to ISTANBUL :)

Implementation

Add it in your root build.gradle at the end of repositories
    repositories {
        maven { url 'https://jitpack.io' }
    }
Add the dependency
    implementation 'com.github.AsynctaskCoffee:AndroidOfflineMapLibrary:v1'
    implementation 'com.github.MKergall:osmbonuspack:6.6.0'
    implementation 'org.osmdroid:osmdroid-android:6.1.0'

Update 20.01.2021

Please add android:requestLegacyExternalStorage="true" in your manifest file.

Update 25.08.2021

Please check https://developer.android.com/about/versions/11/privacy/storage

License

   Copyright 2019 Egemen ÖZOGUL

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].