Generate Shape mapping file...

<< Click to Display Table of Contents >>

dpCom > Menu reference > File > Import > Shape >

Generate Shape mapping file...

When you import the Shape file into  dpCom, you must have access to a so-called mapping file. A mapping is logical connections between elements in one set and elements in another set. In other words, a mapping file is a file with information about how data in a Shape file should be translated into data in dpCom.  

You can create the mapping file manually (in a standard text editor such as Windows Notepad). In dpCom there is a tool that facilitates that work - the tool identifies the layer contents of a Shape file and then generates a text file with "half" the mapping completed, ie the keys in the Shape file which must then be mapped to suitable components in dpCom.

The settings that are made e.g. from coordinate system and mapping file are saved throughout the session.

Create a mapping file for Shape import

1.Select File > Import > Shape > Generate Shape mapping file...

2.In the Open window, select the Shape file for which you want to create a mapping file.

3.Select settings for  the file.

4. Press Open.

5.Save the draft to the mapping file.

6.Open the mapping file in a text editor and complete it by mapping the Shape objects in the file to the appropriate dpCom objects.

 

Example

Example of a mapping file that creates a macro:

 

[define buildings($subtype, $val)]
filename_match=buildings.shp
otype=
subtype={$subtype}
ctype=
state=0
display_flag=0
dbf_field=type
dbf_value={$val}
data_fields=OSM_ID,NAME,TYPE
[buildings.shp*building]
[use buildings(, building)]
[buildings.shp*historical]
[use buildings(, historical)]

 

Example of mapping file:

 

 

 

This describes which object, which subtype, component type and which stage a shape object should have that is created in dpCom.

As for text placement, it is possible to add one of the following in the mapping file:

text_placement = start

text_placement = middle

text_placement = end

In addition, it describes which data fields from the Shape file's dbf content are to be mapped to the corresponding attribute in which dpCom-component.

 

To get an attribute on a component other than the main component, this is written according to syntax:

data_fields = ATTRIBUT_I_SHP = CTYPE.ATTRIBUT_I_DP

Example:

data_fields = IRNUM = 5001.IRN

This means that the IRNUM field in the shape file is imported into the IRN attribute in component 5001 (IRN).

 

Rotation settings

To control how rotation of symbols or text is interpreted when importing data, use the angle_unit parameter in the mapping file. Four types of rotation units are supported:

DEGREE - Rotation is specified in full degrees (0-360).

RADIAN - Rotation is specified in radians (0-2π).

GRADIAN - Rotation is specified in gradians (0-400).

FACTOR_OF_DEGREE - Rotation is specified as a factor of degrees (for example, one tenth of a degree = 0.1).

 

When using FACTOR_OF_DEGREE the following settings are also required:

angle_unit.offset=0.0

angle_unit.conversion_factor=0.1

offset - Adjusts the zero direction, for example if 0° represents east or north.

conversion_factor - Converts the input value to degrees. For example, set it to 0.1 if the value is in tenths of a degree.

Use a negative conversion_factor if the direction of rotation in the data is counterclockwise instead of clockwise.

 

Convert codetext to codenum

To be able to import values in codetext, these need to be converted to codenum during the import. Use:

value_mapping.codetext.altMapping=true

 

More information

When import Shape files, it is possible to map attributes to a constant. Also add support for some specific constants: $FILENAME$, $FILEPATH$, $FILE_PARENT_DIR$ and $FILE_ROOT_DIR$, to be use to store information from where the object is imported from.

 

$FILENAME$ - name of the import file

$FILEPATH - path + name of the import file

$FILE_PARENT_DIR$ - the parent directory of the import file

$FILE_ROOT_DIR$ - the root directory of the import file