User Tools

Site Tools


manual:advanced:customization:actions

Table of Contents

Locus Actions

This mysterious name hides a very simple way of providing an easy method of downloading data from your own web server to Locus Map (and probably other features will come later). The whole concept is based on XML file that you provide to Locus Map for processing. The XML file describes what to do.

Locus Map currently supports only one action: download

How to

Whole file you provide to Locus is an XML file with this syntax:

<?xml version="1.0" encoding="utf-8"?>
<locusActions>
  <action>...</action>
</locusActions>

Where locusActions may contain one or more action objects that will do the required work.

To make Locus Map handle this file correctly, simply construct URL to this file by following syntax (example):

locus-actions://https/dl.dropbox.com/u/12579512/my_directory/test.xml

As you can see, change simply the scheme to locus-actions and the default scheme changes to a part of base URL separated only by one slash. Locus Map will handle this link in simple way:

  1. removes locus-actions tag
  2. changes first part into new scheme

Download

Action object that serves downloading files into Locus directory.

Sample syntax is:

<?xml version="1.0" encoding="utf-8"?>
<locusActions>
  <download>
    <source size="22075830" date="2012-06-29_19-11-54">
      <![CDATA[http://.../map.tar]]>
    </source>
    <dest><![CDATA[/maps/map.tar]]></dest>
    <after>...</after>
  </download>
</locusActions>

Where

  • download - a core tag that identifies this action
  • source - URL to source file. If it contains size and date parameters, download file will be checked and not downloaded if it already exists.
    • size - (optional) size of the file in bytes
    • date - (optional) date of the last edit of format yyyy-MM-dd_HH-mm-ss. Some phones have problems with setting correct time to the downloaded file. Highly recommended is to set only size for comparing already downloaded files.
  • dest - alternate path (to Locus root) where to put the new file
  • after - special action that is performed after download. Currently is supported:
    • refreshMap - useful if you download a new personal or vector map. This calls on the last map (in case you download more maps) and refreshes the list of maps without need to restart Locus
    • importData - immediately after the file is downloaded Locus Map starts common import process of this file
    • displayData - immediately after download Locus Map loads and displays downloaded file on map. Data will be displayed only temporarily, so if you want to store them permanently, use importData option instead
    • extract - extracts downloaded file. Directory is the same as for download.
    • deleteSource - allows to delete the downloaded file. This is useful mainly if you download zipped file and after extracting it you want to remove it.

TIPS

  • Download map file (zip archive) - you may use this combination extract|deleteSource|refreshMap, which extracts the file after download, deletes original file and finally refreshes the maps list.
  • Download file ready for import (zip archive) - you may use this combination extract|importData, which extracts the file after download and starts import. In this case, it is suggested to set dest parameter to special Locus Map directory cache/temp. This directory is cleared from time to time so all unneeded files are removed.
manual/advanced/customization/actions.txt · Last modified: 2015/10/23 10:15 by mstupka