<div dir="ltr">In my last overpass test with the new "out center" feature, it looked like it was working only with XML output, not with the JSON (not GeoJSON) one.</div><div class="gmail_extra"><br><br><div class="gmail_quote">
2014-07-24 16:30 GMT+02:00 Stefan Keller <span dir="ltr"><<a href="mailto:sfkeller@gmail.com" target="_blank">sfkeller@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks again - I think I got it - including a bug:<br>
GeoJSON is still returning polygons! But with XML it works.<br>
E.g. replacing "[out:json]" with [out:xml] or exporting as XML.<br>
<br>
--Stefan<br>
<br>
2014-07-24 15:48 GMT+02:00 Pierre Béland <<a href="mailto:pierzenh@yahoo.fr">pierzenh@yahoo.fr</a>>:<br>
<div class="HOEnZb"><div class="h5">> Stefan,<br>
><br>
> In your example, the parenthesis are making a union of the two requests. and<br>
> the greater then ( > ) is doing a recurse request.<br>
><br>
> This example below is working. It extract independantly nodes and ways,<br>
> calculating the centroid for the ways.<br>
><br>
> [out:json]<br>
> [timeout:25]<br>
> ;<br>
><br>
> node["shop"~"dairy"]<br>
> (45.70234306798271,5.8831787109375,47.864773955792245,10.590820312499998);<br>
> out meta;<br>
> way["shop"~"dairy"]<br>
> (45.70234306798271,5.8831787109375,47.864773955792245,10.590820312499998);<br>
> out meta center qt;<br>
><br>
> Pierre<br>
><br>
> ________________________________<br>
> De : Stefan Keller <<a href="mailto:sfkeller@gmail.com">sfkeller@gmail.com</a>><br>
> À : Pierre Béland <<a href="mailto:pierzenh@yahoo.fr">pierzenh@yahoo.fr</a>><br>
> Cc : Talk Openstreetmap <<a href="mailto:talk@openstreetmap.org">talk@openstreetmap.org</a>><br>
> Envoyé le : Jeudi 24 juillet 2014 9h44<br>
> Objet : Re: [OSM-talk] Overpass API / Overpass QL: center (and centroid)<br>
> function?<br>
><br>
> Salut Pierre<br>
><br>
> Thanks - But this doesn't parse (see below). I'm getting:<br>
> Error: line 4: static error: Element "print" cannot be subelement of<br>
> element "union".<br>
><br>
> -- Stefan<br>
><br>
> [out:json]<br>
> [timeout:25]<br>
> ;<br>
> (<br>
> node["shop"~"dairy"]<br>
> (45.70234306798271,5.8831787109375,47.864773955792245,10.590820312499998);<br>
> way["shop"~"dairy"]<br>
> (45.70234306798271,5.8831787109375,47.864773955792245,10.590820312499998);<br>
> out meta center;<br>
> );<br>
>>;<br>
> out meta qt;<br>
><br>
> 2014-07-24 15:20 GMT+02:00 Pierre Béland <<a href="mailto:pierzenh@yahoo.fr">pierzenh@yahoo.fr</a>>:<br>
>> Stefan,<br>
>><br>
>> In your request, you make a recursive query that loads nodes from the way.<br>
>> In this example, the node and way queries are independant. For the way,<br>
>> the<br>
>> center command is used.<br>
>><br>
>> [out:json]<br>
>> [timeout:25]<br>
>><br>
>> ;<br>
>><br>
>> node["shop"~"dairy"]<br>
>> (45.70234306798271,5.8831787109375,47.864773955792245,10.590820312499998);<br>
>> out meta;<br>
>><br>
>> way["shop"~"dairy"]<br>
>> (45.70234306798271,5.8831787109375,47.864773955792245,10.590820312499998);<br>
>> out meta center qt;<br>
>><br>
>> Pierre<br>
>><br>
>> ________________________________<br>
>> De : Stefan Keller <<a href="mailto:sfkeller@gmail.com">sfkeller@gmail.com</a>><br>
>> À : Talk Openstreetmap <<a href="mailto:talk@openstreetmap.org">talk@openstreetmap.org</a>><br>
>> Cc : Roland Olbricht <<a href="mailto:roland.olbricht@gmx.de">roland.olbricht@gmx.de</a>><br>
>> Envoyé le : Jeudi 24 juillet 2014 8h19<br>
>> Objet : [OSM-talk] Overpass API / Overpass QL: center (and centroid)<br>
>> function?<br>
>><br>
>> Hi,<br>
>><br>
>> I'm trying to get a list of point features only (as GeoJSON or XML).<br>
>> This could serve as input e.g. to uMap. The problem is that the query<br>
>> returns points but also areas. This is actually correct - but I want<br>
>> these areas converted to point geometries too (centered, like<br>
>> ST_Centroid).<br>
>><br>
>> I then found the modifcator/keyword "center" in the Overpass QL [1].<br>
>> But I still get polygons. See the query [2] below.<br>
>><br>
>> Any ideas?<br>
>><br>
>> --Stefan<br>
>><br>
>><br>
>> [1] <a href="http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL" target="_blank">http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL</a><br>
>><br>
>> [2] <a href="http://overpass-turbo.osm.ch/" target="_blank">http://overpass-turbo.osm.ch/</a> oder <a href="http://overpass-turbo.eu/" target="_blank">http://overpass-turbo.eu/</a><br>
>><br>
>> *** Dairy (Käserei) Query ways/areas only... ***<br>
>><br>
>> [out:json]<br>
>> [timeout:25]<br>
>> ;<br>
>> (<br>
>> node["shop"~"dairy"]<br>
>><br>
>> (45.70234306798271,5.8831787109375,47.864773955792245,10.590820312499998);<br>
>> way["shop"~"dairy"]<br>
>><br>
>> (45.70234306798271,5.8831787109375,47.864773955792245,10.590820312499998);<br>
>> );<br>
>> out meta center qt;<br>
>>>;<br>
>> out meta center qt;<br>
>><br>
>> _______________________________________________<br>
>> talk mailing list<br>
>> <a href="mailto:talk@openstreetmap.org">talk@openstreetmap.org</a><br>
>> <a href="https://lists.openstreetmap.org/listinfo/talk" target="_blank">https://lists.openstreetmap.org/listinfo/talk</a><br>
>><br>
>><br>
><br>
><br>
<br>
_______________________________________________<br>
talk mailing list<br>
<a href="mailto:talk@openstreetmap.org">talk@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/talk" target="_blank">https://lists.openstreetmap.org/listinfo/talk</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Christian Quest - OpenStreetMap France</div>
</div>