AVD Mapper

Using the application AVD Mapper you can create vector maps in AVD format using vector maps in different formats like MP, MapInfo, ESRI Shape, OSM (OpenStreetMap). Note that a source map must be in WGS-84 coordinate projection in grades.

The application AVD Mapper is launched from the console and is managed through the command line. Both Linux and Windows operating systems are supported. The application avd_mapper_win is a shell for the console utility which allows Windows OS users to adjust input parameters through graphical user interface.

Program Start

avd_mapper  -o <file_name> [-n <map-name>] [-t <map-tag>] [-p <number>] [--max-level=<number>]
[--min-level=<number>] [-i] [--clear-bg-flag] [--skip-render-flag] [--skip-search-flag]
[--mp-check-caps] [--pfm-config=<xml-file-path>]... <input-map-file> [<input-map-file>]

- o , - - output =< file_name >
Map file name to generate. The format is path/filename.avd. The path can be either absolute or relative. If creating the file in the current folder, you can do not even indicate it at all.

- n , - - name =< map-name >
Map name, for example, the name of the city.

- t , - - tag =< map-tag >
Map tag, optional grouping attribute for maps (city, country, etc.).

- p , - - priority =< number >
Map priority, default - 100. Greater priority means earlier map render. Maps with minor priority are rendered later and are situated above those with greater priority.

- - max-level =< number >
Max level to draw the map. Default - detect automatically.

- - min-level =< number >
Min level to draw the map. Default - detect automatically.

- - i
Create search index file that is add information for search (cities, streets, houses). This parameter is highly recommended.

- - clear-bg-flag
Clear background on render map flag, used for combining multiple maps. Do not display maps with higher priority which are situated in lower layers. If maps overlay, the top, more detailed, map is displayed. Background will be white. The flag is highly recommended to be used.

- - skip-render-flag
Skip map rendering at all. Do not include drawing information in the map (if the map will be used for search only).

- - skip-search-flag
Skip map search. Do not enable possibility for reverse geocoding (address search by coordinates) if the map will be used for rendering only.

- - mp-check-caps
Check CAPs in MP file address info (Cities, Regions, Countries).

- - pfm-config=<xml-file-path>
Path to PFM→AVD feature types conversion configuration (XML file with configuration for MP maps).

- - osm-config=<xml-file-path>
Flat text file with cities information for OSM maps city detection.

< input-map-file >
Path to input map files.

-h, - -help
Show program usage (help in console).

In order to avoid errors when starting the program, be attentive with special signs: a single hyphen ( - ) precedes single-letter keys, double hyphen ( – ) precedes expressions. Pay attention also on spaces and equal sign ( = ).

When generating maps from the Polish (MP) format, only data from the zero level is used.

АVD Mapper for Windows

This utility is designed to make easier working with the panel program avd_mapper. It is not a version of avd_mapper, and all changes made in avd_mapper automatically affect avd_mapper_win. The utility operates on the bases of Windows OS.

To launch the application, double-click on tis icon. Starting window has the following appearance:

AVD Mapper for Windows: Main window

Buttons
New Start creating a new map. If any map is already being creating, all its parameters will be lost.
Edit Editing entered data. If you have already created a map, you can still edit its parameters.
Create Start the process of creation.
Help Read help information.
STOP Abort the process of creation. Used in case if the program has hung. It is not recommended to press the Stop button until 3 minutes have passed after pressing Create.
Exit Exit the program.

New and Edit buttons invoke the dialog box to enter various parameters for future map:

Example of filling

Input files (maps)
Complete path to an input (source) file (supported formats are *.mp, *.osm, *.xml). Enter manually or push the Browse button on the right to choose a file on your computer.

Output files (map *.avd)
Output file name in the format path/filename.avd. The path can be either absolute or relative. If creating the file in the current folder, you can do not even indicate it at all.

Map name
Map name, for example, the name of the city.

Map tag
Map tag like city, country, etc.

Priority
Map priority, default - 100. Greater priority means earlier map render. Maps with minor priority are rendered later and are situated above those with greater priority.

Max level
Max level to draw the map. Default - detect automatically.

Min level
Min level to draw the map. Default - detect automatically.

Clear background
Clear background on render map flag, used for combining multiple maps. Do not display maps with higher priority which are situated in lower layers. If maps overlay, the top, more detailed, map is displayed. Background will be white. The flag is highly recommended to be used.

Skip-render
Skip map rendering, that is do not include drawing information in the map (then the map will be used for search only).

Skip search
Skip map search, that is do not enable possibility for reverse geocoding (address search by coordinates) if the map will be used for rendering only.

