Module plugin-openstreetmap

Overview

This plugin provides support for OpenStreetMap maps by utilizing the osmdroid library.

Getting Started

Set up the development environment

  1. Android Studio is required. If you haven’t already done so, download and install it.
  2. Ensure that you are using the Android Gradle plugin version 7.0 or later in Android Studio.

Set up the project

  1. Add the plugin to the project by following one of the guides:
  1. In your app’s module-level AndroidManifest.xml add the required permissions, for more information see permissions.

    <manifest ...>
       <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
       <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
       <uses-permission android:name="android.permission.INTERNET" />
       <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
       <application ...>
          ...
       </application>
    </manifest>
    

Compatibility matrix

Legend of support levels:

Support level Symbol
Fully supported βœ…
Partially supported 🟨
Not supported ❌

Map

OmhMap

Method Supported?
addMarker βœ…
addPolyline βœ…
addPolygon βœ…
getCameraPositionCoordinate βœ…
moveCamera βœ…
setZoomGesturesEnabled βœ…
setMyLocationEnabled βœ…
isMyLocationEnabled βœ…
setMyLocationButtonClickListener βœ…
setOnCameraMoveStartedListener 🟨
setOnCameraIdleListener βœ…
setOnMapLoadedCallback βœ…
setOnMarkerClickListener βœ…
setOnMarkerDragListener βœ…
setOnInfoWindowOpenStatusChangeListener βœ…
setOnInfoWindowClickListener βœ…
setOnInfoWindowLongClickListener βœ…
setOnPolylineClickListener βœ…
setOnPolygonClickListener βœ…
snapshot βœ…
setMapStyle ❌
setCustomInfoWindowContentsViewFactory βœ…
setCustomInfoWindowViewFactory 🟨

Comments for partially supported 🟨 properties:

Property Comments
setOnCameraMoveStartedListener The reason of the camera changed started is unknown
setCustomInfoWindowViewFactory The provider supports this method in full, however since the view is rendered β€œlive” (i.e., the view is mounted instead of being rendered to a bitmap), attaching interaction listeners to the root view returned by the factory is forbidden. Please consult the advanced documentation of this plugin for more information.

Marker

OmhMarkerOptions

Property Support level
position βœ…
title βœ…
draggable βœ…
anchor βœ…
infoWindowAnchor βœ…
alpha βœ…
snippet βœ…
isVisible βœ…
isFlat βœ…
rotation βœ…
backgroundColor ❌
clickable βœ…
zIndex ❌

OmhMarker

Method Support level
getPosition βœ…
setPosition βœ…
getTitle βœ…
setTitle βœ…
getClickable βœ…
setClickable βœ…
getDraggable βœ…
setDraggable βœ…
setAnchor βœ…
setInfoWindowAnchor βœ…
getAlpha βœ…
setAlpha βœ…
getSnippet βœ…
setSnippet βœ…
setIcon βœ…
getIsVisible βœ…
setIsVisible βœ…
getIsFlat βœ…
setIsFlat βœ…
getRotation βœ…
setRotation βœ…
getBackgroundColor ❌
setBackgroundColor ❌
showInfoWindow βœ…
hideInfoWindow βœ…
getIsInfoWindowShown βœ…
remove βœ…
getZIndex ❌
setZIndex ❌

Polyline

OmhPolylineOptions

Property Supported?
points βœ…
clickable βœ…
color βœ…
width βœ…
isVisible βœ…
zIndex ❌
jointType ❌
pattern ❌
cap βœ…
startCap ❌
endCap ❌
spans ❌

OmhPolyline

Method Supported?
getCap βœ…
setCap 🟨
isClickable βœ…
setClickable βœ…
getColor βœ…
setColor βœ…
getEndCap ❌
setEndCap ❌
getJoinType ❌
setJoinType ❌
getPattern ❌
setPattern ❌
getPoints βœ…
setPoints βœ…
getSpans ❌
setSpans ❌
getStartCap ❌
setStartCap ❌
getTag βœ…
setTag βœ…
getWidth βœ…
setWidth βœ…
getZIndex ❌
setZIndex ❌
isVisible βœ…
setVisible βœ…
remove βœ…
Property Comments Β 
setCap It applies not only to start and end cap, but to polyline joins as well Β 

Polygon

OmhPolygonOptions

Property Supported?
outline βœ…
clickable βœ…
fillColor βœ…
holes βœ…
isVisible βœ…
strokeColor βœ…
strokeJointType ❌
strokePattern ❌
strokeWidth βœ…
zIndex ❌

OmhPolygon

Method Supported?
getClickable βœ…
setClickable βœ…
getStrokeColor βœ…
setStrokeColor βœ…
getFillColor βœ…
setFillColor βœ…
getStrokeJointType ❌
setStrokeJointType ❌
getStrokePattern ❌
setStrokePattern ❌
getOutline βœ…
setOutline βœ…
getHoles βœ…
setHoles βœ…
getTag βœ…
setTag βœ…
getStrokeWidth βœ…
setStrokeWidth βœ…
getZIndex ❌
setZIndex ❌
isVisible βœ…
setVisible βœ…
remove βœ…

Documentation

Contributing

Please contribute! We will gladly review any pull requests. Make sure to read the Contributing page first though.

License

Copyright 2023 Open Mobile Hub

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

    https://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.