npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-mapsforge-vtm

v0.9.1

Published

React Native components to build vector maps using Mapsforges fork of vtm. Offline rendering of OpenStreetMap data. Android only

Readme

react-native-mapsforge-vtm

React Native components for offline vector maps, built on mapsforge/vtm. Renders OpenStreetMap data from .map files, online raster tiles, MBTiles, hillshading from DEM data, and geometric overlays — all without a network connection (except tile/bitmap layers).

Android only · React Native New Architecture (Fabric + TurboModules) · RN ≥ 0.80.0

Roadmap

ROADMAP.md — Upcoming work prioritizes better markers.

Requirements

  • React Native ≥ 0.80.0 with the New Architecture enabled. The library ships pre-generated native code that requires target_compile_reactnative_options (introduced in React Native 0.80.0).
  • Android only — ios/generated codegen stubs exist so the New Architecture build doesn't fail, but there is no real iOS implementation.
  • newArchEnabled=true in your app's gradle.properties.

Quick Example

import {
  MapContainer,
  LayerBitmapTile,
  LayerScalebar,
} from 'react-native-mapsforge-vtm';

const App = () => (
  <MapContainer
    center={[-77.6, -9.1]}
    zoomLevel={12}
    width={400}
    height={600}
  >
    <LayerBitmapTile
      url="https://tile.openstreetmap.org/{Z}/{X}/{Y}.png"
      zoomMax={18}
    />
    <LayerScalebar />
  </MapContainer>
);

Full documentation → — API reference covering components, hooks, utilities, debug tools, and advanced topics.

Installation

yarn add react-native-mapsforge-vtm

See the Installation Guide for prerequisites, Android setup, and build configuration.

Examples

The example app includes runnable examples across several categories:

| Category | Examples | |---|---| | layers | basic, mapsforge, mbtiles-bitmap, hillshading, canvas-adapter, layer-shapes, coastlines, path-jts, markers | | mapControls | pan-zoom, fit-bounds, fly-ease, viewport-orientation, trigger, multi-map, reanimated-overlay | | gestures | tap-events, layer-order-verification, many-layers, many-shapes, mixed-grouping, shared-layer-grouping, elevation-enrichment | | api | mercator-math, viewport-bbox, map-handle-registry, gnss-track-recording |

To run the example app:

yarn install
yarn example start      # start Metro (keep running in a separate terminal)
yarn example android    # build & run on device/emulator

Where to get maps

Components

| Component | Description | |---|---| | MapContainer | Root map view (Fabric component) | | LayerMapsforge | Offline vector maps from .map files | | LayerBitmapTile | Online raster tiles (OSM, custom) | | LayerMBTilesBitmap | Offline raster from MBTiles | | LayerHillshading | Shaded relief from DEM (.hgt) data | | LayerPath | Shared-layer paths for bulk rendering (50–1000+) | | LayerPathJts | Dedicated paths with JTS features and guaranteed z-order | | LayerShape | Geometric shapes (polygons, circles, rectangles, etc.) | | LayerScalebar | Map scale bar | | LayerMarker / Marker | Marker container + individual markers | | SharedLayer | Collapse same-type children into shared native layer fragments | | ReindexScope | Signal layer reorder to the native stack |

Hooks

| Hook | Description | |---|---| | useMap() | Imperative map control (pan, zoom, animate, fly, fitBounds, altitude/elevation queries) | | useMapEventInterval() | Poll map events at a fixed interval | | useViewportBbox() | Tile-snapped viewport bounding box with dedup | | useRenderStyleOptions() | Read render-theme style menu options |

Reanimated

Import from react-native-mapsforge-vtm/reanimated for worklet-based map utilities. Requires react-native-reanimated >= 3.0.0 (optional peer dependency).

| Export | Description | |---|---| | useMapPosition() | Reanimated shared values for map center, zoom, bearing, tilt — zero bridge crossings with native bridge activated | | useMapOverlay() | Worklet-based overlay positioning (lat/lng → screen coordinates) | | toScreenPosition() / fromScreenPosition() | Mercator ↔ screen coordinate conversion callable from worklets |

See Performance for the four-tier consumption pattern guide and native bridge activation setup.

Utilities

| Export | Description | |---|---| | enrichCoordinatesWithElevation() | Batch-enrich coordinate arrays with SRTM elevation data | | createMapHandle() / createMapHandleRegistry() | Non-React imperative map control factories (for Redux thunks, services, etc.) | | Mercator math | Non-worklet projection, tile, and screen-coordinate utilities | | GNSS filter | Native GNSS track-recording with DEM altitude resolution | | CanvasAdapterModule | Global text/line/symbol scale configuration |

Debug tools

| Tool | Description | |---|---| | useLayerDebugInfo() | Live layer-tree introspection hook | | LayerDebugTree | Visual debug overlay component |

Resources

  • Documentation — Full API reference, guides, and advanced topics
  • Extending the library — Build custom layer-type extensions (JS-only, TurboModule, or vtm-shadowing). Use the "ext-plan" OpenCode skill to scaffold new extensions.
  • Performance — Scaling guidance, map position consumption patterns, and reanimated native bridge setup
  • Naming conventions and terminology — Inclusive language conventions used in this project
  • Known Issues — Current bugs, limitations, and workarounds

Contributing

Contributions welcome. Report issues or suggest features, or fork the repository and make pull requests.

liberapay ko-fi

License

MIT

Apps using react-native-mapsforge-vtm

This library was built as part of straymap and later extracted as a standalone, reusable package so anyone can pick it up and use it in their own projects.

Another running app is the example app, included in this repository.

Working extensions

Credits

This library is a React Native wrapper around mapsforge/vtm. All credit for the map rendering engine goes to the mapsforge and vtm projects.

Runtime dependencies

JavaScript (bundled with the library):

  • lodash-es — tree-shakeable utility functions

Native (Android) — bundled via Gradle:

  • vtm (0.29.0) — the rendering engine, plus vtm-android, vtm-themes, vtm-jts, vtm-http, vtm-mvt, vtm-android-mvt, and vtm-hillshading
  • mapsforge (0.29.0) — map file reader (mapsforge-core, mapsforge-map, mapsforge-map-android)
  • JTS Topology Suite (jts-core:1.20.0) — geometry engine for path and shape layers
  • AndroidSVG — SVG rendering for vtm
  • OkHttp / Okio — HTTP client for online tile layers
  • Protocol Buffers (protobuf-java 3.x) — MVT/vector tile decoding
  • Mapbox Vector Tile — Java — MVT tile parsing

Dev dependencies