Skip to content

Locus Map ​

Locus Map is an outdoor navigation and mapping app. Protocol Launcher allows you to generate Locus Map URL scheme links.

Usage ​

There are two ways to use this library:

  • On-Demand import from subpaths enables tree-shaking and keeps bundles small.
  • Full Import from the root package is convenient but includes all app modules.

Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.

Select Installation Method

On-Demand
Recommended. Optimized for production.
Full Import
Convenient. Good for quick scripts.

Notes ​

The official Locus Actions documentation defines a locus-actions:// URL that points Locus Map to a hosted XML file. The XML document describes what Locus Map should do.

This module only exposes the actions documented by Locus Map: download and event. It does not add map search, navigation, point creation, or other behavior that is not present in the official Locus Actions page.

actions() accepts an https:// XML file URL and converts it to the documented locus-actions://https/<host>/<path> form. downloadAction() and eventAction() return complete XML documents with a single action.

Actions URL ​

On-Demand
ts
import { actions } from 'protocol-launcher/locus-map'

const url = actions({
  url: 'https://example.com/path/to/actions.xml',
})

Download Action ​

On-Demand
ts
import { downloadAction } from 'protocol-launcher/locus-map'

const xml = downloadAction({
  source: {
    url: 'http://example.com/maps/map.tar',
    size: 22075830,
    date: '2012-06-29_19-11-54',
  },
  dest: '/maps/map.tar',
  after: 'refreshMap',
})

The after field is limited to the official values: refreshMap, importData, displayData, extract, and deleteSource. Pass an array to generate the documented pipe-separated combinations, such as extract|deleteSource|refreshMap.

Event Action ​

On-Demand
ts
import { eventAction } from 'protocol-launcher/locus-map'

const xml = eventAction({
  key: 'setMapVector',
  value: '/mapsVector/DownloadedMap.map',
})

The key field is limited to the official values: setMapVector and setMapVectorTheme.

Generated URLs and XML ​

ts
actions({
  url: 'https://example.com/path/to/actions.xml',
})
// => 'locus-actions://https/example.com/path/to/actions.xml'
xml
<?xml version="1.0" encoding="utf-8"?>
<locusActions>
  <download>
    <source size="22075830" date="2012-06-29_19-11-54">
      <![CDATA[http://example.com/maps/map.tar]]>
    </source>
    <dest><![CDATA[/maps/map.tar]]></dest>
    <after>refreshMap</after>
  </download>
</locusActions>
xml
<?xml version="1.0" encoding="utf-8"?>
<locusActions>
  <event>
    <key>setMapVector</key>
    <value><![CDATA[/mapsVector/DownloadedMap.map]]></value>
  </event>
</locusActions>

Official Documentation ​