igaster / laravel_cities

Find any country/city in the world. Get Long/Lat etc. Deploy geonames.org database localy. Optimized DB tree
MIT License
179 stars 65 forks source link

Filter only citites #18

Closed tylik1 closed 6 years ago

tylik1 commented 6 years ago

Hi, this looks more like a question, then a bug I've noticed in readme, that you retrieved U.S. States. I wonder is it possible to search only for city types, but not regions, or states? Thanks

tylik1 commented 6 years ago

I think i found answer on geonames.org website. For anyone interested, here is the link with geoname features codes https://www.geonames.org/export/codes.html

You'd also need to add needed code in seedGeoFile: https://github.com/igaster/laravel_cities/blob/master/src/commands/seedGeoFile.php#L78

igaster commented 6 years ago

Did you check for the 'ADM3' level which is included in the seeded data? Usually this is a city in some countries. I don't know if geonames specifficaly has some explicit code for cities...

tylik1 commented 6 years ago

PPL, PPLA, PPLA2 worked for me. I made a check for population > 15k, otherwise the database would be huge.

Also had to increase memory limit inside seedGeoFile/@handle, for script not to break, as it ran into memory issues. ini_set("memory_limit", "-1");

Thanks for the script, It's a real life saver!