Add addresses
Add information for address search.

Capital letters
Check CAPs in MP file address info (Cities, Regions, Countries).

Config files (xml)
Path to XML file which contains configuration for MP maps.

After entering all parameters, press OK. The program will display a command line with your parameters.

Command line

Press the Create button to start compilation. If a lot of strings have appeared, it may mean that the program has hung up or the map being generated is very large.

Termination: map is ready

In case of any wrong parameters, there will be error messages.

Creating a Map from MP Format

Configuration file

To create a map from the Polish MP format, you have to use a special configuration file (XML) - parameter –pfm-config. If several configuration files are set, each next file will redefine some map types.

An example of such configuration file is included into AVD Mapper distribution. It is located config/pfm.xml. However, you can create and use your own file according to your requirements. See an example:

<pfm>
<feature type="0x0001" shape="PL" avd_type="1" max_level="2" name="A restricted access major divided highway, normally with 2 or more running lanes plus emergency hard shoulder. Equivalent to the Freeway, Autobahn, etc." use_addr="1" is_street="1"/>
 
<feature type="0x0002" shape="PL" avd_type="3" max_level="2" name=" 	Important roads that aren't motorways. Typically maintained by central, not local government. Need not necessarily be a divided highway." use_addr="1" is_street="1"/>
 
<feature type="0x0003" shape="PL" avd_type="5" max_level="2" name="Roads generally linking larger towns." use_addr="1" is_street="1"/>
 
<feature type="0x0004" shape="PL" avd_type="7" max_level="2" name="Roads generally linking smaller towns and villages." use_addr="1" is_street="1"/>
 
<feature type="0x0000" shape="PL" avd_type="9" max_level="2" name="Minor roads." use_addr="1" is_street="1"/>
<feature type="0x000a" shape="PL" avd_type="11" max_level="1" name="Unclassified roads typically form the lowest form of the interconnecting grid network." use_addr="1" is_street="1"/>
<feature type="0x0042" shape="PL" avd_type="12" max_level="1" name="Unpaved roads." use_addr="1"/>
 
<feature type="0x3008" shape="POI" avd_type="59" max_level="0" name="A fire station." use_addr="1" is_house="1"/>
<feature type="0xf001" shape="POI" avd_type="60" max_level="0" name="Bus station." use_addr="1" is_house="1"/>
<feature type="0x2f06" shape="POI" avd_type="61" max_level="0" name="A bank." use_addr="1" is_house="1"/>
<feature type="0x2b00" shape="POI" avd_type="62" max_level="0" name="A hotel." use_addr="1" is_house="1"/>
</pfm>

use_addr
Use this element when searching address by coordinates.

is_city
Use this element when searching a place by name (city).

is_street
Use this element when searching a street by name (street). Locking (snap) to roads function can also use this element.

is_house
Use this element when searching a house by name or number (house).

is_road
A road. This element can also be used to lock unit movements to existing roads.

type
Source type from MP format.

shape:
PG – polygon, PL – polyline, POI – point.

avd_type
Resulting map type in AVD file (0-255).

max_level
Maximum level to store map data in AVD format. Levels depend on metrage: o level - from 10 to 250 meters, 1 level - from 250 m to 20 km, 3 level - form 20 to 200 km.

name
The name of an object, area, point, that is custom mark.

Compilation example

avd_mapper goris/goris.mp -o maps/goris.avd --pfm-config avd_mapper/config/pfm.xml --pfm-config goris/pfm.xml\\  --priority 10 --clear-bg-flag --min-level 0 --max-level 6 -i --tag armenia

To store captions used for the map correctly, you have to meet one of the following conditions:

  • source MP file must be encoded in Win 1251, and the caption (IMG ID) must contain the string CodePage=1251;
  • source MP file must be encoded in Win UTF-8, and the caption (IMG ID) must contain the string CodePage=1252 or other value different from 1251.

Parameters explanation

goris/goris.mp
Where to take a source map in MP format.

-o maps/goris.avd
Where to put the resulting map.

–pfm-config avd_mapper/config/pfm.xml
Where the configuration file is located.

–priority 10
Defines the map priority as 10.

–clear-bg-flag
Indicates that lower areas will be not rendered if if several areas overlay.

–min-level 0 –max-level 6
Maximum and minimum levels to display the resulting map. In this case, from 0 to 6.

-i
Add address search information.

–tag armenia
The tag used for this map.

Map name parameter (–name) can be skipped if there is map name in source MP file.

Maps from Other Vector Formats

