Skip to content

Creating Locations

Seán Lynch edited this page May 5, 2023 · 1 revision

How Creating Locations Works:

When a user uploads a photo, we send its coordinates to OpenStreetMap to get the address values.

For example, the most recently uploaded photo has the coordinates 52.5871315, 1.0623470277778

If you send these coordinates to OSM and check for its address, you will get something like this back:

{"road":"Wicklewood Road","hamlet":"Kimberley","village":"Wicklewood","city":"South Norfolk","county":"Norfolk","state":"England","postcode":"NR18 9QE","country":"United Kingdom","country_code":"gb"}

The first thing we do is check for the country_code in our countries database table.

If the gb code does not exist, we can create the country which in this example is the United Kingdom. If the gb code is found, we can select the Country and add data to it.

We then repeat the process and check for States and Cities.

This methodology works for Countries, its not great for States and Cities, but it works for now and will be updated in time.

Clone this wiki locally