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

How to add a new geocoder? #1

Closed
Wegge opened this issue Apr 6, 2020 · 4 comments
Closed

How to add a new geocoder? #1

Wegge opened this issue Apr 6, 2020 · 4 comments

Comments

@Wegge
Copy link
Contributor

Wegge commented Apr 6, 2020

I've set up a copy of the script to post a random square kilometer of Denmark. The reverse geocoding for Denmark is very coarse, so I'd like to use a local API instead, to get a better resolution. Where in the code would be a good place to add this in a way that will make it suitable for addition?

@doersino
Copy link
Owner

doersino commented Apr 6, 2020

So ærialbot is by default just using Twitter's own reverse geocoding API – the request is sent in the Tweeter.get_location function (line 696 as of 50ec0b3) which returns a tuple of (full_name, country). You could supposedly subclass the Tweeter class and reimplement Tweeter.get_location to query DAWA instead of Twitter, but it might be simpler to replace the function call in line 892 with your DAWA querying logic.

(And make sure to provide me with a link to your bot if you don't mind – I've spent many childhood summers in Denmark, so I'm definitely interested!)

@Wegge
Copy link
Contributor Author

Wegge commented Apr 6, 2020

I've hacked something together, that seem to work. I'll play around with it a bit more, and see if I can generalize it to an option in the inifile that allows for selection between different geocoders. It's tweeting as https://twitter.com/DanskKvadrat Right now a square kilometer, but I think I might increase the area a bit, to avoid too much farmland.

@doersino
Copy link
Owner

doersino commented Apr 7, 2020

Sounds good!

I might increase the area a bit, to avoid too much farmland.

Yeah, this was surprising to me too – it's even more farmland in the US. Out of the hundreds of test images I generated for @americasquared, only four or five were of (sub)urban areas.

@doersino
Copy link
Owner

Closing this issue since your bot has been up and running with your custom reverse geocoder for quite a while. 🙂

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

2 participants