XML Script: Difference between revisions
(→Symbol) |
|||
(200 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
[[File: | [[File:Mas40px.png|This function is available in OCAD Mapping Solution.|link=https://www.ocad.com/en/products/ocad-for-cartography]] ([[File:Ori40px.PNG|This function is available in OCAD Orienteering.|link=https://www.ocad.com/en/products/ocad-for-orienteering]]) | ||
Choose this command to execute functions whose settings are defined in a XML file. | Choose this command to execute functions whose settings are defined in a XML file. | ||
Note: Most parameters can only be used in the Mapping Solution Edition. In the Orienteering Edition, XML Script can be used for Lidar Import, DTM Import and WMTS Export. | |||
==Introduction== | ==Introduction== | ||
Select '''Execute XML Script''' from '''File''' menu or drag-and-drop then xml file to the OCAD window. | Select '''Execute XML Script''' from '''File''' menu or drag-and-drop then xml file to the OCAD window. | ||
OCAD creates a log file in the temporary folder (''C:\Users\USERNAME\AppData\Roaming\OCAD\OCAD 20xx\Tmp''). | |||
==XML Script General== | ==XML Script General== | ||
Line 18: | Line 21: | ||
! style="width:12em" | Parameter | ! style="width:12em" | Parameter | ||
! style="width:8em" | Data type | ! style="width:8em" | Data type | ||
! style="width: | ! style="width:40em" | Values / Description | ||
|- | |- | ||
| File.New || File || String || file name of existing symbol set | | File.New || File <br> MapScale <br> <del>Easting </del><br> <del>Northing</del> <br> <del>Angle</del> || String <br> Integer <br><del>Integer</del> <br> <del>Integer</del><br><del>Double</del> || file name of existing symbol set <br> 10000 <br> obsolete, use Map.ScaleAndCoordinateSystem<br> obsolete, use Map.ScaleAndCoordinateSystem<br> obsolete, use Map.ScaleAndCoordinateSystem | ||
|- | |- | ||
| File.Open || File || String || ocd file name | | File.Open || File <br> IgnoreMissingBackgroundMaps <br> IgnoreMissingDatasets|| String <br> Boolean <br> Boolean|| ocd file name <br> true, false (default: false) <br> true, false (default: false) | ||
|- | |- | ||
| File.Close|| Enabled || Boolean || true, false | | File.Close|| Enabled || Boolean || true, false | ||
Line 30: | Line 33: | ||
| File.SaveAs || File || String || ocd file name | | File.SaveAs || File || String || ocd file name | ||
|- | |- | ||
| File.Import.Ocd || File <br> SymbolOption <br> ColorOption || String <br> Integer <br> Integer || File name <br> [0..3] <br> [0, 1] | | File.Import.Ocd || File <br> Directory <br> SymbolOption <br> ColorOption || String <br> String <br> Integer <br> Integer || File name <br> <br> [0..3] <br> [0, 1] | ||
|- | |- | ||
| File. | | File.Import.Dxf || Directory <br> NewOffset <br> HorizontalOffset <br> VerticalOffset <br> Angle <br> MapScale || String <br> Boolean <br> Integer <br> Integer <br> Double <br> Integer || Directory name<br> <br> ignored if NewOffset = false <br> ignored if NewOffset = false <br> ignored if NewOffset = false <br> ignored if NewOffset = false | ||
|- | |- | ||
| File.Exit || Enabled || Boolean || true, false | | File.Import.GeoPackage || GpkgFilename<br> TableName<br> Layer<br> CrtFilename || String <br> String <br> String <br> String ||<br> | ||
|- | |||
| File.MultipleFileImport | |||
|| Directory <br> SearchPattern <br> CoordinateSystem <br> NewOffset <br> Horizontally <br> Vertically <br> Angle <br> MapScale <br> GridDistance <br> DatabaseType <br><br> Codepage <br> KeyField <br> LayerField <br> LayerField2 <br> <br> ExtentMinimumEasting <br> ExtentMaximumEasting <br> ExtentMinimumNorthing <br> ExtentMaximumNorthing | |||
|| String <br> String <br> Integer <br> Boolean <br> Integer <br> Integer <br> Double <br> Integer <br> Double <br> Integer <br><br> Integer <br> String <br> String <br> String <br> <br> Double <br> Double <br> Double <br> Double | |||
|| Directory of import files, e.g. ''C:\Shape\''<br>optional, e.g. SV*.shp<br>[[Create_a_New_Map#Coordinate_System|Internal Grid ID]] |1000 = existing grid of OCAD file, -1 = WGS 84, <br><br><br><br><br><br><br><br> 0 = dBase, 1 = Access 2007, 2 = Access 2003/2010, 3 = Do not create a database <br> 0 = Default, Codepage number <br> ' ' = Create new key field, field name <br> ' ' = do not import layer information, field name <br> ' ' = do not import 2nd layer information, field name, LayerField and LayerField2 content are concatenated by '_' <br> <br> <br><br><br> | |||
|- | |||
| File.Exit || Enabled || Boolean || true, false | |||
|} | |} | ||
Line 53: | Line 63: | ||
|- | |- | ||
| View.Zoom || || Double || | | View.Zoom || || Double || | ||
|} | |||
===Select=== | |||
{| class="wikitable" style=" border="1" | |||
|- | |||
! style="width:13em" | Node <OcadScript> | |||
! style="width:12em" | Parameter | |||
! style="width:8em" | Data type | |||
! style="width:19em" | Values / Description | |||
|- | |||
| Select.ObjectsBySymbol || SymbolNumber || Double || e.g. 526.002 | |||
|- | |||
| Select.ObjectsBySymbol || || || use <Select.ObjectsBySymbol></Select.ObjectsBySymbol> to clear the selection | |||
|} | |||
===Object=== | |||
{| class="wikitable" style=" border="1" | |||
|- | |||
! style="width:13em" | Node <OcadScript> | |||
! style="width:12em" | Parameter | |||
! style="width:8em" | Data type | |||
! style="width:19em" | Values / Description | |||
|- | |||
| Object.ChangeVertexTypesTo || Type || Enum types || CornerVertex, DashVertex | |||
|- | |||
| Object.Fill || SymbolNumber || Double || | |||
|- | |||
| Object.ChangeSymbol || FromSymbolNumber <br> FromImportedLayer <br> ToSymbolNumber || Double <br> String <br> Double || | |||
|- | |||
| Object.ChangeSymbolSelectedObjects || SymbolNumber || Double <br> || e.g. 101.001 | |||
|- | |||
| Object.MergeObjectsBySymbol|| SymbolNumber || Double <br> || e.g. 101.001 | |||
|} | |||
===Symbol=== | |||
{| class="wikitable" style=" border="1" | |||
|- | |||
! style="width:13em" | Node <OcadScript> | |||
! style="width:12em" | Parameter | |||
! style="width:8em" | Data type | |||
! style="width:34em" | Values / Description | |||
|- | |||
| Symbol.SymbolStatusManager|| FileName <br> SymbolStatusName|| String<br>String || xml file name <br> name of symbol status | |||
|- | |||
| Symbol.ChangeStatus|| SymbolNumber|| double|| e.g. 101.000 <BR> attribute status="visible", "protected" or "hidden" <BR> | |||
<SymbolNumber status="hidden">101.000</SymbolNumber> | |||
|- | |||
|} | |} | ||
Line 66: | Line 126: | ||
| Map.OptimizeRepair|| Enabled|| Boolean || true, false | | Map.OptimizeRepair|| Enabled|| Boolean || true, false | ||
|- | |- | ||
| Map.ChangeScale || NewScale || Integer || e. g. | | Map.ChangeScale || NewScale <br> EnlargeReduceSymbols <br> EnlargeReduceLineWidthOfImageAndGraphicObjects || Integer <br> Boolean <br> Boolean|| e. g. 10000 <br> true, false <br> true, false | ||
|- | |- | ||
| | | Map.ConvertLayer|| CrtFile || String || crt file name | ||
|- | |- | ||
| Map. | | Map.DeleteObjectsBySymbol|| SymbolNumber<BR>SymbolTreeGroupName||Double, String<BR>String|| e.g. 526.002, ObjectsWithoutSymbol <BR> e.g. Streets | ||
|- | |||
| Map.ExportObjectsBySymbol|| File <BR>SymbolNumber<BR>SymbolTreeGroupName||Double<BR>String|| export ocd file name<BR>e.g. 526.002 <BR> e.g. Streets | |||
|- | |- | ||
| Map.LoadSymbolsFrom || File || String || ocd file name (with symbols to be loaded) <br> The option ''replace existing colors and symbols'' is used | | Map.LoadSymbolsFrom || File || String || ocd file name (with symbols to be loaded) <br> The option ''replace existing colors and symbols'' is used | ||
|- | |- | ||
| Map. | | Map.LoadSymbolTreeFrom|| FileName || String|| ocd file name | ||
|- | |||
| Map.ScaleAndCoordinateSystem || MapScale <br> Easting <br> Northing <br> Angle <br> CoordinateSystem|| Integer <br> Integer <br> Integer <br> Double <br> Integer|| e.g. 10000 <br> e.g. 600000 <br> e.g. 200000 <br> e.g. 4.5<br>internal grid id | |||
|- | |||
| Map.Transform.ChangeCoordinateSystem || CoordinateSystem<BR>EastingOffset<BR>NorthingOffset<BR>ScaleSymbols|| Integer<BR>Integer<BR>Integer<BR>Boolean|| internal grid id <BR><BR><BR>true, false | |||
|- | |||
|} | |} | ||
Line 88: | Line 155: | ||
| Database.Dataset.New || DatasetName <br> DBaseFile <br> OdbcDataSource <br> Table <br> KeyField <br> SymbolField <br> TextField <br> SizeField <br> LengthUnit <br> AreaUnit <br> Decimals <br> HorizontalCoordinate <br> VerticalCoordinate <br> Username <br> Passwort || String <br> String <br> String <br> String <br> String <br> String <br> String <br> String <br> String <br> String <br> Integer <br> String <br> String <br> String <br> String || mandatory <br> <br> <br> mandatory <br> mandatory <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> | | Database.Dataset.New || DatasetName <br> DBaseFile <br> OdbcDataSource <br> Table <br> KeyField <br> SymbolField <br> TextField <br> SizeField <br> LengthUnit <br> AreaUnit <br> Decimals <br> HorizontalCoordinate <br> VerticalCoordinate <br> Username <br> Passwort || String <br> String <br> String <br> String <br> String <br> String <br> String <br> String <br> String <br> String <br> Integer <br> String <br> String <br> String <br> String || mandatory <br> <br> <br> mandatory <br> mandatory <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> | ||
|- | |- | ||
| Database.Dataset.Remove || Dataset || String | | Database.Dataset.Remove || Dataset || String <br> Integer || ''all'' for all databases <br> 3, 2, 1, ... for only one or several <br> | ||
|- | |- | ||
| Database.Assign.Symbols || Dataset <br> | | Database.Assign.Symbols || Dataset <br><br> CntFile || String <br> or Integer <br> String || ''all'' for all databases, dataset name <br> or 1, 2, 3... for only one database <br> Condition table file | ||
|- | |- | ||
| Database.Assign.Texts || Dataset <br> | | Database.Assign.Texts || Dataset <br><br> TextField <br>Condition <br>Symbol <br> ReplaceExistingObjects || String <br> or Integer <br> String <br> String <br> String <br> Boolean || ''all'' for all databases, dataset name <br> or 1, 2, 3... for only one database <br> <br> <br>e.g. 101.0, -1 for using existing symbol <br> true, false (Default) | ||
|- | |- | ||
| Database. | | Database.SetObjectDirection || Dataset <br><br> AngleField <br> MathematicalFunction || String <br> or Integer <br> String <br> String || ''all'' for all databases, dataset name <br> or 1, 2, 3... for only one database <br> <br>eg.: *180/3.14159 | ||
|- | |- | ||
| Database.CreateObjects || Dataset <br> SelectSymbol <br> Condition <br> HorizontalCoordinate <br> VerticalCoordinate <br> Unit <br> TextField <br> HorizontalOffset <br> VerticalOffset || Integer <br> Double <br> String <br> String <br> String <br> Enum types <br> String <br> Double <br> Double || 1, 2, 3, ... Number of dataset <br> Symbol numer. ex. 207 | | Database.CreateObjects || Dataset <br> SelectSymbol <br> Condition <br> HorizontalCoordinate <br> VerticalCoordinate <br> Unit <br> TextField <br> HorizontalOffset <br> VerticalOffset || Integer <br> Double <br> String <br> String <br> String <br> Enum types <br> String <br> Double <br> Double || 1, 2, 3, ... Number of dataset <br> Symbol numer. ex. 207.0 <br> SQL String (ex. SYMBOL LIKE 207.0) <br> Database fieldname <br> Database fieldname <br> m, km <br> Database fieldname <br> <br> | ||
|} | |} | ||
Line 106: | Line 173: | ||
! style="width:12em" | Parameter | ! style="width:12em" | Parameter | ||
! style="width:8em" | Data type | ! style="width:8em" | Data type | ||
! style="width: | ! style="width:26em" | Values / Description | ||
|- | |||
| BackgroundMap.Open || FileName <br> Visible <br> VisibleInFavorites <br> Dimm <br> Transparent <br> SpotColor <br> Blockout <br> Infrared|| String <br> Boolean <br> Boolean <br> Integer <br> Boolean <br> String <br> Boolean <br> Integer || <br>true, false; Default = true <br> true, false; Default = true <br> [0..100]; Default = 0 [only works if Blockout is false]<br> true, false; Default = false [only works if Blockout is false]<br> spot color name <br> true, false; Default = false <br> 0=undefined, 1=32bit-infrared, 2=32bit RGB | |||
|- | |||
| BackgroundMap.Visible|| || String|| filename <br> only for already loaded background maps | |||
|- | |- | ||
| BackgroundMap. | | BackgroundMap.Hide|| || String|| filename <br> only for already loaded background maps | ||
|- | |- | ||
| BackgroundMap.Remove|| || String|| ''all'' or filename | | BackgroundMap.Remove|| || String|| ''all'' or filename | ||
|- | |||
| BackgroundMap.Reload a)|| || String|| ''all'' or filename | |||
|} | |} | ||
a): Limited functionality. Not avaiable for all users. | |||
=== Example | ===DEM [[File:Space.PNG]][[File:Mas40px.PNG|This function is available in OCAD Mapping Solution.|link=https://www.ocad.com/en/products/ocad-for-cartography]][[File:Ori40px.PNG|This function is available in OCAD Orienteering.|link=https://www.ocad.com/en/products/ocad-for-orienteering]]=== | ||
Read more about importing Lidar and DTM data on the page [[XML Script Lidar and DTM Import]]. | |||
===WMTS Export [[File:Space.PNG]][[File:Mas40px.PNG|This function is available in OCAD Mapping Solution.|link=https://www.ocad.com/en/products/ocad-for-cartography]][[File:Ori40px.PNG|This function is available in OCAD Orienteering.|link=https://www.ocad.com/en/products/ocad-for-orienteering]]=== | |||
Read more about exporting map tiles for [https://leafletjs.com/ Leaflet] on the page [[XML Script WMTS Export]]. | |||
=== Example === | |||
<PRE> | <PRE> | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
Line 140: | Line 220: | ||
<Database.Assign.Texts> | <Database.Assign.Texts> | ||
<Dataset>all</Dataset> | <Dataset>all</Dataset> | ||
<Condition/> | |||
<TextField>TEXT</TextField> | <TextField>TEXT</TextField> | ||
<Symbol>902.000</Symbol> | <Symbol>902.000</Symbol> | ||
Line 186: | Line 267: | ||
</PRE> | </PRE> | ||
==XML Script | ==XML Script Thematic Maps [[File:Space.PNG]][[File:Mas40px.png|This function is available in OCAD Mapping Solution.|link=https://www.ocad.com/en/products/ocad-for-cartography]]== | ||
{| class="wikitable" style=" border="1" | {| class="wikitable" style=" border="1" | ||
|- | |- | ||
Line 192: | Line 273: | ||
! style="width:12em" | Parameter | ! style="width:12em" | Parameter | ||
! style="width:8em" | Data type | ! style="width:8em" | Data type | ||
! style="width: | ! style="width:21em" | Values / Description | ||
|- | |||
| File.CreateThematicMap | |||
|| <MapTheme> <br> Name <br> StatDataPath <br> StatDataTable <br> StatDataCommonField <br> VisualizeAttributes <br> AttributesValuesType <br> Classify <br> RepresentationFeature <br> GeometryDataPath <br>GeometryDataCommonField <br> JoinType <br> VisualizationMethod <br> VisualizationType <br> <VisualizationProperties> <br> ScalingMode <br> MaxSize <br> MinSize <br> FillColor <br> StrokeColor <br> StrokeMaxWidth <br> StrokeMinWidth <br> DecreaseStroke <br> ShowZeroValue <br> ShowNoData <br> Opacity <br> ThemeLegendTitle <br> </VisualizationProperties> <br> </MapTheme> <br><br> <MapTitleStyle> <br> Color <br> Opacity <br> Font <br> Size <br> isBold <br> isItalic <br> Alignment <br> </MapTitleStyle> <br><br> <LegendTitleStyle> <br> see MapTitleStyle... <br> </LegendTitleStyle><br><br> <LegendTextStyle> <br> see MapTitleStyle... <br> </LegendTextStyle> <br><br> AddScaleBar <br> AddScaleText <br> AdditionalInformationText | |||
|| <br> string <br> string <br> string <br> string <br> string <br> ValueType <br> ClassifyType <br> RepresentationFeatureType <br> string <br> string <br> JoinType <br> VisualizationMethodType <br> VisualizationTypeType <br> <br> ScalingModeType <br> double <br> double <br> FillColor <br> StrokeColor <br> double <br> double <br> boolean <br> boolean <br> boolean <br> integer <br> string <br> <br> <br><br> <br> ColorType <br> integer <br> string <br> double <br> boolean <br> boolean <br> AlignmentType <br> <br><br> <br> ... <br> <br><br> <br> ... <br> <br><br> boolean <br> boolean <br> string | |||
|| <br> Theme name <br> statistic data file path <br> Sheet or table for Excel or Access files <br> Common Id field <br> Attribute(s) to visualize: Ex. 2004 or 2009|2011 <br> absolute, relative <br> yes, no <br> point, line, area <br> Geometry data file path <br> Common Id field <br> see Thematic Map Data Types table <br> see Thematic Map Data Types table <br> see Thematic Map Data Types table <br> <br> see Thematic Map Data Types table <br> max. size in mm <br> min. size in mm <br> fill color: ex. C=84 M=0 Y=128 K=0 <br> stroke color: ex. C=0 M=0 Y=0 K=255 <br> max. stroke width in mm <br> min. stroke width in mm <br> true, false <br> true, false <br> true, false <br> % <br> ThemeLegendTitle <br> <br> <br><br> <br> font color: ex. C=0 M=0 Y=0 K=255 <br> opacity in %<br> font name <br> font size <br> true, false <br> true, false <br> 0=align bottom left <br> <br><br> <br> ... <br> <br><br> <br> ... <br> <br><br> true, false <br> true, false <br> Ex. Coordinate system: Pseudo-Mercator | |||
|} | |||
===Thematic Map Data Types=== | |||
{| class="wikitable" style=" border="1" | |||
|- | |||
! style="width:14em" | Data type | |||
! style="width:28em" | Values | |||
|- | |||
| ValueType || absolute, relative | |||
|- | |||
| ClassifyType || yes, no | |||
|- | |||
| RepresentationFeatureType || point, line, area | |||
|- | |||
| JoinType || 0=KeepAllRecords, 1=KeepOnlyMatchingRecords | |||
|- | |||
| VisualizationMethodType || mProportionalSymbols, vmProportionalLines, vmProportionalArrows, vmGraduatedSymbols, vmGraduatedLines, vmGraduatedArrows, vmChoropleths, vmCharts | |||
|- | |- | ||
| | | VisualizationTypeType || vtProportionalBar, vtProportionalCircle, vtProportionalSquare, vtProportionalLine, vtProportionalArrow, vtGraduatedBar, vtGraduatedCircle, vtGraduatedSquare, vtGraduatedLine, vtGraduatedArrow, vtChoropleth, vtPieChart, vtWingChart, vtBarChart, vtDividedPieChart, vtDividedWingChart, vtDividedBarChart, vtStackedBarChart, vtPercentageStackedBarChart | ||
|- | |- | ||
| | | ScalingModeType || 0=scaling by representation ratio, 1=scaling by max. size | ||
|- | |- | ||
| | | DataClassificationMethodType|| cmManual, cmNaturalBreaks, cmEqualIntervals, cmQuantiles | ||
|- | |- | ||
| | | ColorType || CMYK color definition [0..255]: C=84 M=0 Y=128 K=0 | ||
|} | |} | ||
=== Thematic Map Script Examples === | |||
The following example creates a '''thematic map''' with proportional squares about the population in europe 2011. | |||
<PRE> | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<OcadScript> | |||
<OcadVersion>OCAD 2018 - Mapping Solution 32-bit</OcadVersion> | |||
<File.New> | |||
<File>Thematic Map.ocd</File> | |||
<MapScale>25000000</MapScale> | |||
</File.New> | |||
<File.SaveAs> | |||
<File>Thematic Map Population Europe ProportionalSquare.ocd</File> | |||
</File.SaveAs> | |||
<File.CreateThematicMap> | |||
<MapTheme> | |||
<Name>Population 2011</Name> | |||
<StatDataPath>C:\import\population.xls</StatDataPath> | |||
<StatDataTable>Sheet0$</StatDataTable> | |||
<StatDataCommonField>id</StatDataCommonField> | |||
<VisualizeAttributes>2011</VisualizeAttributes> | |||
<AttributesValuesType>absolute</AttributesValuesType> | |||
<Classify>no</Classify> | |||
<RepresentationFeature>point</RepresentationFeature> | |||
<GeometryDataPath>C:\import\europe.shp</GeometryDataPath> | |||
<GeometryDataCommonField>ne_10m_adm</GeometryDataCommonField> | |||
<JoinType>0</JoinType> | |||
<VisualizationMethod>vmProportionalSymbols</VisualizationMethod> | |||
<VisualizationType>vtProportionalSquare</VisualizationType> | |||
<VisualizationProperties> | |||
<ScalingMode>1</ScalingMode> | |||
<MaxSize>30.00</MaxSize> | |||
<MinSize>1.00</MinSize> | |||
<FillColor>C=84 M=0 Y=128 K=0</FillColor> | |||
<StrokeColor>C=0 M=0 Y=0 K=181</StrokeColor> | |||
<StrokeMaxWidth>0.40</StrokeMaxWidth> | |||
<StrokeMinWidth>0.08</StrokeMinWidth> | |||
<DecreaseStroke>true</DecreaseStroke> | |||
<ShowZeroValue>true</ShowZeroValue> | |||
<ShowNoData>true</ShowNoData> | |||
<Opacity>80</Opacity> | |||
<ThemeLegendTitle>Population</ThemeLegendTitle> | |||
</VisualizationProperties> | |||
</MapTheme> | |||
<MapTitle>Population in Europe 2011</MapTitle> | |||
<DefaultTextStyle> | |||
<Color>C=0 M=0 Y=0 K=150</Color> | |||
<Opacity>100</Opacity> | |||
<Font>Arial</Font> | |||
<Size>9.0</Size> | |||
<isBold>0</isBold> | |||
<isItalic>0</isItalic> | |||
<Alignment>0</Alignment> | |||
</DefaultTextStyle> | |||
<MapTitleStyle> | |||
<Opacity>80</Opacity> | |||
<Size>24.00</Size> | |||
<Alignment>1</Alignment> | |||
</MapTitleStyle> | |||
<AddThemeLegend>true</AddThemeLegend> | |||
<AddBasemapLegend>true</AddBasemapLegend> | |||
<LegendTitleStyle> | |||
<Size>12.0</Size> | |||
</LegendTitleStyle> | |||
<LegendTextStyle> | |||
<Size>9.0</Size> | |||
</LegendTextStyle> | |||
<AddScaleBar>true</AddScaleBar> | |||
<AddScaleText>true</AddScaleText> | |||
<AdditionalInformationText>OCAD ThematicMapper sample map</AdditionalInformationText> | |||
</File.CreateThematicMap> | |||
<File.Save> | |||
<Enabled>true</Enabled> | |||
</File.Save> | |||
</OcadScript> | |||
</PRE> | |||
==XML Script Partial Map== | |||
{| class="wikitable" style=" border="1" | |||
|- | |||
! style="width:13em" | Node <OcadScript> | |||
! style="width:12em" | Parameter | |||
! style="width:8em" | Data type | |||
! style="width:50em" | Values / Description | |||
|- | |||
| Export || File <br><br> coordSystem <br> L, R, B, T|| String <br><br> Enum types <br> Float|| eg.: ‚ c:\export\PartialMap1.ocd ‘ <br> OCAD creates files PartialMap1_#verticalPages_#horizontalPages.ocd <br> mm (paper, m (real world) <br> left, right, bottom, top | |||
|- | |||
| Export.loop || Enabled <br> HorizontalPages <br> VerticalPages <br> HorizontalOverlap <br> VerticalOverlap || Bool <br> Integer <br> Integer <br> Float <br> Float || true, false <br> number of pages in horizontal direction <br> number of pages in vertical direction <br> horizontal overlap in [mm] or [m] <br> vertical overlap in [mm] or [m] | |||
|} | |||
<ocadScript> | === Example === | ||
The following example exports parts of an ocad map. <br> | |||
<PRE> | |||
<ocadScript> // comment | |||
<partialMapScript> | |||
<export id="0"> // first export section | |||
<file>c:\export\PartialMap1.ocd</file> // export file | |||
<coordSystem>mm</coordSystem> // paper oder real world coordinates | |||
<T>100</T> // export rectangle with Top Left point and Bottom Right point | |||
<loop> | <L>0</L> | ||
<B>50</B> | |||
<R>50</R> | |||
<loop> // the loop export several ocd files. For this example 21 files. | |||
<enabled>true</enabled> | |||
<horizontalPages>7</horizontalPages> | |||
<verticalPages>3</verticalPages> | |||
<horizontalOverlap>10</horizontalOverlap> // horizontal and vertical overlap. | |||
<verticalOverlap>10</verticalOverlap> | |||
</loop> | |||
</export> | </export> | ||
<export id="1"> // second export section | |||
<file>c:\export\PartialMap2.ocd</file> | |||
<coordSystem>mm</coordSystem> | |||
<L>0</L> | |||
<R>50</R> | |||
<B>50</B> | |||
<T>100</T> | |||
<loop> // export only one ocd file | |||
<enabled>false</enabled> | |||
</loop> | |||
</export><br> | |||
</partialMapScript> | </partialMapScript> | ||
</ocadScript> | </ocadScript> | ||
</PRE> | |||
==XML Script Print== | ==XML Script Print== | ||
Line 248: | Line 448: | ||
! style="width:19em" | Values / Description | ! style="width:19em" | Values / Description | ||
|- | |- | ||
| File.Print.Printer || Name <br> DmPaperSize <br> DmDefaultSource <br> DmPrintQuality <br> DmColor <br> DmMediaType || String <br> Integer <br> Integer <br> Integer <br> Integer <br> Integer || Eg. ,HP Color LaserJet 2840 PCL' <br> | | File.Print.Printer || Name <br> DmPaperSize <br> DmDefaultSource <br> DmPrintQuality <br> DmColor <br> DmMediaType || String <br> Integer <br> Integer <br> Integer <br> Integer <br> Integer || Eg. ,HP Color LaserJet 2840 PCL' <br> File->Print->Save XML Script->Open the Script and depending on which printer was choosen, the informations are there. | ||
|- | |- | ||
| File.Print.Portrait || Enabled || Bool || true, false | | File.Print.Portrait || Enabled || Bool || true, false | ||
|- | |- | ||
| File.Print.SpotColor || Enabled || Bool || true, false | | File.Print.SpotColor || Enabled <br> Colors|| Bool <br> String|| true, false <br> Name of the spot color(s) | ||
|- | |- | ||
| File.Print. | | File.Print.PartOfMap || Range <br> Coordinates <br> L, R, B, T || Integer <br> Enum types<br> Float || 1 <br> mm (page), m (real world) <br> Left, Right, Bottom, Top | ||
|- | |- | ||
| File.Print.HorizontalOverlap || || Float || | | File.Print.HorizontalOverlap || || Float || | ||
|- | |- | ||
| File.Print.VerticalOverlap || || Float || | | File.Print.VerticalOverlap || || Float || | ||
|- | |- | ||
| File.Print.PrintScale || || Integer || Eg. 25000 | | File.Print.PrintScale || || Integer || Eg. 25000 | ||
Line 268: | Line 468: | ||
| File.Print.LineWidth || || Integer || | | File.Print.LineWidth || || Integer || | ||
|- | |- | ||
| File.Print.PrintScreenGrid || Enabled || Bool || true, false | | File.Print.PrintScreenGrid || Enabled <br> PrintScreenGridColor || Bool <br> Integer || true, false <br> Ocad color number | ||
|} | |} | ||
==XML Script Export== | ==XML Script Export== | ||
Watch out for the file endings. <br> Resolution is only used if File.Export.GeoRef -> Enabled = false | |||
===AI (Adobe Illustrator), PDF=== | ===AI (Adobe Illustrator), PDF=== | ||
Line 282: | Line 482: | ||
! style="width:12em" | Parameter | ! style="width:12em" | Parameter | ||
! style="width:8em" | Data type | ! style="width:8em" | Data type | ||
! style="width: | ! style="width:20em" | Values / Description | ||
|- | |- | ||
| File.Export || Format|| Enum types || AI, PDF | | File.Export || File <br> Format <br> Resolution <br><br> ExportScale|| String <br> Enum types <br> Integer <br><br> Integer|| eg.: ,c::\Export\Chlosterwald.ai‘ <br> AI, PDF <br> in dpi [40..2540] (only if the map has raster background maps) <br> eg. '10000' for the scale 1:10'000 | ||
|- | |- | ||
| File.Export.PartOfMap || Enabled <br> Coordinates <br> L, R, B, T || Bool <br> Enum types <br> Float || true, false <br> mm (page), m (real world) <br>left, right, bottom, top | | File.Export.PartOfMap || Enabled <br> Coordinates <br> L, R, B, T || Bool <br> Enum types <br> Float || true, false <br> mm (page), m (real world) <br>left, right, bottom, top | ||
|- | |- | ||
| File.Export || Colors || Enum types || normal, spotColors | | File.Export || Colors || Enum types || normal, spotColors | ||
|- | |- | ||
| File.Export.SpotColors || Combine || Bool || true, false [only if Colors = spotColors] | | File.Export.SpotColors || Combine <br> Enabled|| Bool <br> String|| true, false [only if Colors = spotColors] <br> Spotcolor name [only if Colors = spotColors] | ||
|} | |} | ||
===BMP, GIF, JPEG=== | ===BMP, GIF, JPEG, PNG=== | ||
{| class="wikitable" style=" border="1" | {| class="wikitable" style=" border="1" | ||
Line 308: | Line 502: | ||
! style="width:19em" | Values / Description | ! style="width:19em" | Values / Description | ||
|- | |- | ||
| File.Export || File || String || eg.: ‚c:\Export\Chlosterwald.bmp‘ | | File.Export || File <br> Format <br> Quality <br> Resolution <br> Anti-Aliasing <br> ColorCorrection|| String <br> Enum types <br> Integer <br> Integer <br> Boolean <br> Boolean|| eg.: ‚c:\Export\Chlosterwald.bmp‘ <br> BMP, GIF, JPEG, PNG <br> only for JPEG, [0..100] <br> in dpi [40..2540] <br> true, false <br> true, false | ||
|- | |- | ||
| File.Export.PartOfMap || Enabled <br> Coordinates <br> L, R, B, T <br><br><br>|| Bool <br> Enum types <br> Float <br><br><br>|| true, false <br> mm (page), m (real world) <br>left, right, bottom, top <br> for rotated maps use here the coordinate of the upper left und lower right corner | |||
| File.Export.PartOfMap || Enabled <br> Coordinates <br> L, R, B, T || Bool <br> Enum types <br> Float || true, false <br> mm (page), m (real world) <br>left, right, bottom, top | |||
|- | |- | ||
| File.Export.Tiles || Enabled <br> Width <br> Height || Boolean <br> Integer <br> Integer || true, false <br> [only if Enabled = true] <br> [only if Enabled = true] | | File.Export.Tiles || Enabled <br> Width <br> Height || Boolean <br> Integer <br> Integer || true, false <br> [only if Enabled = true] <br> [only if Enabled = true] | ||
Line 336: | Line 520: | ||
! style="width:19em" | Values / Description | ! style="width:19em" | Values / Description | ||
|- | |- | ||
| File.Export || File || String || eg.: ‚c:\Export\Chlosterwald.eps ‘ | | File.Export || File <br> Format <br> ExportScale|| String <br> Enum types <br> Integer|| eg.: ‚c:\Export\Chlosterwald.eps ‘ <br> EPS <br> e.g. '10000' for the scale 1:10'000 | ||
|- | |- | ||
| File.Export.PartOfMap || Enabled <br> Coordinates <br>L, R, B, T || Bool <br> Enum types <br> Float || true, false <br> mm (page), m (real world) <br>left, right, bottom, top | | File.Export.PartOfMap || Enabled <br> Coordinates <br>L, R, B, T || Bool <br> Enum types <br> Float || true, false <br> mm (page), m (real world) <br>left, right, bottom, top | ||
Line 356: | Line 538: | ||
! style="width:19em" | Values / Description | ! style="width:19em" | Values / Description | ||
|- | |- | ||
| File.Export || File || String || eg.: ‚c:\Export\Chlosterwald.svg ‘ | | File.Export || File <br> Format <br> ExportScale <br> CompressFile|| String <br> Enum types <br> Integer <br> Boolean|| eg.: ‚c:\Export\Chlosterwald.svg ‘ <br> SVG <br> e.g. '10000' for the scale 1:10'000 <br> true, false | ||
|- | |- | ||
| File.Export.PartOfMap || Enabled <br> Coordinates <br>L, R, B, T || Bool <br> Enum types <br> Float || true, false <br> mm (page), m (real world) <br>left, right, bottom, top | | File.Export.PartOfMap || Enabled <br> Coordinates <br>L, R, B, T || Bool <br> Enum types <br> Float || true, false <br> mm (page), m (real world) <br>left, right, bottom, top | ||
|} | |} | ||
Line 374: | Line 550: | ||
! style="width:12em" | Parameter | ! style="width:12em" | Parameter | ||
! style="width:8em" | Data type | ! style="width:8em" | Data type | ||
! style="width: | ! style="width:20em" | Values / Description | ||
|- | |- | ||
|File.Export || File || String || eg.: ‚c:\Export\Chlosterwald.tif‘ <br> | |File.Export || File <br> Format <br> Resolution <br> Anti-Aliasing <br> ColorCorrection|| String <br> Enum types <br> Integer <br> Boolean <br> Boolean|| eg.: ‚c:\Export\Chlosterwald.tif‘ <br> TIFF <br> in dpi [40..2540] <br> true, false <br> true, false | ||
|- | |- | ||
| File.Export.PartOfMap || Enabled <br> Coordinates <br>L, R, B, T || Bool <br> Enum types <br> Float || true, false <br> mm (page), m (real world) <br>left, right, bottom, top | | File.Export.PartOfMap || Enabled <br> Coordinates <br>L, R, B, T || Bool <br> Enum types <br> Float || true, false <br> mm (page), m (real world) <br>left, right, bottom, top | ||
Line 390: | Line 558: | ||
|File.Export.Tiles || Enabled <br> Width <br> Height || Bool <br> Integer <br> Integer || true, false <br> [only if Enabled = true] <br> [only if Enabled = true] | |File.Export.Tiles || Enabled <br> Width <br> Height || Bool <br> Integer <br> Integer || true, false <br> [only if Enabled = true] <br> [only if Enabled = true] | ||
|- | |- | ||
|File.Export.GeoRef|| Enabled <br> PixelSize <br> CreateWorldFile || Bool <br> Float <br> Bool ||true | |File.Export.GeoRef|| Enabled <br> PixelSize <br> CreateWorldFile || Bool <br> Float <br> Bool ||true, false <br> in meter [only if Enabled = true] <br> true, false [only if Enabled = true] | ||
|- | |- | ||
| File.Export || Colors || Enum types || normal, spotColors | | File.Export || Colors || Enum types || normal, spotColors | ||
Line 396: | Line 564: | ||
| File.Export.SpotColors || Combine<br>Enabled || Bool<br>Spotcolor name || true, false [only if Colors = spotColors]<br>[only if Colors = spotColors] | | File.Export.SpotColors || Combine<br>Enabled || Bool<br>Spotcolor name || true, false [only if Colors = spotColors]<br>[only if Colors = spotColors] | ||
|- | |- | ||
|File.Export || ColorMode || Integer || 0 = 32 bit CMYK <br> 1 = 24 bit RGB <br> 2 = 256 colors <br> 3 = grayscale <br> 4 = 8 bit CMYK<br> 5 = 1 bit black/white <br> 6 = halftone screen | |File.Export || ColorMode || Integer || 0 = 32 bit CMYK <br> 1 = 24 bit RGB <br> 2 = 256 colors <br> 3 = grayscale <br> 4 = 8 bit CMYK<br> 5 = 1 bit black/white <br> 6 = halftone screen [only if spotColor = true] | ||
|- | |- | ||
|File.Export || Compression || Integer || 1 = no compression <br> 2 = CCITT <br> 4 = FaxG4 <br> 5 = LZW | |File.Export || Compression || Integer || 1 = no compression <br> 2 = CCITT [only used with ColorMode 5/6] <br> 4 = FaxG4 [only used with ColorMode 5/6] <br> 5 = LZW | ||
|} | |} | ||
Line 410: | Line 578: | ||
! style="width:19em" | Values / Description | ! style="width:19em" | Values / Description | ||
|- | |- | ||
| File.Export || File || String || eg.: ‚c:\Export\Chlosterwald.dxf ‘ | | File.Export || File <br> Format <br> ExportScale <br> ConvertAnsiToOem <br> ConvertOemToUnicode <br> ObjectsSelectedSymbols <br> AddSymbolDescription <br> UseCrtFileName <br> ExportAsSplines <br> Coordinates || String <br> Enum types <br> Integer <br> Boolean <br> Boolean <br> Boolean <br> Boolean <br> String <br> Boolean <br> Enum types|| eg.: ‚c:\Export\Chlosterwald.dxf ‘ <br> DXF <br> e.g. '10000' for the scale 1:10'000 <br> true, false <br> true, false <br> true, false <br> true, false <br> eg.: ‚c:\CRT\Chlosterwald.ocdCrt‘ <br> true, false <br> m, mm | ||
|} | |} | ||
Line 438: | Line 588: | ||
! style="width:12em" | Parameter | ! style="width:12em" | Parameter | ||
! style="width:8em" | Data type | ! style="width:8em" | Data type | ||
! style="width: | ! style="width:25em" | Values / Description | ||
|- | |- | ||
| File.Export || ExportPath || String || eg.: ‚c:\Export‘ (only path name) | | File.Export | ||
|| ExportPath <br> File <br> <br> Format <br> PointObjects<br>LineObjects<br>AreaObjects<br>TextObjects<br>EnvelopePolygonFromTextObjects<br> Dataset <br> WordWrap <br> ProjectionFile <br> Utf8Encoding | |||
|| String <br> String <br> <br> Enum types <br> Boolean <br> Boolean <br> Boolean <br> Boolean <br> Boolean <br> String <br> Boolean <br> Boolean <br> Boolean | |||
|| eg.: ‚c:\Export‘ (only path name) <br> eg.: ‚c:\Export\test.shp‘ (using ExportPath OR File, not both) <br> SHAPE <br> true, false <br> true, false <br> true, false <br> true, false <br> true, false <br> 'all' for all databases or dataset name<br> true, false <br> true, false <br> true, false | |||
|} | |} | ||
Line 461: | Line 602: | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
<OcadScript> | <OcadScript><br> | ||
<File.Open> | <File.Open> | ||
<File>M:\ | <File>M:\OCAD2018\Changes\11-06xx\11-0663\Chlosterwald.ocd</File> | ||
</File.Open> | </File.Open><br> | ||
<File.Export> | <File.Export> //PDF export | ||
<File>M:\ | <File>M:\OCAD2018\Changes\11-06xx\11-0663\output\Chlosterwald.pdf</File> | ||
<Format>PDF</Format> | <Format>PDF</Format> | ||
<PartOfMap> | <PartOfMap> | ||
Line 473: | Line 614: | ||
<L>0</L> | <L>0</L> | ||
<R>50</R> | <R>50</R> | ||
<B>50</B> | |||
<T>100</T> | <T>100</T> | ||
</PartOfMap> | </PartOfMap> | ||
Line 483: | Line 624: | ||
<Enabled>Gelb</Enabled> | <Enabled>Gelb</Enabled> | ||
</SpotColors> | </SpotColors> | ||
</File.Export> | </File.Export> | ||
<File.Export> | |||
<ExportPath>M:\ | <File.Export> //Shape export | ||
<ExportPath>M:\OCAD2018\Changes\11-06xx\11-0663\output\</ExportPath> | |||
<Format>SHAPE</Format> | <Format>SHAPE</Format> | ||
<PointObjects>false</PointObjects> | <PointObjects>false</PointObjects> | ||
Line 491: | Line 633: | ||
<AreaObjects>true</AreaObjects> | <AreaObjects>true</AreaObjects> | ||
<TextObjects>false</TextObjects> | <TextObjects>false</TextObjects> | ||
<EnvelopePolygonFromTextObjects>false</EnvelopePolygonFromTextObjects> | |||
<Dataset>all</Dataset> | <Dataset>all</Dataset> | ||
<WordWrap>true</WordWrap> | <WordWrap>true</WordWrap> | ||
<ProjectionFile>false</ProjectionFile> | <ProjectionFile>false</ProjectionFile> | ||
</File.Export> | </File.Export><br> | ||
<File.Save> | <File.Save> | ||
<Enabled>true</Enabled> | <Enabled>true</Enabled> | ||
</File.Save> | </File.Save><br> | ||
<File.Close> | <File.Close> | ||
<Enabled>true</Enabled> | <Enabled>true</Enabled> | ||
</File.Close> | </File.Close> | ||
</OcadScript> | </OcadScript> | ||
==Run XML Script from the Command Line== | ==Run XML Script from the Command Line== | ||
Line 508: | Line 651: | ||
Open the Windows command and enter the OCAD program name and the xml script file. | Open the Windows command and enter the OCAD program name and the xml script file. | ||
For example: "C:\Program Files\OCAD\OCAD | For example: | ||
"C:\Program Files\OCAD\OCAD 2018\Ocad2018.exe" "C:\Data\ExportScriptExample_PDF.xml" | |||
Use the parameter ''/NewInstance'' to always create new OCAD instance. | |||
For example: | |||
"C:\Program Files\OCAD\OCAD 2018\Ocad2018.exe" /NewInstance "C:\Data\ExportScriptExample_PDF.xml" | |||
Do not forget to use the parameter <File.Open> to open the file, <File.Close> to close it and <File.Exit> to close OCAD. | Do not forget to use the parameter <File.Open> to open the file, <File.Close> to close it and <File.Exit> to close OCAD. | ||
==Open ocd File from the Command Line== | ==Open ocd File from the Command Line== | ||
It is possible to open an ocd file from the command line with optional view parameters. | It is possible to open an ocd file from the command line with optional view parameters. | ||
Line 518: | Line 670: | ||
For example: | For example: | ||
"C:\Program Files\OCAD\OCAD | "C:\Program Files\OCAD\OCAD 2018\Ocad2018.exe" "M:\Data\Map.ocd" | ||
Additional OCAD supports the following optional view parameters to open an map at desired postion and view scale. | Additional OCAD supports the following optional view parameters to open an map at desired postion and view scale. | ||
Line 527: | Line 679: | ||
For example: | For example: | ||
"C:\Program Files\OCAD\OCAD | "C:\Program Files\OCAD\OCAD 2018\Ocad2018.exe" -c 710000,231000 -s 2500 "M:\Data\Map.ocd" | ||
---- | |||
Back to [[Main Page]] | Back to [[Main Page]] |
Latest revision as of 22:31, 18 January 2024
Choose this command to execute functions whose settings are defined in a XML file.
Note: Most parameters can only be used in the Mapping Solution Edition. In the Orienteering Edition, XML Script can be used for Lidar Import, DTM Import and WMTS Export.
Introduction
Select Execute XML Script from File menu or drag-and-drop then xml file to the OCAD window.
OCAD creates a log file in the temporary folder (C:\Users\USERNAME\AppData\Roaming\OCAD\OCAD 20xx\Tmp).
XML Script General
File
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.New | File MapScale |
String Integer |
file name of existing symbol set 10000 obsolete, use Map.ScaleAndCoordinateSystem obsolete, use Map.ScaleAndCoordinateSystem obsolete, use Map.ScaleAndCoordinateSystem |
File.Open | File IgnoreMissingBackgroundMaps IgnoreMissingDatasets |
String Boolean Boolean |
ocd file name true, false (default: false) true, false (default: false) |
File.Close | Enabled | Boolean | true, false |
File.Save | Enabled | Boolean | true, false |
File.SaveAs | File | String | ocd file name |
File.Import.Ocd | File Directory SymbolOption ColorOption |
String String Integer Integer |
File name [0..3] [0, 1] |
File.Import.Dxf | Directory NewOffset HorizontalOffset VerticalOffset Angle MapScale |
String Boolean Integer Integer Double Integer |
Directory name ignored if NewOffset = false ignored if NewOffset = false ignored if NewOffset = false ignored if NewOffset = false |
File.Import.GeoPackage | GpkgFilename TableName Layer CrtFilename |
String String String String |
|
File.MultipleFileImport | Directory SearchPattern CoordinateSystem NewOffset Horizontally Vertically Angle MapScale GridDistance DatabaseType Codepage KeyField LayerField LayerField2 ExtentMinimumEasting ExtentMaximumEasting ExtentMinimumNorthing ExtentMaximumNorthing |
String String Integer Boolean Integer Integer Double Integer Double Integer Integer String String String Double Double Double Double |
Directory of import files, e.g. C:\Shape\ optional, e.g. SV*.shp Internal Grid ID |1000 = existing grid of OCAD file, -1 = WGS 84, 0 = dBase, 1 = Access 2007, 2 = Access 2003/2010, 3 = Do not create a database 0 = Default, Codepage number ' ' = Create new key field, field name ' ' = do not import layer information, field name ' ' = do not import 2nd layer information, field name, LayerField and LayerField2 content are concatenated by '_' |
File.Exit | Enabled | Boolean | true, false |
View
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
View.Mode | Enum types | normalMode, spotColorMode, draftMode | |
View.EntireMap | Enabled | Boolean | true, false |
View.MoveTo | X Y |
Double Double |
|
View.Zoom | Double |
Select
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
Select.ObjectsBySymbol | SymbolNumber | Double | e.g. 526.002 |
Select.ObjectsBySymbol | use <Select.ObjectsBySymbol></Select.ObjectsBySymbol> to clear the selection |
Object
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
Object.ChangeVertexTypesTo | Type | Enum types | CornerVertex, DashVertex |
Object.Fill | SymbolNumber | Double | |
Object.ChangeSymbol | FromSymbolNumber FromImportedLayer ToSymbolNumber |
Double String Double |
|
Object.ChangeSymbolSelectedObjects | SymbolNumber | Double |
e.g. 101.001 |
Object.MergeObjectsBySymbol | SymbolNumber | Double |
e.g. 101.001 |
Symbol
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
Symbol.SymbolStatusManager | FileName SymbolStatusName |
String String |
xml file name name of symbol status |
Symbol.ChangeStatus | SymbolNumber | double | e.g. 101.000 attribute status="visible", "protected" or "hidden" <SymbolNumber status="hidden">101.000</SymbolNumber> |
Map
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
Map.OptimizeRepair | Enabled | Boolean | true, false |
Map.ChangeScale | NewScale EnlargeReduceSymbols EnlargeReduceLineWidthOfImageAndGraphicObjects |
Integer Boolean Boolean |
e. g. 10000 true, false true, false |
Map.ConvertLayer | CrtFile | String | crt file name |
Map.DeleteObjectsBySymbol | SymbolNumber SymbolTreeGroupName |
Double, String String |
e.g. 526.002, ObjectsWithoutSymbol e.g. Streets |
Map.ExportObjectsBySymbol | File SymbolNumber SymbolTreeGroupName |
Double String |
export ocd file name e.g. 526.002 e.g. Streets |
Map.LoadSymbolsFrom | File | String | ocd file name (with symbols to be loaded) The option replace existing colors and symbols is used |
Map.LoadSymbolTreeFrom | FileName | String | ocd file name |
Map.ScaleAndCoordinateSystem | MapScale Easting Northing Angle CoordinateSystem |
Integer Integer Integer Double Integer |
e.g. 10000 e.g. 600000 e.g. 200000 e.g. 4.5 internal grid id |
Map.Transform.ChangeCoordinateSystem | CoordinateSystem EastingOffset NorthingOffset ScaleSymbols |
Integer Integer Integer Boolean |
internal grid id true, false |
Database
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
Database.Dataset.New | DatasetName DBaseFile OdbcDataSource Table KeyField SymbolField TextField SizeField LengthUnit AreaUnit Decimals HorizontalCoordinate VerticalCoordinate Username Passwort |
String String String String String String String String String String Integer String String String String |
mandatory mandatory mandatory |
Database.Dataset.Remove | Dataset | String Integer |
all for all databases 3, 2, 1, ... for only one or several |
Database.Assign.Symbols | Dataset CntFile |
String or Integer String |
all for all databases, dataset name or 1, 2, 3... for only one database Condition table file |
Database.Assign.Texts | Dataset TextField Condition Symbol ReplaceExistingObjects |
String or Integer String String String Boolean |
all for all databases, dataset name or 1, 2, 3... for only one database e.g. 101.0, -1 for using existing symbol true, false (Default) |
Database.SetObjectDirection | Dataset AngleField MathematicalFunction |
String or Integer String String |
all for all databases, dataset name or 1, 2, 3... for only one database eg.: *180/3.14159 |
Database.CreateObjects | Dataset SelectSymbol Condition HorizontalCoordinate VerticalCoordinate Unit TextField HorizontalOffset VerticalOffset |
Integer Double String String String Enum types String Double Double |
1, 2, 3, ... Number of dataset Symbol numer. ex. 207.0 SQL String (ex. SYMBOL LIKE 207.0) Database fieldname Database fieldname m, km Database fieldname |
Background Map
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
BackgroundMap.Open | FileName Visible VisibleInFavorites Dimm Transparent SpotColor Blockout Infrared |
String Boolean Boolean Integer Boolean String Boolean Integer |
true, false; Default = true true, false; Default = true [0..100]; Default = 0 [only works if Blockout is false] true, false; Default = false [only works if Blockout is false] spot color name true, false; Default = false 0=undefined, 1=32bit-infrared, 2=32bit RGB |
BackgroundMap.Visible | String | filename only for already loaded background maps | |
BackgroundMap.Hide | String | filename only for already loaded background maps | |
BackgroundMap.Remove | String | all or filename | |
BackgroundMap.Reload a) | String | all or filename |
a): Limited functionality. Not avaiable for all users.
DEM ![Space.PNG](/wiki/ocad/en/images/a/a3/Space.PNG)
![This function is available in OCAD Mapping Solution.](/wiki/ocad/en/images/1/18/Mas40px.PNG)
![This function is available in OCAD Orienteering.](/wiki/ocad/en/images/2/29/Ori40px.PNG)
Read more about importing Lidar and DTM data on the page XML Script Lidar and DTM Import.
WMTS Export ![Space.PNG](/wiki/ocad/en/images/a/a3/Space.PNG)
![This function is available in OCAD Mapping Solution.](/wiki/ocad/en/images/1/18/Mas40px.PNG)
![This function is available in OCAD Orienteering.](/wiki/ocad/en/images/2/29/Ori40px.PNG)
Read more about exporting map tiles for Leaflet on the page XML Script WMTS Export.
Example
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- OCAD XML Script for multiple Shape import and assigning symbols from database --> <OcadScript> <File.New> <!-- This path has to be adjusted before using the script! Choose a template file. --> <File>C:\Export\Chlosterwald.ocd</File> </File.New> <File.MultipleFileImport> <!-- This path has to be adjusted before using the script! --> <Directory>C:\Export\Files</Directory> <CoordinateSystem>1000</CoordinateSystem> <NewOffset>true</NewOffset> <Horizontally>600000</Horizontally> <Vertically>200000</Vertically> <Angle>0</Angle> <MapScale>10000</MapScale> <GridDistance>500</GridDistance> <LayerField>OBJECTVAL</LayerField> </File.MultipleFileImport> <Database.Assign.Texts> <Dataset>all</Dataset> <Condition/> <TextField>TEXT</TextField> <Symbol>902.000</Symbol> <ReplaceExistingObjects>false</ReplaceExistingObjects> </Database.Assign.Texts> <Database.Assign.Angles> <Dataset>all</Dataset> <AngleField>ANGLE</AngleField> </Database.Assign.Angles> <Database.Assign.Symbols> <Dataset>all</Dataset> <CntFile>C:\Export\Chlosterwald.cnt</CntFile> </Database.Assign.Symbols> <Database.Dataset.Remove> <Dataset>all</Dataset> </Database.Dataset.Remove> <Map.OptimizeRepair> <Enabled>true</Enabled> </Map.OptimizeRepair> <View.EntireMap> <Enabled>true</Enabled> </View.EntireMap> <File.Save> <Enabled>false</Enabled> </File.Save> <File.SaveAs> <File>C:\Export\Chlosterwald_Example.ocd</File> </File.SaveAs> <File.Close> <Enabled>true</Enabled> </File.Close> <File.Exit> <Enabled>false</Enabled> </File.Exit> </OcadScript>
XML Script Thematic Maps ![Space.PNG](/wiki/ocad/en/images/a/a3/Space.PNG)
![This function is available in OCAD Mapping Solution.](/wiki/ocad/en/images/9/94/Mas40px.png)
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.CreateThematicMap | <MapTheme> Name StatDataPath StatDataTable StatDataCommonField VisualizeAttributes AttributesValuesType Classify RepresentationFeature GeometryDataPath GeometryDataCommonField JoinType VisualizationMethod VisualizationType <VisualizationProperties> ScalingMode MaxSize MinSize FillColor StrokeColor StrokeMaxWidth StrokeMinWidth DecreaseStroke ShowZeroValue ShowNoData Opacity ThemeLegendTitle </VisualizationProperties> </MapTheme> <MapTitleStyle> Color Opacity Font Size isBold isItalic Alignment </MapTitleStyle> <LegendTitleStyle> see MapTitleStyle... </LegendTitleStyle> <LegendTextStyle> see MapTitleStyle... </LegendTextStyle> AddScaleBar AddScaleText AdditionalInformationText |
string string string string string ValueType ClassifyType RepresentationFeatureType string string JoinType VisualizationMethodType VisualizationTypeType ScalingModeType double double FillColor StrokeColor double double boolean boolean boolean integer string ColorType integer string double boolean boolean AlignmentType ... ... boolean boolean string |
Theme name statistic data file path Sheet or table for Excel or Access files Common Id field Attribute(s) to visualize: Ex. 2004 or 2009|2011 absolute, relative yes, no point, line, area Geometry data file path Common Id field see Thematic Map Data Types table see Thematic Map Data Types table see Thematic Map Data Types table see Thematic Map Data Types table max. size in mm min. size in mm fill color: ex. C=84 M=0 Y=128 K=0 stroke color: ex. C=0 M=0 Y=0 K=255 max. stroke width in mm min. stroke width in mm true, false true, false true, false % ThemeLegendTitle font color: ex. C=0 M=0 Y=0 K=255 opacity in % font name font size true, false true, false 0=align bottom left ... ... true, false true, false Ex. Coordinate system: Pseudo-Mercator |
Thematic Map Data Types
Data type | Values |
---|---|
ValueType | absolute, relative |
ClassifyType | yes, no |
RepresentationFeatureType | point, line, area |
JoinType | 0=KeepAllRecords, 1=KeepOnlyMatchingRecords |
VisualizationMethodType | mProportionalSymbols, vmProportionalLines, vmProportionalArrows, vmGraduatedSymbols, vmGraduatedLines, vmGraduatedArrows, vmChoropleths, vmCharts |
VisualizationTypeType | vtProportionalBar, vtProportionalCircle, vtProportionalSquare, vtProportionalLine, vtProportionalArrow, vtGraduatedBar, vtGraduatedCircle, vtGraduatedSquare, vtGraduatedLine, vtGraduatedArrow, vtChoropleth, vtPieChart, vtWingChart, vtBarChart, vtDividedPieChart, vtDividedWingChart, vtDividedBarChart, vtStackedBarChart, vtPercentageStackedBarChart |
ScalingModeType | 0=scaling by representation ratio, 1=scaling by max. size |
DataClassificationMethodType | cmManual, cmNaturalBreaks, cmEqualIntervals, cmQuantiles |
ColorType | CMYK color definition [0..255]: C=84 M=0 Y=128 K=0 |
Thematic Map Script Examples
The following example creates a thematic map with proportional squares about the population in europe 2011.
<?xml version="1.0" encoding="UTF-8"?> <OcadScript> <OcadVersion>OCAD 2018 - Mapping Solution 32-bit</OcadVersion> <File.New> <File>Thematic Map.ocd</File> <MapScale>25000000</MapScale> </File.New> <File.SaveAs> <File>Thematic Map Population Europe ProportionalSquare.ocd</File> </File.SaveAs> <File.CreateThematicMap> <MapTheme> <Name>Population 2011</Name> <StatDataPath>C:\import\population.xls</StatDataPath> <StatDataTable>Sheet0$</StatDataTable> <StatDataCommonField>id</StatDataCommonField> <VisualizeAttributes>2011</VisualizeAttributes> <AttributesValuesType>absolute</AttributesValuesType> <Classify>no</Classify> <RepresentationFeature>point</RepresentationFeature> <GeometryDataPath>C:\import\europe.shp</GeometryDataPath> <GeometryDataCommonField>ne_10m_adm</GeometryDataCommonField> <JoinType>0</JoinType> <VisualizationMethod>vmProportionalSymbols</VisualizationMethod> <VisualizationType>vtProportionalSquare</VisualizationType> <VisualizationProperties> <ScalingMode>1</ScalingMode> <MaxSize>30.00</MaxSize> <MinSize>1.00</MinSize> <FillColor>C=84 M=0 Y=128 K=0</FillColor> <StrokeColor>C=0 M=0 Y=0 K=181</StrokeColor> <StrokeMaxWidth>0.40</StrokeMaxWidth> <StrokeMinWidth>0.08</StrokeMinWidth> <DecreaseStroke>true</DecreaseStroke> <ShowZeroValue>true</ShowZeroValue> <ShowNoData>true</ShowNoData> <Opacity>80</Opacity> <ThemeLegendTitle>Population</ThemeLegendTitle> </VisualizationProperties> </MapTheme> <MapTitle>Population in Europe 2011</MapTitle> <DefaultTextStyle> <Color>C=0 M=0 Y=0 K=150</Color> <Opacity>100</Opacity> <Font>Arial</Font> <Size>9.0</Size> <isBold>0</isBold> <isItalic>0</isItalic> <Alignment>0</Alignment> </DefaultTextStyle> <MapTitleStyle> <Opacity>80</Opacity> <Size>24.00</Size> <Alignment>1</Alignment> </MapTitleStyle> <AddThemeLegend>true</AddThemeLegend> <AddBasemapLegend>true</AddBasemapLegend> <LegendTitleStyle> <Size>12.0</Size> </LegendTitleStyle> <LegendTextStyle> <Size>9.0</Size> </LegendTextStyle> <AddScaleBar>true</AddScaleBar> <AddScaleText>true</AddScaleText> <AdditionalInformationText>OCAD ThematicMapper sample map</AdditionalInformationText> </File.CreateThematicMap> <File.Save> <Enabled>true</Enabled> </File.Save> </OcadScript>
XML Script Partial Map
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
Export | File coordSystem L, R, B, T |
String Enum types Float |
eg.: ‚ c:\export\PartialMap1.ocd ‘ OCAD creates files PartialMap1_#verticalPages_#horizontalPages.ocd mm (paper, m (real world) left, right, bottom, top |
Export.loop | Enabled HorizontalPages VerticalPages HorizontalOverlap VerticalOverlap |
Bool Integer Integer Float Float |
true, false number of pages in horizontal direction number of pages in vertical direction horizontal overlap in [mm] or [m] vertical overlap in [mm] or [m] |
Example
The following example exports parts of an ocad map.
<ocadScript> // comment <partialMapScript> <export id="0"> // first export section <file>c:\export\PartialMap1.ocd</file> // export file <coordSystem>mm</coordSystem> // paper oder real world coordinates <T>100</T> // export rectangle with Top Left point and Bottom Right point <L>0</L> <B>50</B> <R>50</R> <loop> // the loop export several ocd files. For this example 21 files. <enabled>true</enabled> <horizontalPages>7</horizontalPages> <verticalPages>3</verticalPages> <horizontalOverlap>10</horizontalOverlap> // horizontal and vertical overlap. <verticalOverlap>10</verticalOverlap> </loop> </export> <export id="1"> // second export section <file>c:\export\PartialMap2.ocd</file> <coordSystem>mm</coordSystem> <L>0</L> <R>50</R> <B>50</B> <T>100</T> <loop> // export only one ocd file <enabled>false</enabled> </loop> </export><br> </partialMapScript> </ocadScript>
XML Script Print
Print parameters can be saved in a XML script.
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.Print.Printer | Name DmPaperSize DmDefaultSource DmPrintQuality DmColor DmMediaType |
String Integer Integer Integer Integer Integer |
Eg. ,HP Color LaserJet 2840 PCL' File->Print->Save XML Script->Open the Script and depending on which printer was choosen, the informations are there. |
File.Print.Portrait | Enabled | Bool | true, false |
File.Print.SpotColor | Enabled Colors |
Bool String |
true, false Name of the spot color(s) |
File.Print.PartOfMap | Range Coordinates L, R, B, T |
Integer Enum types Float |
1 mm (page), m (real world) Left, Right, Bottom, Top |
File.Print.HorizontalOverlap | Float | ||
File.Print.VerticalOverlap | Float | ||
File.Print.PrintScale | Integer | Eg. 25000 | |
File.Print.Copies | Integer | Number of copies | |
File.Print.Intensity | Integer | ||
File.Print.LineWidth | Integer | ||
File.Print.PrintScreenGrid | Enabled PrintScreenGridColor |
Bool Integer |
true, false Ocad color number |
XML Script Export
Watch out for the file endings.
Resolution is only used if File.Export.GeoRef -> Enabled = false
AI (Adobe Illustrator), PDF
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.Export | File Format Resolution ExportScale |
String Enum types Integer Integer |
eg.: ,c::\Export\Chlosterwald.ai‘ AI, PDF in dpi [40..2540] (only if the map has raster background maps) eg. '10000' for the scale 1:10'000 |
File.Export.PartOfMap | Enabled Coordinates L, R, B, T |
Bool Enum types Float |
true, false mm (page), m (real world) left, right, bottom, top |
File.Export | Colors | Enum types | normal, spotColors |
File.Export.SpotColors | Combine Enabled |
Bool String |
true, false [only if Colors = spotColors] Spotcolor name [only if Colors = spotColors] |
BMP, GIF, JPEG, PNG
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.Export | File Format Quality Resolution Anti-Aliasing ColorCorrection |
String Enum types Integer Integer Boolean Boolean |
eg.: ‚c:\Export\Chlosterwald.bmp‘ BMP, GIF, JPEG, PNG only for JPEG, [0..100] in dpi [40..2540] true, false true, false |
File.Export.PartOfMap | Enabled Coordinates L, R, B, T |
Bool Enum types Float |
true, false mm (page), m (real world) left, right, bottom, top for rotated maps use here the coordinate of the upper left und lower right corner |
File.Export.Tiles | Enabled Width Height |
Boolean Integer Integer |
true, false [only if Enabled = true] [only if Enabled = true] |
File.Export.GeoRef | Enabled PixelSize CreateWorldFile |
Bool Float Bool |
true, false in meter [only if Enabled = true] true, false [only if Enabled = true] |
EPS
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.Export | File Format ExportScale |
String Enum types Integer |
eg.: ‚c:\Export\Chlosterwald.eps ‘ EPS e.g. '10000' for the scale 1:10'000 |
File.Export.PartOfMap | Enabled Coordinates L, R, B, T |
Bool Enum types Float |
true, false mm (page), m (real world) left, right, bottom, top |
File.Export | Colors | Enum types | normal, spotColors |
File.Export.SpotColors | Enabled | Spotcolor name | [only if Colors = spotColors] |
SVG (Scalable Vector Graphics)
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.Export | File Format ExportScale CompressFile |
String Enum types Integer Boolean |
eg.: ‚c:\Export\Chlosterwald.svg ‘ SVG e.g. '10000' for the scale 1:10'000 true, false |
File.Export.PartOfMap | Enabled Coordinates L, R, B, T |
Bool Enum types Float |
true, false mm (page), m (real world) left, right, bottom, top |
TIFF
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.Export | File Format Resolution Anti-Aliasing ColorCorrection |
String Enum types Integer Boolean Boolean |
eg.: ‚c:\Export\Chlosterwald.tif‘ TIFF in dpi [40..2540] true, false true, false |
File.Export.PartOfMap | Enabled Coordinates L, R, B, T |
Bool Enum types Float |
true, false mm (page), m (real world) left, right, bottom, top |
File.Export.Tiles | Enabled Width Height |
Bool Integer Integer |
true, false [only if Enabled = true] [only if Enabled = true] |
File.Export.GeoRef | Enabled PixelSize CreateWorldFile |
Bool Float Bool |
true, false in meter [only if Enabled = true] true, false [only if Enabled = true] |
File.Export | Colors | Enum types | normal, spotColors |
File.Export.SpotColors | Combine Enabled |
Bool Spotcolor name |
true, false [only if Colors = spotColors] [only if Colors = spotColors] |
File.Export | ColorMode | Integer | 0 = 32 bit CMYK 1 = 24 bit RGB 2 = 256 colors 3 = grayscale 4 = 8 bit CMYK 5 = 1 bit black/white 6 = halftone screen [only if spotColor = true] |
File.Export | Compression | Integer | 1 = no compression 2 = CCITT [only used with ColorMode 5/6] 4 = FaxG4 [only used with ColorMode 5/6] 5 = LZW |
DXF
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.Export | File Format ExportScale ConvertAnsiToOem ConvertOemToUnicode ObjectsSelectedSymbols AddSymbolDescription UseCrtFileName ExportAsSplines Coordinates |
String Enum types Integer Boolean Boolean Boolean Boolean String Boolean Enum types |
eg.: ‚c:\Export\Chlosterwald.dxf ‘ DXF e.g. '10000' for the scale 1:10'000 true, false true, false true, false true, false eg.: ‚c:\CRT\Chlosterwald.ocdCrt‘ true, false m, mm |
Shape
Node <OcadScript> | Parameter | Data type | Values / Description |
---|---|---|---|
File.Export | ExportPath File Format PointObjects LineObjects AreaObjects TextObjects EnvelopePolygonFromTextObjects Dataset WordWrap ProjectionFile Utf8Encoding |
String String Enum types Boolean Boolean Boolean Boolean Boolean String Boolean Boolean Boolean |
eg.: ‚c:\Export‘ (only path name) eg.: ‚c:\Export\test.shp‘ (using ExportPath OR File, not both) SHAPE true, false true, false true, false true, false true, false 'all' for all databases or dataset name true, false true, false true, false |
Example
The following example exports two pdf files in spot colors and two Shape files. Each OcadScript node can contain many children.
<?xml version="1.0" encoding="ISO-8859-1"?> <OcadScript>
<File.Open> <File>M:\OCAD2018\Changes\11-06xx\11-0663\Chlosterwald.ocd</File> </File.Open>
<File.Export> //PDF export <File>M:\OCAD2018\Changes\11-06xx\11-0663\output\Chlosterwald.pdf</File> <Format>PDF</Format> <PartOfMap> <Enabled>true</Enabled> <Coordinates>mm</Coordinates> <L>0</L> <R>50</R> <B>50</B> <T>100</T> </PartOfMap> <ExportScale>10000</ExportScale> <Colors>spotColors</Colors> <SpotColors> <Combine>false</Combine> <Enabled>Blau</Enabled> <Enabled>Gelb</Enabled> </SpotColors> </File.Export> <File.Export> //Shape export <ExportPath>M:\OCAD2018\Changes\11-06xx\11-0663\output\</ExportPath> <Format>SHAPE</Format> <PointObjects>false</PointObjects> <LineObjects>true</LineObjects> <AreaObjects>true</AreaObjects> <TextObjects>false</TextObjects> <EnvelopePolygonFromTextObjects>false</EnvelopePolygonFromTextObjects> <Dataset>all</Dataset> <WordWrap>true</WordWrap> <ProjectionFile>false</ProjectionFile> </File.Export>
<File.Save> <Enabled>true</Enabled> </File.Save>
<File.Close> <Enabled>true</Enabled> </File.Close> </OcadScript>
Run XML Script from the Command Line
It is possible to execute a XML script file from the command line or from batch file.
Open the Windows command and enter the OCAD program name and the xml script file. For example:
"C:\Program Files\OCAD\OCAD 2018\Ocad2018.exe" "C:\Data\ExportScriptExample_PDF.xml"
Use the parameter /NewInstance to always create new OCAD instance. For example:
"C:\Program Files\OCAD\OCAD 2018\Ocad2018.exe" /NewInstance "C:\Data\ExportScriptExample_PDF.xml"
Do not forget to use the parameter <File.Open> to open the file, <File.Close> to close it and <File.Exit> to close OCAD.
Open ocd File from the Command Line
It is possible to open an ocd file from the command line with optional view parameters.
Open the Windows command and enter the OCAD program name and the ocd file name.
For example:
"C:\Program Files\OCAD\OCAD 2018\Ocad2018.exe" "M:\Data\Map.ocd"
Additional OCAD supports the following optional view parameters to open an map at desired postion and view scale.
-c: center for view -s: view scale
For example:
"C:\Program Files\OCAD\OCAD 2018\Ocad2018.exe" -c 710000,231000 -s 2500 "M:\Data\Map.ocd"
Back to Main Page