Are Filepaths to Geojsons Supported in my_area Weighting?

Regarding the my_area sample code illustrated below, found in the v1.0-pre41 github branch.

areas:
  custom1:
    type: "Feature"
    geometry: { type: "Polygon", coordinates: [[[13.722, 51.053], [13.722, 51.055], [13.731, 51.055], [13.731, 51.053], [13.722, 51.053]]] }

Does the my_area weighting feature support importing a geojson from a filepath - for example:

priority:
 area_custom1: 0.5

areas:
 custom1:
   path: <C:/PATH/TO/WEIGHTINGFILE.GEOJSON>

This is not supported yet, but you can directly copy any GeoJSON (as JSON) even into YAML as YAML is a superset of JSON. So no need to convert the GeoJSON into YAML format.

This is not supported yet

Good to know! Even though its minor I think that would be a pretty cool thing to add in but no worries if not! =]

You can directly copy any GeoJSON (as JSON) even into YAML as YAML is a superset of JSON.

I’m probably missing something small with my notation… Can you take a glance at my code below? for loading this Multipolygon:

The geojson:

{
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
        [
            [
              [
                -110.94068410541476,
                32.228085774340734
              ],
              [
                -110.94122309458523,
                32.228085774340734
              ],
              [
                -110.94122309458523,
                32.22762982508865
              ],
              [
                -110.94068410541476,
                32.22762982508865
              ],
              [
                -110.94068410541476,
                32.228085774340734
              ]
            ]
          ],
          [
            [
              [
                -110.93213230541475,
                32.22814857418324
              ],
              [
                -110.93267129458522,
                32.22814857418324
              ],
              [
                -110.93267129458522,
                32.22769262524619
              ],
              [
                -110.93213230541475,
                32.22769262524619
              ],
              [
                -110.93213230541475,
                32.22814857418324
              ]
            ]
          ],
          [
            [
              [
                -110.92939840541474,
                32.228161474150866
              ],
              [
                -110.92993739458521,
                32.228161474150866
              ],
              [
                -110.92993739458521,
                32.227705525278544
              ],
              [
                -110.92939840541474,
                32.227705525278544
              ],
              [
                -110.92939840541474,
                32.228161474150866
              ]
            ]
          ],
          [
            [
              [
                -110.93504190541476,
                32.228141774200296
              ],
              [
                -110.93558089458524,
                32.228141774200296
              ],
              [
                -110.93558089458524,
                32.22768582522914
              ],
              [
                -110.93504190541476,
                32.22768582522914
              ],
              [
                -110.93504190541476,
                32.228141774200296
              ]
            ]
          ],
                    [
            [
              [
                -110.94218510541477,
                32.22808047435405
              ],
              [
                -110.94272409458523,
                32.22808047435405
              ],
              [
                -110.94272409458523,
                32.22762452507537
              ],
              [
                -110.94218510541477,
                32.22762452507537
              ],
              [
                -110.94218510541477,
                32.22808047435405
              ]
            ]
          ],
           [
            [
              [
                -110.93923900541478,
                32.22809727431191
              ],
              [
                -110.93977799458524,
                32.22809727431191
              ],
              [
                -110.93977799458524,
                32.22764132511751
              ],
              [
                -110.93923900541478,
                32.22764132511751
              ],
              [
                -110.93923900541478,
                32.22809727431191
              ]
            ]
          ],
          [
            [
              [
                -110.93633800541475,
                32.228126374238926
              ],
              [
                -110.93687699458522,
                32.228126374238926
              ],
              [
                -110.93687699458522,
                32.22767042519052
              ],
              [
                -110.93633800541475,
                32.22767042519052
              ],
              [
                -110.93633800541475,
                32.228126374238926
              ]
            ]
          ]
        ]
      }
    }
  ]
}

This is what I have in my flex weighting window on localhost:8989

priority:
  area_sample: 0.1

areas:
{
  "sample": [
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiPolygon",
        coordinates: [
        [
            [
              [
                -110.94068410541476,
                32.228085774340734
              ],
              [
                -110.94122309458523,
                32.228085774340734
              ],
              [
                -110.94122309458523,
                32.22762982508865
              ],
              [
                -110.94068410541476,
                32.22762982508865
              ],
              [
                -110.94068410541476,
                32.228085774340734
              ]
            ]
          ],
          [
            [
              [
                -110.93213230541475,
                32.22814857418324
              ],
              [
                -110.93267129458522,
                32.22814857418324
              ],
              [
                -110.93267129458522,
                32.22769262524619
              ],
              [
                -110.93213230541475,
                32.22769262524619
              ],
              [
                -110.93213230541475,
                32.22814857418324
              ]
            ]
          ],
          [
            [
              [
                -110.92939840541474,
                32.228161474150866
              ],
              [
                -110.92993739458521,
                32.228161474150866
              ],
              [
                -110.92993739458521,
                32.227705525278544
              ],
              [
                -110.92939840541474,
                32.227705525278544
              ],
              [
                -110.92939840541474,
                32.228161474150866
              ]
            ]
          ],
          [
            [
              [
                -110.93504190541476,
                32.228141774200296
              ],
              [
                -110.93558089458524,
                32.228141774200296
              ],
              [
                -110.93558089458524,
                32.22768582522914
              ],
              [
                -110.93504190541476,
                32.22768582522914
              ],
              [
                -110.93504190541476,
                32.228141774200296
              ]
            ]
          ],
                    [
            [
              [
                -110.94218510541477,
                32.22808047435405
              ],
              [
                -110.94272409458523,
                32.22808047435405
              ],
              [
                -110.94272409458523,
                32.22762452507537
              ],
              [
                -110.94218510541477,
                32.22762452507537
              ],
              [
                -110.94218510541477,
                32.22808047435405
              ]
            ]
          ],
           [
            [
              [
                -110.93923900541478,
                32.22809727431191
              ],
              [
                -110.93977799458524,
                32.22809727431191
              ],
              [
                -110.93977799458524,
                32.22764132511751
              ],
              [
                -110.93923900541478,
                32.22764132511751
              ],
              [
                -110.93923900541478,
                32.22809727431191
              ]
            ]
          ],
          [
            [
              [
                -110.93633800541475,
                32.228126374238926
              ],
              [
                -110.93687699458522,
                32.228126374238926
              ],
              [
                -110.93687699458522,
                32.22767042519052
              ],
              [
                -110.93633800541475,
                32.22767042519052
              ],
              [
                -110.93633800541475,
                32.228126374238926
              ]
            ]
          ]
        ]
      }
    }
  ]
}

Why is there an array type?

areas:
{
  "sample": [
    {

Try without it:

areas:
{
  "sample":  {

See the examples for a working GeoJSON.

1 Like

No, not yet, but I opened this issue for this: Allow specifying areas for custom weighting in a separate file · Issue #2037 · graphhopper/graphhopper · GitHub
Btw I just tried routing around a multipolygon and it worked.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.