DeloitteOptimalReality / LightOSM.jl

A Julia package for downloading and analysing geospatial data from OpenStreetMap APIs.
https://deloitteoptimalreality.github.io/LightOSM.jl/docs
Other
47 stars 12 forks source link

Adding custom tags to ways and nodes #103

Open AzilAverakot opened 6 months ago

AzilAverakot commented 6 months ago

When user provides a dictionary that contains the names of custom tags that need to be ingested those tags are added to ways and nodes.

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 12.12121% with 29 lines in your changes are missing coverage. Please review.

Project coverage is 82.50%. Comparing base (c30254c) to head (16cf6d2). Report is 2 commits behind head on master.

:exclamation: Current head 16cf6d2 differs from pull request most recent head 3def3b4. Consider uploading reports for the commit 3def3b4 to get more accurate results

Files Patch % Lines
src/graph.jl 10.00% 18 Missing :warning:
src/parse.jl 15.38% 11 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #103 +/- ## ========================================== + Coverage 81.05% 82.50% +1.44% ========================================== Files 15 15 Lines 1151 1183 +32 ========================================== + Hits 933 976 +43 + Misses 218 207 -11 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

AzilAverakot commented 6 months ago

The goal of this change is to allow users to add custom tags to the OSM graph.

MM 3rd network file in this agreed format will contain OSM tags together with vicmap tags and custom tags.

In this pr I add functions to add custom tags to the tags dictionary for ways and nodes. This will only be done if the user provides the dictionary filter to specify which custom tags to ingest.

For example, given the following sample file structure:

    {
          "version": "dtp_osm_road_network_transport:2.2",
          "timestamp_osm_base": "2023-12-05T23:27:21.722",
          "elements": [
                  {
                      "id": "OSM&&NODE10000307796",
                      "type": "node",
                      "lon": 145.2680669,
                      "lat": -37.7890839
                  },
                  {
                      "id": "OSM&&NODE10000307797",
                      "type": "node",
                      "lon": 145.2680689,
                      "lat": -37.7891024
                  },
                  {   
                      "dtp_id": "DTP&&WAY123456789"/"OSM&&WAY123456789",
                      "way_id": "OSM&&WAY123456789",
                      "type": "way",
                      "nodes": ["OSM&&NODE10000307796", "OSM&&NODE10000307797", "OSM&&NODE10000307798"],
                      "source_matched_id": "VICMAP_TRANSPORT&&59472156",
                      "tags": {
                          "name": "Ormiston Place",
                          "nodes": ["OSM&&NODE10000307796", "OSM&&NODE10000307797", "OSM&&NODE10000307798"],
                          "source": "nearmap",
                          "highway": "residential",
                          "more fields": "..."
                      },
                      "custom_tags": {
                          "DTP_REG_NAME": "GREATER METRO",
                          "LGA_ABB_NAME": "CASEY",
                          "MEL30_ART": "N", 
                          "more fields": "..."
                      },
                      "vmt_tags": {
                          "ufi": "59472156", 
                          "div_rd": "U", 
                          "road_name": "ORMISTON", 
                          "road_seal": "1",
                          "more fields": "..."
                      }
                  },
            ]
      }

to ingest selected vmt_tags and custom_tags the user needs to provide the following dictionary as the function input:

tags_filter = Dict(
    "custom_tags" => ["DTP_REG_NAME", "LGA_ABB_NAME", "MEL30_ART"],
    "vmt_tags" => ["ufi", "div_rd"]
)