#!/usr/bin/env ruby # frozen_string_literal: true # The reference example of the plugin contract (see lib/maptool/plugins.rb): # read --south/--west/--north/--east, print a GeoJSON FeatureCollection to # stdout. Thin wrapper around lib/maptool/overpass_pois.rb, which already # did all the real work for the "rake overpass:pois" dev-time task this # plugin now sits alongside as a second way to run the same query. require_relative "../../lib/maptool/overpass_pois" args = ARGV.to_h { |arg| arg.sub(/\A--/, "").split("=", 2) } bbox = %w[south west north east].map { |key| Float(args.fetch(key)) } response = Maptool::OverpassPois.fetch(bbox) puts JSON.generate(Maptool::OverpassPois.to_geojson(response))