Importing accidents provided in a user-defined file format

Note: If you have problems adjusting your accident data configuration, contact your PTV consultant.

You can adapt a file template to your accident data. For this purpose, replace the given column headers in the file template by those provided with your accident data. Subsequently, copy your accident data to the edited file template and import this file in PTV Visum.

Note: Prior to the first import of accidents, you need to configure the data model and specify the following settings.

For configuration and data import, carry out the following steps:

  • Adjust the file template and transfer the accident data
  • Create the XML Schema file
  • Create a configuration file
  • Import the accident data in PTV Visum
Adjust the file template and transfer the accident data

1.  In the PTV Visum installation folder, go to the folder Data > Safety_Templates.

2.  Use Microsoft Excel to open the file VisumSafetyAccidentDataTemplate.csv.

3.  Change the column headers in such a way that they match your provided accident data.

4.  Save the file.

5.  In Microsoft Excel, open file VisumSafetyAccidentDataTemplate.xlsx from the same folder.

6.  In the Description sheet, edit the attributes and their formats in such a way that they match the column headers in the Data sheet.

This will automatically update the XSD column.

7.  Enter your accident data.

8.  In the File tab, select the Save as entry.

9.  Select the file type *.xlsx.

10.  Save the file.

Create the XML Schema file

1.   Go to the directory C:\ProgramData\PTV_Vision\PTV Visum 2021\Safety\Custom. If the folder does not yet exist, create it.

2.  Create a new xsd file with the name of your configuration, e.g. custom.xsd

3.  Use a text editor to open the file.

4.  Copy the data rows below into the file. Avoid blank lines at the top of the file:

<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:simpleType name="shortString">
<xs:restriction base="xs:string">
<xs:maxLength value="4000" />
</xs:restriction>
</xs:simpleType>
<xs:element name="Data" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>

 

5.  To the position below the last data row <xs:sequence>, copy the content of the following column without column header: from file VisumSafetyAccidentDataTemplate.xlsx, Description sheet, column XSD.

6.  To the position underneath, copy the following data rows:

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

</xs:element>

</xs:schema>

7.  Save the file.

Create a configuration file

1.  Copy the file VisumSafetyConfig.xml from the folder C:\Programme\PTV Vision\PTV Visum 2021\Exe\Safety\Config\ to the folder C:\ProgramData\PTV Vision\PTV Visum 2021\Safety\Custom\.

2.  Rename the file, e.g. to CustomConfiguration.xml

Note: If you do not rename the file, you will not be able to select the standard configuration in Visum Safety later.

3.  Make sure that the following entries are correct:

Name

Description

ConfigName

Display name of your configuration in Visum Safety

Choose a different name for each configuration to distinguish them in Visum Safety. The name 'Standard' is intended for the configuration supplied by PTV and should not be used.

XmlSchema

Custom.xsd or the name of the xsd file you created

DatafileSeparator

ASCII code of the separator which is used in the CSV file; e.g. 59 (ASCII code for semicolon ;)

DatafileTextIndicator

If text entries in the CSV file are indicated by e.g. quotation marks, 34 (ASCII code for ") has to be entered here

DefaultXCoord

Default X coordinate to be used if the data does not contain this value

DefaultYCoord

Default Y coordinate to be used if the data does not contain this value

DefaultProjection

The WKT projection string of the projection used for the data. It can be found in the EXT folder of the Visum installation directory, in the *.prj files.

For the allocation of the attributes from your data to the Visum Safety data model, you can specify either the attribute name directly or an SQL function (MS SQL Syntax); in this way, the appropriate value can be generated from your data. This applies to the following parameters:

SqlAccidentName

ID of the accidents: If there is no unique number in the data, a comma-separated list can also be specified here. The values are then merged into an ID. For example, if you only have one serial number per year, the entry "Year, SerialNumber" would lead to an ID like 2020_1, 2020_2, ...

SqlAccidentXCoord

X-Coordinate

SqlAccidentYCoord

Y-Coordinate

SqlAccidentDate

Date as numerical value YYYYMMDD (e.g. 20130131)

SqlAccidentTime

Time as numerical value 0 – 2359 (e.g. 1457 for 2:57 p.m.)

SqlAccidentCategory

Number of the category

SqlAccidentType

Number of the accident type

SqlAccidentCost

Accident cost

SqlAccidentUrban

1 if urban

SqlAccidentIntersection

1 if at intersection

SqlAccidentPedestrian

1 if pedestrian involved

SqlAccidentBike

1 if bicyclist involved

SqlAccidentMotorcycle

1 if motorcycle involved

SqlAccidentAnimal

1 if animal involved

SqlAccidentAlcohol

1 if alcohol or drugs involved

SqlAccidentTree

1 if a tree was hit

SqlAccidentOvertaking

1 if when overtaking

SqlAccidentSlippery

1 if slippery roads

SqlAccidentDark

1 if dark

SqlAccidentDriveway

1 if in driveway

SqlAccidentSingle

1 if only one person involved

SqlAccidentAttributes

Comma-separated list of the names of the attributes which are to be provided as attributes in PTV Visum

SqlAccidentGraphicParameterSingleAccident

Comma-separated list of the names of the attributes which are to be provided as differentiation criteria for single accident viewing

SqlAccidentGraphicParameterHeatMap

Comma-separated list of the names of the attributes which are to be provided as criterion for the Heat Map calculation

SqlAccidentFilter

Comma-separated list of the names of the attributes which are to be provided as filter criteria

4.  Save the file.

Note: You can also create your own reports using the two xsl files under C:\ProgramFiles\PTV Vision\PTV Visum 2021\Exe\Safety\Config. If you have any questions, please contact your PTV consultant.

Import of the accident data in PTV Visum

1.  Import the accidents (Importing accidents).

2.  Select the accident data configuration that corresponds to the ConfigName you selected.