如何从某个国家的OpenStreetMap获得积分? [英] How to get points from OpenStreetMap of a certain country?
问题描述
我正在尝试获取我所在国家/地区的所有学校的列表,经过几次尝试,我编写了以下查询,该查询在 http://overpass-turbo.eu :
i'm trying to get the list of all schools in my country, and after several tries i write the following query that works with no errors on http://overpass-turbo.eu:
/*
This has been generated by the overpass-turbo wizard.
The original search was:
"amenity=school"="yes"
*/
[out:json][timeout:60];
// gather results
(
// query part for: "amenity=school"
node[amenity=school]({{geocodeBbox:Italia}});
way[amenity=school]({{geocodeBbox:Italia}});
relation[amenity=school]({{geocodeBbox:Italia}});
);
// print results
out body;
>;
out skel qt;
我使用geocodeBbox
选择意大利的所有学校,因为geocodeId
和geocodeArea
(请参考
I used geocodeBbox
to select all schools of Italy because geocodeId
and geocodeArea
(please refer to documentation) give me the following errors:
Error: line 10: parse error: ')' expected - '(' found.
Error: line 11: parse error: ')' expected - '(' found.
Error: line 11: parse error: ';' expected - ')' found.
Error: line 12: parse error: ')' expected - '(' found.
Error: line 12: parse error: ';' expected - ')' found.
Error: line 13: parse error: Unknown type ")"
Error: line 13: parse error: An empty query is not allowed
Error: line 13: parse error: Unknown type ";"
Error: line 15: parse error: An empty query is not allowed
无论如何,问题是查询甚至选择了不在意大利的学校(例如,克罗地亚的一所学校).
Anyway the problem is that the query selects even schools that are not in Italy (for example there is a school from Croatia).
那么,如何准确地从某个国家获得积分呢?
So, how to get exactly the points from a certain country?
推荐答案
无论如何,问题在于查询甚至选择了不在意大利的学校(例如,克罗地亚的一所学校).
Anyway the problem is that the query selects even schools that are not in Italy (for example there is a school from Croatia).
是正确的.边界框(bbox)是矩形,而不是多边形.因此,它将始终包含更多内容,除非您的矩形国家/地区也与给定的bbox完美对齐;)
That's correct. A bounding box (bbox) is a rectangle, not a polygon. Therefore it will always include a little bit more, except if you have a rectangle-shaped country that is also perfectly aligned with the given bbox ;)
改为尝试以下查询:
[out:json][timeout:600];
// gather results
{{geocodeArea:Italia}}->.searchArea;
(
// query part for: "amenity=school"
node[amenity=school](area.searchArea);
way[amenity=school](area.searchArea);
relation[amenity=school](area.searchArea);
);
// print results
out body;
>;
out skel qt;
这篇关于如何从某个国家的OpenStreetMap获得积分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!