plugin-openstreetmap
Overview
This plugin provides support for OpenStreetMap maps by utilizing the osmdroid library.
Getting Started
Set up the development environment
Android Studio is required. If you haven't already done so, download and install it.
Ensure that you are using the Android Gradle plugin version 7.0 or later in Android Studio.
Set up the project
Add the plugin to the project by following one of the guides:
In your app's module-level
AndroidManifest.xmladd 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>Content copied to clipboard
Compatibility matrix
Legend of support levels:
| Fully supported | ✅ |
| Partially supported | 🟨 |
| Not supported | ❌ |
Map
OmhMap
| 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:
| 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
| position | ✅ |
| title | ✅ |
| draggable | ✅ |
| anchor | ✅ |
| infoWindowAnchor | ✅ |
| alpha | ✅ |
| snippet | ✅ |
| isVisible | ✅ |
| isFlat | ✅ |
| rotation | ✅ |
| backgroundColor | ❌ |
| clickable | ✅ |
| zIndex | ❌ |
OmhMarker
| 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
| points | ✅ |
| clickable | ✅ |
| color | ✅ |
| width | ✅ |
| isVisible | ✅ |
| zIndex | ❌ |
| jointType | ❌ |
| pattern | ❌ |
| cap | ✅ |
| startCap | ❌ |
| endCap | ❌ |
| spans | ❌ |
OmhPolyline
| 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 | ✅ |
| setCap | It applies not only to start and end cap, but to polyline joins as well |
Polygon
OmhPolygonOptions
| outline | ✅ |
| clickable | ✅ |
| fillColor | ✅ |
| holes | ✅ |
| isVisible | ✅ |
| strokeColor | ✅ |
| strokeJointType | ❌ |
| strokePattern | ❌ |
| strokeWidth | ✅ |
| zIndex | ❌ |
OmhPolygon
| getClickable | ✅ |
| setClickable | ✅ |
| getStrokeColor | ✅ |
| setStrokeColor | ✅ |
| getFillColor | ✅ |
| setFillColor | ✅ |
| getStrokeJointType | ❌ |
| setStrokeJointType | ❌ |
| getStrokePattern | ❌ |
| setStrokePattern | ❌ |
| getOutline | ✅ |
| setOutline | ✅ |
| getHoles | ✅ |
| setHoles | ✅ |
| getTag | ✅ |
| setTag | ✅ |
| getStrokeWidth | ✅ |
| setStrokeWidth | ✅ |
| getZIndex | ❌ |
| setZIndex | ❌ |
| isVisible | ✅ |
| setVisible | ✅ |
| remove | ✅ |
Documentation
/packages/plugin-openstreetmap/docs/advanced/README.md
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.Content copied to clipboard