| Forum | GitHub | Maps | Blog

How to make sure block_area is always respected?


I have about 200 lat/lon/radius specified in block_area. However, routing does not always seem to respect the values in block_area. When there are a lot of blocked points, routing still passes through the radius of those points. Any idea why?

The green path shows a clear example:

Here’s the relevant code snippet using the Web API:

            var ghRoutingAvoid = new GraphHopper.Routing({
                key: "API_KEY",
                vehicle: "foot",
                elevation: false,
                instructions: false,
                ch: {disable: true},
                block_area: "LONG LIST OF LAT,LON,RADIUS"

            setupRoutingAPIAvoid(map, ghRoutingAvoid);

            function setupRoutingAPIAvoid(map, ghRouting) {
                map.setView([52.093421, 5.073712], 12);
                ghRouting.addPoint(new GHInput(52.08986,5.1113));
                ghRouting.addPoint(new GHInput(52.09086,5.1193099));
                    .then(function(json) {
                        var path = json.paths[0];
                            "type": "Feature",
                            "geometry": path.points

                    }).catch(function(err) {

                var routingLayerAvoid = L.geoJson().addTo(map);
                routingLayerAvoid.options = {
                    style: {color: "#00cc33", "weight": 5, "opacity": 0.6}


There is still an open issue that might be relevant:

I.e. it can occur in certain situations that a block_area seems to get ignored. If you have a link to GraphHopper Maps where this is the case I could be investigate if it is a known issue or something else.


Hi @karussell,

thanks for your reply. I cannot judge from the issue whether it is related.

The live example can be found here: The red line is a route on foot without block_area, the green line is the same route request but with block_area. No route should ever go through the block_areas. If no route can be found, that’s fine.

It’d be great if you could take a look!