To create maps from other vector formats such as MapInfo, ESRI shapefile, etc., it is necessary to use a configuration XML file as a source file. Usually, it is located in the same directory with other map files (layers). It must be encoded in UTF-8 without BOM:

The file starts and ends with the conv tag. The following keys can be used inside this tag: name - map name, encoding - file encoding information.

In the point tag of the conversion section, you can set additional parameters to change map scale. It is done to convert local coordinate system commonly set in meters (like WGS84 Geocentric Projection or Gauss-Kruger UTM Projection) to an international coordinate system set in grades (WGS84 Geodetic Projection). There you adjust how points of one coordinate system correspond to those in the other one. Two or three (better three) points are required for coordinates conversion (if more, the rest are not considered). If any of the point is not correctly defined, the final map will be disproportional and inaccurate. It is better to use points closer to map borders (for example, crossroads).

Parameters lat (latitude - north, south), lon (longitude - east, west) set numbers in grade coordinate system. If you take these parameters in the program GPSMapEdit, for example, from a recorded track, make sure you take them not from grades-minutes-seconds which are displayed in the status line, but from object properties in the Source tab. Or you can convert the values from grades-minutes-seconds to fractional numbers of grades yourself.

Parameters x and y are derived from the local coordinate system at the corresponding point. These can be fractional numbers. Depending on file format, these values can vary.

The main part for map conversion is the description of layers required for data acquisition. The layer tag allows to describe each layer separately as well as transfer the map according to various attributes.

The file key is used to define the layer file (usually, .tab, .shp, and others). If XML file meant for conversion is located in the directory different from the layer files, it is required to indicate the path to the layer file.

Next, you indicate the features layer properties. In the type key set the value of AVD map elements (see it in pfm.xml or osm.xml). The name parameter is used to display captions for different objects on the map. Only Latin letters and $ sign are accepted. If other symbols are used, the file may be converted with errors or not converted at all. Besides, there you indicate the level to display the data in (the max_level parameter). Depending on your preferences, you can vary these parameters from 0 to 2 or leave them as in pfm.xml or osm.xml.

The following parameters are optional:

  • data_type - object type: polygon (pg), polyline (pl), point (poi). Example: data_type=“pg”.
  • address - define address by the indicated value.
  • region - define region name by the indicated value. Example: region=“$Region”.
  • street - define street name by the indicated value. Example: street=“$st”.
  • street_type - define street type by the indicated value. Example: street_type=“$sts_type”.
  • house - define house number by the indicated value. Example: house=“$number”.
  • is_city - define if this object is a city. If it is not, do not use this parameter. Example: is_city=“1”.
  • is_street - define if this object is a street. If it is not, do not use this parameter. Example: is_street=“1”.
  • is_house - define if this object is a house. If it is not, do not use this parameter. Example: is_house=“1”.
  • dump_attr is responsible for displaying particular object properties (in stdout). It works in the same way as the name parameter, but it displays information for a user who is converting the map.

Dollar sign in quotes (“$”) means that letters which follow will be used as a variable and substituted with this variable value. To use a usual text together with a variable, it is necessary to mark it with | sign from both sides. To retrieve data from some other layer, use the hash sign (#). After #, set three parameters. In the first parameter indicate the field from which the value should be taken, and then put a dot (.). The second parameter indicates the layer (filename without extension) to be used to get data, put a dot again. The third parameter indicates which field from the indicated layer should be used. The forth parameter can be used if the value is hidden in a string field or among a number of values - enter field, equal sign (=), and % sign in single quotes ('%'). Do not forget to separate all parameters with dots.

Here is an example.

Let us assume, we have two layers:

  • the cities layer with the fields ID, Name, Region;
  • the streets layer with fields ID, City, CityID, Name.

Then,

  • to get street name and the city, use
    $Name|, |#CityID.Cities.Name;
  • to get the city and region while searching by another field, use
    $Name|, |#City.Cities.Region.Name='%'.

If you have noticed that the layer file contains objects of different types (you can check it with the dump_attr parameter), and you want to display them as different types, use the mod tag. There you set filtration conditions and object type expected as the result of conversion process. In the filter parameter enter the condition as SQL query. The type parameter is set in the same manner as it was described above. If you have used this method, then the dump_attr parameter will display only the fields which have been used during the conversion.

In one layer there can be any number of features. In one features there can be any number of mod.

If there is an error when reading the file, try to open it in another program, for example, Internet Explorer: if there are any errors in file body, IE displays only the correct part of the file, however note that the check is performed only for opening/closing tags.

Use comments to make easier further editing and usage of the file.

Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2020 Gurtam