Custom_areas "area null already exists"

Hi
We want to use the custom_areas feature. we defined in the config.yml

custom_areas.directory: /graphhopper_data/custom_areas

For the demo we are using the country.geojson (however we also replicated it with other geojson).
We are getting the following error.

[main] INFO  com.graphhopper.GraphHopper - Will make 516 areas available to all custom profiles. Found in /graphhopper_data/custom_areas
java.lang.IllegalArgumentException: area null already exists
        at com.graphhopper.util.CustomModel.addAreas(CustomModel.java:68)
        at com.graphhopper.GraphHopper.resolveCustomModelFiles(GraphHopper.java:1572)
        at com.graphhopper.GraphHopper.init(GraphHopper.java:513)
        at com.graphhopper.http.GraphHopperManaged.<init>(GraphHopperManaged.java:39)
        at com.graphhopper.http.GraphHopperBundle.run(GraphHopperBundle.java:257)
        at com.graphhopper.http.GraphHopperBundle.run(GraphHopperBundle.java:47)
        at io.dropwizard.core.setup.Bootstrap.run(Bootstrap.java:199)
        at io.dropwizard.core.cli.EnvironmentCommand.run(EnvironmentCommand.java:65)
        at io.dropwizard.core.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
        at io.dropwizard.core.cli.Cli.run(Cli.java:78)
        at io.dropwizard.core.Application.run(Application.java:94)
        at com.graphhopper.application.GraphHopperApplication.main(GraphHopperApplication.java:38)

Any assistance would be apprcieted

GraphHopper expects each GeoJSON feature to have a unique id field. As one or more of your features is missing this field they have the ID null which triggers the duplicate detection.

   {
       "type": "Feature",
       "id": "my_cool_area",
       "geometry": {...},
       "properties": {...}
   }
1 Like

Thx @otbutz for you response.
This is strange.

  1. I’ve validated that all of the “id” are unique .
  2. I’m sharing a sample of the geojson - which I’m still getting the same error

ca_counties.geojson (1.2 MB)

com.graphhopper.GraphHopper - Will make 2 areas available to all custom profiles. Found in /graphhopper_data/custom_areas
java.lang.IllegalArgumentException: area null already exists
        at com.graphhopper.util.CustomModel.addAreas(CustomModel.java:68)
        at com.graphhopper.GraphHopper.resolveCustomModelFiles(GraphHopper.java:1572)
        at com.graphhopper.GraphHopper.init(GraphHopper.java:513)
        at com.graphhopper.http.GraphHopperManaged.<init>(GraphHopperManaged.java:39)
        at com.graphhopper.http.GraphHopperBundle.run(GraphHopperBundle.java:257)
        at com.graphhopper.http.GraphHopperBundle.run(GraphHopperBundle.java:47)
        at io.dropwizard.core.setup.Bootstrap.run(Bootstrap.java:199)
        at io.dropwizard.core.cli.EnvironmentCommand.run(EnvironmentCommand.java:65)
        at io.dropwizard.core.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
        at io.dropwizard.core.cli.Cli.run(Cli.java:78)
        at io.dropwizard.core.Application.run(Application.java:94)
        at com.graphhopper.application.GraphHopperApplication.main(GraphHopperApplication.java:38)

Any other ideas would be greatly appreciated

BTW - here is also my config.yml file

graphhopper:

  datareader.file: ""
  graph.location: graph-cache

  profiles:
   - name: car
     custom_model_files: [car.json]

  profiles_ch:
    - profile: car

  profiles_lm: []

  graph.encoded_values: car_access, car_average_speed, road_access

  prepare.min_network_size: 200
  prepare.subnetworks.threads: 1

  routing.snap_preventions_default: tunnel, bridge, ferry

  routing.non_ch.max_waypoint_distance: 1000000

  graph.dataaccess.default_type: RAM_STORE

  custom_areas.directory: /graphhopper_data/custom_areas

The “id” field must be at the top level of the Feature, like in @otbutz’s example. You put the “id” into the “properties” object instead.

Wow - thx for your help.

are you interested in a PR to update the config.yml example to emphasis this point?