How can I use GraphHopper to get a list of all cities in a country (or USA state)? For each city, I need a latitude and longitude.
(I presume the city's latitude and longitude would be the official middle of that city.)
How can I use GraphHopper to get a list of all cities in a country (or USA state)? For each city, I need a latitude and longitude.
(I presume the city's latitude and longitude would be the official middle of that city.)
That process is called 'geocoding' and not done from GraphHopper. GraphHopper is only about finding the best way between 'raw' coordinates.
Geocoding itself is another research area and also complex ;). You can have a look at nominatim or photon or using the GraphHopper Directions API.
Another more simple solution for your situation could be to get the cities via OSM (parsing xml and find nodes having the tags place=city or town) or using geonames or similar.