Hi,
The fast way is to download some OSM data either from some API or from Geofabrik and use GDAL utility program ogr2ogr with OSM and GeoJSON drivers.
http://gdal.org/ogr2ogr.html
http://www.gdal.org/ogr/drv_geojson.html
http://gdal.org/ogr/drv_osm.html
Usage is then like this
ogr2ogr -f GeoJSON test.json berlin.osm.pbf -sql “select * from points where amenity=‘pub’”
And the result looks like this
{
“type”: “FeatureCollection”,
“crs”: { “type”: “name”, “properties”: { “name”: “urn:ogc:def:crs:OGC:1.3:CRS84” } },
“features”: [
{ “type”: “Feature”, “properties”: { “osm_id”: “35300986”, “name”: “Schupke”, “barrier”: null, “highway”: null, “ref”: null, “address”: null, “is_in”: null, “place”: null, “man_made”: null, “amenity”: “pub”, “other_tags”: “"addr:city"=>"Berlin","addr:country"=>"DE","addr:housenumber"=>"10","addr:postcode"=>"13353","addr:street"=>"Nordufer","url"=>"http://www.gaststaette-deichgraf.de/","wheelchair"=>"yes"” }, “geometry”: { “type”: “Point”, “coordinates”: [ 13.3522426, 52.5398008 ] } },
{ “type”: “Feature”, “properties”: { “osm_id”: “35302528”, “name”: “Grüne Oase”, “barrier”: null, “highway”: null, “ref”: null, “address”: null, “is_in”: null, “place”: null, “man_made”: null, “amenity”: “pub”, “other_tags”: “"addr:city"=>"Berlin","addr:country"=>"DE","addr:postcode"=>"13351","addr:street"=>"Guineastraße"” }, “geometry”: { “type”: “Point”, “coordinates”: [ 13.3452267, 52.5485047 ] } },
{ “type”: “Feature”, “properties”: { “osm_id”: “78447148”, “name”: “ZobelKlix”, “barrier”: null, “highway”: null, “ref”: null, “address”: null, “is_in”: null, “place”: null, “man_made”: null, “amenity”: “pub”, “other_tags”: “"addr:city"=>"Berlin","addr:country"=>"DE","addr:housenumber"=>"10","addr:postcode"=>"13403","addr:street"=>"Klixstraße"” }, “geometry”: { “type”: “Point”, “coordinates”: [ 13.3101301, 52.5698075 ] } },
{ “type”: “Feature”, “properties”: { “osm_id”: “84904956”, “name”: “Tom & Jerry”, “barrier”: null, “highway”: null, “ref”: null, “address”: null, “is_in”: null, “place”: null, “man_made”: null, “amenity”: “pub”, “other_tags”: “"addr:city"=>"Berlin","addr:country"=>"DE","addr:housenumber"=>"34","addr:postcode"=>"13403","addr:street"=>"Eichborndamm","phone"=>"+49-30-4134097","wheelchair"=>"no"” }, “geometry”: { “type”: “Point”, “coordinates”: [ 13.3134833, 52.5711948 ] } },
{ “type”: “Feature”, “properties”: { “osm_id”: “89957618”, “name”: “Sportler-Eck”, “barrier”: null, “highway”: null, “ref”: null, “address”: null, “is_in”: null, “place”: null, “man_made”: null, “amenity”: “pub”, “other_tags”: “"addr:city"=>"Berlin","addr:country"=>"DE","addr:housenumber"=>"68","addr:postcode"=>"13509","addr:street"=>"Ernststraße","phone"=>"+49-30-4327668","wheelchair"=>"no"” }, “geometry”: { “type”: “Point”, “coordinates”: [ 13.302578, 52.5840688 ] } },
Read the documentation about the “osmconf.ini” configuration file. After that you can do almost whatever you want with the -sql parameter.