coderholic / django-cities

Countries and cities of the world for Django projects
MIT License
913 stars 377 forks source link

only import names from certain language #101

Closed debuggerpk closed 7 years ago

debuggerpk commented 8 years ago

is there a way that we can use specify the city names langauge during import?

because for me, this query is certainly harder

City.objects.filter(country__name='Pakistan').get(alt_names__name__icontains='Multan', alt_names__language='en')

instead of doing a name lookup. The reason i had to it this way because, the fault name for Multan in the geonames database is Multān, which is wrong.

//ysf

coderholic commented 8 years ago

Is the example lookup what you're currently doing? What would you like to be able to do?

debuggerpk commented 8 years ago

The problem is, default name for my country is wrong, for example Multan is stated as Multān, it is not spelled like that. The same is the case for all the citites in my country.

So to get the right name, i had to formulate the above query.

The second apporach for me is to right a migration script to update each row for my country, and run it every time the cities data gets updated.

//ysf

coderholic commented 8 years ago

The name without the diacritic is available as name_std:

>>> city = City.objects.filter(country__name='Pakistan').get(name_std='Multan')
>>> city
<City: Multān>
>>> city.name
u'Mult\u0101n'

It sounds like you're saying the diacritic is incorrect and doesn't belong there though. The official page seems to confirm that: http://www.multan.gov.pk/. You should report this back to our source data provider http://www.geonames.org

debuggerpk commented 8 years ago

oh .. thanks .. and will report

debuggerpk commented 8 years ago

i have posted this at forums for correction, lets see where this leads to.

http://forum.geonames.org/gforum/posts/list/20240.page

blag commented 7 years ago

You should be able to modify the GeoNames data directly after creating an account and logging in.

Furthermore, importing a subset of the names is something that could be done with a plugin. Please see the documentation on writing plugins and the example plugins for how to create your own.

And if you think the plugin would be helpful for other people, please consider creating a PR for it.

Thanks! Closing.