<< Click to Display Table of Contents >> dpPower > Menu reference > File > Import > Shape > Generate Shape mapping file... |
When you import the Shape file into dpPower, 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 dpPower.
You can create the mapping file manually (in a standard text editor such as Windows Notepad). In dpPower 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 dpPower.
The settings that are made e.g. from coordinate system and mapping file are saved throughout the session.
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 dpPower objects.
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 dpPower.
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 dpPower-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).
To be able to import values in codetext, these need to be converted to codenum during the import. Use:
•value_mapping.codetext.altMapping=true
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