Why is the OSMMakie plot out of bounds?

Hello,

In the example below, the plotted area (including roadways) is outside of the bounds defined in area. Why is this happening?

using GLMakie
using LightOSM
using OSMMakie

file_name = "woodstock_illinois_park.osm"

# define area boundaries
area = (
    minlat = 42.314096, minlon = -88.449010, # bottom left corner
    maxlat = 42.315750, maxlon = -88.445807 # top right corner
)

if !isfile(file_name)
    download_osm_network(:bbox;
                                area...,
                                network_type = :none,
                                download_format = :osm,
                                save_to_file_location = "woodstock_illinois_park.osm");
end
# load as OSMGraph
osm = graph_from_file("woodstock_illinois_park.osm";
    graph_type = :light, # SimpleDiGraph
    weight_type = :distance
)

# use min and max latitude to calculate approximate aspect ratio for map projection
autolimitaspect = map_aspect(area.minlat, area.maxlat)

# plot it
fig, ax, plot = osmplot(osm; axis = (; autolimitaspect), inspect_nodes = true)
fig

Try the following or network_type = :walk or :drive instead of :none ```fig, ax, plot = osmplot(osm; axis = (; autolimitaspect), inspect_nodes = true)

xlims!(ax, area.minlon, area.maxlon)
ylims!(ax, area.minlat, area.maxlat)

fig

1 Like

Thank you. That did fix the plot bounds.

Maybe I should have mentioned that I am using the map with Agents.jl. I think the issue is goes beyond xlims/ylims in the plot because the agents would go outside of the plot. If I understand correctly, it seems to be a larger issue with the bounds of the underlying data. Do you happen to know why the map has information outside of the stated bounds? Maybe the distance between adjacent nodes exceeds the bounds?

1 Like

What seems to be happening is that it is mapping a network with nodes outside the bounding box, which is mainly concerned with the edges.

1 Like

I suspect that these are nodes that belong to ways that are in your bounding box and it includes the first node that is outside of your bbox. This is just how Overpass API works which is used in the background of the download function in LightOSM, see this issue for more details. Clip results to a specified area · Issue #644 · drolbr/Overpass-API · GitHub. Apparently there is a way to circumvent this with Overpass API, but I don’t know how one could get this in LightOSM

1 Like