Skip to content

Use nv-i18n to replace graphhoppers Country enum #1709

Closed

Description

@otbutz

The nv-i18n lib has worldwide coverage and covers more than just DE/AT:

https://github.com/TakahikoKawasaki/nv-i18n/blob/master/src/main/java/com/neovisionaries/i18n/CountryCode.java

I know that the number of constants are problematic if we would use the default EnumEncodedValue to store it. My suggestion would be to create a FilteredEnumEncodedValue class which would allow us to only store a subset of relevant values.

My ultimate goal would be to define relevant countries in the config file and only encode the selected ones in the graph.

What do you think?

Activity

  1. karussell commented on Sep 3, 2019

    @karussell
    Member

    Why would this be required? What benefits over 2 letter isocodes do you see?

  2. otbutz commented on Sep 3, 2019

    @otbutz
    ContributorAuthor

    The overall plan would be to gather toll mileage on a per country basis for a given route.
    eg: Vehicle x drives from Germany to Croatia and i want to know how many kilometers include general/hgv toll.

    For this to work i'd have to store the country of every edge with the ability to do this on a global scale(195 countries). And i think that it's much easier to have a curated list which is actively developed and used across many projects.

  3. karussell commented on Sep 3, 2019

    @karussell
    Member

    Why not e.g. Locale.getISOCountries() or only the countries where we have rules for like we do it for TranslationMap?

  4. otbutz commented on Sep 3, 2019

    @otbutz
    ContributorAuthor

    I was looking at the SpatialRuleParser which already does 99% of the work AFAIK. I could use the countrycodes and shapes from the spatial rules file and encode the country association as an UnsignedIntEncodedValue but maybe it would be better to establish the concept of "country rules" as such? eg have a typesafe enum with all countries, assign them to edges within a countries boundaries and be able write rules without resorting to String keys or index based lookup.

    btw why is the SpatialRuleParser using an EnumEncodedValue only to store the index number with setInt()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions