PokeAPI / pokeapi

The Pokémon API
https://pokeapi.co
BSD 3-Clause "New" or "Revised" License
4.18k stars 939 forks source link

Location connections #102

Closed sargunv closed 7 years ago

sargunv commented 8 years ago

Would it be possible to get information on which locations connect to each other? Or possibly a "region map" as a graph with nodes as locations, and connected nodes representing connected locations.

zaneadix commented 8 years ago

@sargunster currently the best we could do is just region->locations->location areas. If you could look over the data and see some way of creating a model for connecting locations to one another based of adjacency that might be a welcome addition

sargunv commented 8 years ago

My first thought is an addition to the location object with a list of connections, like this example for kalos-route-1:

{
    "id": 622,
    "name": "kalos-route-1",
    "region": {
        "name": "kalos",
        "url": "http://pokeapi.co/api/v2/region/6/"
    },
    "names": [
        {
            "name": "Route 1",
            "language": {
                "name": "en",
                "url": "http://pokeapi.co/api/v2/language/9/"
            }
        }
    ],
    "connections": [
        {
            "direction": "north",
            "location": {
                "name": "aquacorde-town",
                "url": "http://pokeapi.co/api/v2/location/588/"
            }
        },
        {
            "direction": "south",
            "location": {
                "name": "vaniville-town",
                "url": "http://pokeapi.co/api/v2/location/587/"
            }
        }
    ],
    "game_indices": [],
    "areas": []
}
phalt commented 8 years ago

@sargunster how would you handle special cases where connections are not in a direction? Where is this information available already?

sargunv commented 8 years ago

The information is on Bulbapedia articles for locations, under the "Connecting Locations" header: http://bulbapedia.bulbagarden.net/wiki/Kalos_Route_1

Could you give an example of one that's not in a direction?

phalt commented 8 years ago

@sargunster I seem to remember a few games having locations that you teleported into.

That information is great but not well structured, we'd need to either collect the data by hand (slow and prone to human error) or construct some scraping tool to automate the data gathering :)

sargunv commented 8 years ago

Seems like some pages (like Santalune Forest) don't follow the same format as the others.

zaneadix commented 8 years ago

Just a thought. If we do end up wanting to generate our own CSVs, I feel like we might want to keep them separate of the veekun csvs. Somethling like data/v2/veekun/ and data/v2/pokeapi juat to keep things clean and obvious

phalt commented 8 years ago

@zaneadix yes for sure. Or perhaps Veekun has plans to add this sort of data?

nimaje commented 8 years ago

@phalt @zaneadix another thought. How about a new repo only for the data? This could be done together with those from Veekun if they want. Additional this new repo could be for all sort of pokemon data (like the card game (#76), sprites/images (#80), pokemon go (#90), location connections (this issue), …). This would require some changes at the 'db data build script', but other projects could easily use this data (e.g. with git submodules). There would be a separation of code and data, this would mean you could run an older version of the api with newer data or the other way around. Updates of the data would mean update the local repo ant rerun the 'db data build script' and this would not change the source.