Hi,

I am struggling with writing an overpass query. I have a list of towns
in Massachusetts in the US, that I would like to run an overpass query
for each one. Because of the history of Massachusetts, almost all of
the town names in Massachusetts are duplicated in the U.K. Just the
town name is not unique. My current python query looks like this where
{0} is the the town name.

query = """[timeout:25];
(
area[admin_level=8][boundary=administrative][name="{0}"][wikipedia="en:{0},
Massachusetts"];
)->.searchArea;
(
way["landuse"="conservation"](area.searchArea);
relation["landuse"="conservation"](area.searchArea);
....
);
(._;>;);
out body;
""".format(townName)

What I would really like is to drop the query on the wikipedia tag
since many of the towns don't have it set yet and instead intersect
the town area with a query for the Massachusetts relation.

Is something like this possible?

query = """[timeout:25];
(
area[admin_level=8][boundary=administrative][name="{0}"] INTERSECTS
area[admin_level=4][boundary=administrative][name="Massachusetts"]
)->.searchArea;
(
way["landuse"="conservation"](area.searchArea);
relation["landuse"="conservation"](area.searchArea);
....
);
(._;>;);
out body;
""".format(townName)


Overpass turbo seem to be able to do this with query to nominatim, but
I don't see how to do this with just straight overpass.

Thanks
Jason

_______________________________________________
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev

Reply via email to