Alexander Stolte Expert Licensed User Longtime User Dec 18, 2018 #1 Hello, to save a lot of money i have a good idea, but first my current situation: in my Android and IOS App i use the current location (lat, lon) to post local content between the users. Currently i use the google geocode api to get the city name on the client side, but to access such a api is expensive if i have a lot of user. And users are often on the same lat lon coordinates. My idea: save the city name togehter with the lat lon coordinates and check in a range of 250 meters if there is already a city in this range in the database, IF NOT then i would call a B4J Server handler to call the geocode api to get the cityname. Is this a good idea? I expect at the beginning high traffic, on this method maybe 20 request per second. Does anyone already have experience using a server to call the city names via an api? Greetings
Hello, to save a lot of money i have a good idea, but first my current situation: in my Android and IOS App i use the current location (lat, lon) to post local content between the users. Currently i use the google geocode api to get the city name on the client side, but to access such a api is expensive if i have a lot of user. And users are often on the same lat lon coordinates. My idea: save the city name togehter with the lat lon coordinates and check in a range of 250 meters if there is already a city in this range in the database, IF NOT then i would call a B4J Server handler to call the geocode api to get the cityname. Is this a good idea? I expect at the beginning high traffic, on this method maybe 20 request per second. Does anyone already have experience using a server to call the city names via an api? Greetings
MarkusR Well-Known Member Licensed User Longtime User Dec 18, 2018 #2 Germany ~ (1000 x 1000 km) have ~2100 citys, not much. if you would collect the data by click around the borders each one minute u need 35 hours maybe u can extract the borders (geofence) from a web api request at open street map? (steal) or u can live with a nearest city, just the middle of the city in lat,lon. its really necessary to have the exact city from user? the best solution is to be independent. (not addicted from google,apple,ms,amazon) i think a small sqlite database can store all that u do not need a web request. Last edited: Dec 18, 2018 Upvote 0
Germany ~ (1000 x 1000 km) have ~2100 citys, not much. if you would collect the data by click around the borders each one minute u need 35 hours maybe u can extract the borders (geofence) from a web api request at open street map? (steal) or u can live with a nearest city, just the middle of the city in lat,lon. its really necessary to have the exact city from user? the best solution is to be independent. (not addicted from google,apple,ms,amazon) i think a small sqlite database can store all that u do not need a web request.
Alexander Stolte Expert Licensed User Longtime User Dec 18, 2018 #3 MarkusR said: Germany ~ (1000 x 1000 km) have ~2100 citys, not much. Click to expand... I have at my Database a dump from the city names from GeoNames. But i cant live with near by, because if a user live in Halle (Saale) for example i dont want to show him in Kabelsketal, because the nearest lat lon in the database are in Kabelsketal. Yes it is necessary to have the exact (~250 meters) city. MarkusR said: the best solution is to be independent. (not addicted from google,apple,ms,amazon) Click to expand... i think so too, but i dont think it is possible without it. Upvote 0
MarkusR said: Germany ~ (1000 x 1000 km) have ~2100 citys, not much. Click to expand... I have at my Database a dump from the city names from GeoNames. But i cant live with near by, because if a user live in Halle (Saale) for example i dont want to show him in Kabelsketal, because the nearest lat lon in the database are in Kabelsketal. Yes it is necessary to have the exact (~250 meters) city. MarkusR said: the best solution is to be independent. (not addicted from google,apple,ms,amazon) Click to expand... i think so too, but i dont think it is possible without it.
DonManfred Expert Licensed User Longtime User Dec 18, 2018 #4 https://www.dropbox.com/s/n29d68smo6glnok/germancities.zip?dl=0 The file contains 70478 German cities as CSV with lat/lon. Should be a good start. Add them to a database and then query them based on a given Lat/lon from the DB with a radius. Upvote 0
https://www.dropbox.com/s/n29d68smo6glnok/germancities.zip?dl=0 The file contains 70478 German cities as CSV with lat/lon. Should be a good start. Add them to a database and then query them based on a given Lat/lon from the DB with a radius.
MarkusR Well-Known Member Licensed User Longtime User Dec 18, 2018 #5 hmm, 1000 km / 0,250 km = 4000 x 4000 = 16.000.000 Datas. if the city is bigger maybe it helped if u add more points to get the best nearest. its better to have a sub that check intersection point in polygon, but i thinks its complicated to solve. Upvote 0
hmm, 1000 km / 0,250 km = 4000 x 4000 = 16.000.000 Datas. if the city is bigger maybe it helped if u add more points to get the best nearest. its better to have a sub that check intersection point in polygon, but i thinks its complicated to solve.
DonManfred Expert Licensed User Longtime User Dec 18, 2018 #6 To be complete: the complete file (WORLD) is here: https://www.dropbox.com/s/hs3dxoij4xncfsv/worldcitiespop.txt.gz?dl=0 Upvote 0
To be complete: the complete file (WORLD) is here: https://www.dropbox.com/s/hs3dxoij4xncfsv/worldcitiespop.txt.gz?dl=0
DonManfred Expert Licensed User Longtime User Dec 18, 2018 #7 probably you should get an Openstreetmap Database-Snapshot and use with this data. I think this is the most complete free Database. https://wiki.openstreetmap.org/wiki/DE:Datenbank Upvote 0
probably you should get an Openstreetmap Database-Snapshot and use with this data. I think this is the most complete free Database. https://wiki.openstreetmap.org/wiki/DE:Datenbank
Alexander Stolte Expert Licensed User Longtime User Dec 27, 2018 #8 I have now my own Openstreetmap-Server, setting up with Nominatim and with the latest database from Geofabrik.de. So i can build my own B4J API to get the results I want. The Documentation from Nominatim is very good, that you can install everything without problems. Upvote 0
I have now my own Openstreetmap-Server, setting up with Nominatim and with the latest database from Geofabrik.de. So i can build my own B4J API to get the results I want. The Documentation from Nominatim is very good, that you can install everything without problems.