Esri / arcgis-osm-editor

ArcGIS Editor for OpenStreetMap is a toolset for GIS users to access and contribute to OpenStreetMap through their Desktop or Server environment.
Apache License 2.0
392 stars 129 forks source link

Problems: generating a custom network configuration file script / Hierarchy level #205

Open vinlearn opened 5 years ago

vinlearn commented 5 years ago

Has anyone had issues with creating a network configuration file? I have followed the steps as per: https://github.com/Esri/arcgis-osm-editor/wiki/Generate-a-custom-network-configuration-file-script However I cannot get the script to generate an .xml output file as the box for "output_file" (step 9) will not accept a file name ending in .xml. (ERROR 000732: Output_file: Dataset custom_14062019.xml does not exist or is not supported"

I am running 10.6.1. Avoiding this problem I have had success using the existing .xml templates to produce a OSM network dataset using the Create OSM Network Dataset tool. However I want to customise the network configuration file in order to prioritise the choice of segments when finding nearest routes (eg use a hierarchy to prioritise footway over, say motorway) and I had problems attempting to alter the xml. My question is Other than editing the hierarchy section of the .xml do I need to create a field in the line dataset to code the [highway] field? eg is it necessary to create a field called h_level = 1,2,3,4,5 based on custom hierarchy? eg for highest priority [highway]= footway, create [h_level]=1, and so on?

Only making edits to the xml results in the network dataset being created but I get the following error when I try to run a shortest route calculation: Warning: Cannot use hierarchy when the hierarchy level count is zero. Error: Invalid context.

If I turn off the Use Hierarchy checkbox in the Layer Properties then the tool runs but does not use a hierarchy.

Any advice would be greatly appreciated

Below is the customised Heirarchy part of the DriveGeneric.xml script. Perhaps I may also need to alter something here:

    <network_attribute>
        <name>Hierachy</name>
        <default_value>0</default_value>
        <hierachy useAsDefault="false">
            <evaluator_attributes>
                <source>roads</source>
                <direction>From-To</direction>
                <Field script_type="VBScript">
                    <expression>h_level</expression>
                    <pre_logic>
                        <![CDATA[
                        h_level = 4
                        Select Case LCase([highway])
                            Case "motorway", "motorway_link"
                                h_level = 5
                            Case "trunk", "trunk_link"
                                h_level = 4
                            Case "primary", "primary_link", "secondary", "secondary_link"
                                h_level = 3
                            Case "tertiary", "tertiary_link", "living_street", "residential"
                                h_level = 2
                            Case "cycleway","footway","path","pedestrian","service","steps","track"
                                h_level = 1
                        End Select
                        ]]>
                    </pre_logic>
                </Field>
            </evaluator_attributes>
            <evaluator_attributes>
                <source>roads</source>
                <direction>To-From</direction>
                <Field script_type="VBScript">
                    <expression>h_level</expression>
                    <pre_logic>
                        <![CDATA[
                        h_level = 4
                        Select Case LCase([highway])
                            Case "motorway", "motorway_link"
                                h_level = 5
                            Case "trunk", "trunk_link"
                                h_level = 4
                            Case "primary", "primary_link", "secondary", "secondary_link"
                                h_level = 3
                            Case "tertiary", "tertiary_link", "living_street", "residential"
                                h_level = 2
                            Case "cycleway","footway","path","pedestrian","service","steps","track"
                                h_level = 1
                        End Select
                        ]]>
                    </pre_logic>
                </Field>
            </evaluator_attributes>
        </hierachy>
    </network_attribute>
</network>