Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish the URL of the API #243

Open
mfrasca opened this issue Aug 11, 2022 · 0 comments
Open

publish the URL of the API #243

mfrasca opened this issue Aug 11, 2022 · 0 comments

Comments

@mfrasca
Copy link

mfrasca commented Aug 11, 2022

in my experience it is useful to allow outsiders query the tasking manager through the API, let us collect statistics, or to get the bounding polygon a specific task.

on hotosm.org, they keep it at https://tasking-manager-tm4-production-api.hotosm.org/
where is it on teachosm.org?

one of my use cases, as said, is getting the polygon:

#!/usr/bin/env python3

import sys
import requests

if len(sys.argv) != 2:
    sys.exit(-1)

info = requests.get(f"https://tasking-manager-tm4-production-api.hotosm.org/api/v2/projects/{sys.argv[1]}/queries/aoi/")
print("""\
<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.6' upload='never' generator='JOSM'>""")

i = 0
points = info.json()['coordinates'][0][0]

for point in points:
    i += 1
    print(f"  <node id='-{i}' lat='{point[1]}' lon='{point[0]}' />")

print(f"  <way id='-{len(points)}'>")

for i in range(len(points)):
    print(f"    <nd ref='-{i+1}' />")
print("    <nd ref='-1' />")

print("""\
  </way>
</osm>""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant