Introduction
The enviroCar Android application is an open-source project, which allows the user to collect, share and analyze floating car data (xFCD). This data can be incredibly valuable in various situations, e.g.
- environment impact assessment,
- traffic management,
- navigation and route planning.
The enviroCar Android application provides capabilities for visualizing recorded tracks within a map. For this feature, the application currently makes use of several Mapbox mapping framework libraries. Recent changes in the Mapbox terms-of-use, as well as their switch to a non open-source license makes it problematic to continue relying solely on Mapbox. MapLibre Native library for Android is an open-source alternative to the Mapbox mapping framework. Adding support for MapLibre will ensure the project’s adherence to open-source principles and long-term sustainability.
Thus, my project aims to add support for additional map providers/libraries, primarily MapLibre. A number of map providers/libraries exist:
Support for multiple map providers/libraries will ensure long-term sustainability of the project by eliminating dependency on a single map provider/library. Each map provider/library has its own advantages and disadvantages. This addition to the project will allow the users to freely select the map provider/library.
Project Goals
The primary goal of the project is to add support for multiple map providers/libraries. This will bring several benefits to the project:
- Risk Mitigation: Reduce dependency on a single provider, mitigating risks from policy changes or price hikes.
- Customization: Users and developers can choose their preferred map provider.
- Enhanced Coverage: Different providers may offer better coverage in specific areas.
- Increased Reliability: Ensure continuous service by switching providers if one fails.
Some of the advantages and disadvantages of different map providers/libraries are listed below.
MapLibre
Advantages
- Open Source: MapLibre is open-source under BSD-2-Clause license.
- Highly Customizable: Extensive styling options are available, allowing developers to create unique map experiences. Different map tile providers, either vector or raster may be utilized.
- Offline Capabilities: Strong support for offline maps, allowing functioning without an internet connection.
Disadvantages
- External Tile Provider: An external tile provider is required to display the map content, which adds an additional dependency. This may also contribute to an additional cost.
OsmDroid
Advantages
- Open Source: OsmDroid is open-source under Apache-2.0 license.
- No Cost: Free to use without any licensing fees, making it ideal for budget-conscious projects.
Disadvantages
- Raster Tiles: Vector tiles provide a better viewing experience at all zoom levels compared to the raster tiles.
- Limited Features: Lacks some advanced features and services provided by commercial software development kits (SDKs).
- User Interface (UI): UI and user experience may not be as polished.
Google Maps SDK for Android
Advantages
- Better Coverage: Google Maps SDK for Android indicates a larger number of POI (points of interest), transits and landscapes,etc. The content is also regularly updated.
- Highly Customizable: Extensive styling options are available for various map elements.
- No Cost: Displaying a map using Google Maps SDK for Android does not contribute to an additional cost.
Disadvantages
- Data Privacy: Use of Google services may raise concerns about data privacy and control over user data.
For reference, the following images display a track recorded by the enviroCar application using different map providers/libraries:
From the technical standpoint, the project has following aims.
1. Source Code Maintenance
A few preliminary steps aim to prepare the enviroCar app for the coding period. This work comprises:
- Updating the project dependencies, Android Target/Compile SDK, Gradle, Android Gradle Plugin etc. to their latest available versions.
- Migrating the project to utilize Gradle Version Catalog. It is the recommended way of specifying dependencies in Android projects, enabling the specification of dependencies and plugins in a scalable way. It makes dependency management easier for projects involving multiple modules (such as enviroCar).
- Migrating to Jetpack View Binding from the now deprecated Butter Knife. This is necessary in order to run the project on newer Android Studio and JDK versions.
2. Map Module Implementation
I plan to introduce a fresh map module into the enviroCar Android application’s source-code, which will then be utilized by the enviroCar Android application to visualize tracks on the map. A separate module will have following advantages:
- Extensibility: Multiple map providers will be supported & more can be easily added in the future.
- Independence: The map module may be utilized in other projects as well.
The module will offer a common interface to display the map. This will allow the selection of preferred underlying map providers/libraries during initialization, e.g. Mapbox, MapLibre, OsmDroid, Google Maps SDK for Android etc. The latest recommended practices for Android development will be used for the development of this map module, e.g. Kotlin Programming Language and Android Architecture Components,etc.
The initial aim is to have support for both Mapbox and MapLibre. The implementation for other map providers/libraries can be added in the remaining time of the project’s duration.
A first UML diagram provides an idea about the planned implementation.
This UML diagram may be updated during the course of the project. The finalized version will be shared upon successful completion of the project along with the corresponding implementation.
The MapController interface is independent of any map provider/library and will have several underlying implementations such as MapboxController, MapLibreController, OsmDroidController, GoogleMapController. The MapView’s getController method can be used to initialize the required backend and retrieve it as MapController. MapController contains multiple methods that can be utilized to interact with the map, e.g. updating position / bearing / tilt / zoom, adding markers and adding polylines.
3. Application Refactoring and Update
I will refactor the enviroCar Android application to depend upon the newly introduced map module instead of Mapbox mapping framework. This step will include a rewrite of the views that currently directly depend upon Mapbox. Updating relevant sections of the code to utilize the Kotlin Programming Language instead of Java is also a part of this step.
The current style, look and feel of the maps should also be preserved. An additional option in the settings may also be added to switch between the map providers / libraries at runtime.
4. Testing
I will test the implemented features to ensure the stability of the project.
About Me
My name is Hitesh Kumar Saini. I am a final year student from Govind Ballabh Pant University of Agriculture and Technology, Pantnagar, Uttarakhand, India. I am currently pursuing my Bachelors of Technology in Information Technology. This year, I have received the valuable opportunity to contribute to the enviroCar project under the mentorship of Mr. Sebastian Drost, as part of Google Summer of Code 2024.
Android development is my primary skill. I have worked on a number of Android and Flutter projects. While I find mobile development interesting, I have experience in other technologies as well.
I believe I can say that I am highly involved in open-source. I am a contributor and maintainer of multiple open-source projects. Open-source allows me to express myself and share my craft with everyone. The open-source community has greatly helped me to improve my skills. I have learned a lot from other people. It makes me extremely happy to know that people from different countries find my work valuable.
You may connect with me on:
Leave a Reply