Coder Social home page Coder Social logo

Comments (8)

mertalev avatar mertalev commented on September 26, 2024

This is not so much an incorrect classification as it is the fact that we're trying to squeeze four fields (name, admin1Name, admin2Name, country) into three (city, state, country). The "name" part is inconsistent: sometimes it's a city, sometimes it's a neighborhood. admin2Name is also similarly sometimes a county and sometimes a city.

Concatenating admin1Name and admin2Name as the "state" is what we've gone with for now, but it isn't perfect, as you've noticed. Maybe concatenating the name and admin2Name fields would make more sense since they're more "city-like"; admin1Name is generally consistent in being a state/province.

from immich.

mertalev avatar mertalev commented on September 26, 2024

To give an example, admin1Name is New York (the state), admin2Name is Kings County, and then there are a bunch of neighborhoods like Brooklyn Heights for the name. So let's say we change it to show admin2Name, admin1Name and the country to get Kings County, New York, US. Now if you search for the city "Marseille", you'll get no results because it's listed as a name and admin2Name in this case is a department.

from immich.

hermesespinola avatar hermesespinola commented on September 26, 2024

I wasn't sure how Immich is doing the reverse geocoding (and I'm still not 100% sure), but I see you have downloaded the txt files from https://download.geonames.org/export/dump/readme.txt. Is name coming from the file cities500.txt?

First off, I only have context on how this work in the US and Mexico, so I don't know if this is how other countries geographical areas are organized.

Reading the geoNames docs, it seems like admin1Name is considered the first level division of a country, so, at least in the US and Mexico, that's always a state:

grep "US\..*" admin1CodesASCII.txt 
US.AR	Arkansas	Arkansas	4099753
...
US.VA	Virginia	Virginia	6254928

As for admin2, again, in Mexico and the US, second level divisions are counties or municipalities which are not cities, while they are sometimes interchangeable and/or have the same name, using NY as an example:

grep "US\.NY\..*" admin2Codes.txt 
US.NY.001	Albany County	Albany County	5106841
...
US.NY.047	Kings County	Kings County	6941775

What's more, all end in "County". So this doesn't seem useful for Immich, at least not within the 3 location subdivisions that Immich uses.

In cities500.txt it seems there are any other sub-divisions, including neighborhoods, residential areas, etc.
In my examples "Brooklyn Heights" has the P tag "PPLX" which according to geonames docs it's a "Section of a populated place". In the case of NYC, NYC has the PPL tag, and each of the boroughs has the PPLA2 tag. (i.e.: Brooklyn, Bronx, etc.).

As for the Mexico example, "Paseos del Valle [Fraccionamiento]" is listed with "PPL". Then "Tlajomulco de Zuñiga" (which immic got from admin2 according to what you described) is the municipality, not the city, which would be again wrong, if it had a different name to the city. There's a "Tlajomulco de Zuñiga" entry in countries500.txt with the tag "PPLA2" which refers to the actual city :)

from immich.

hermesespinola avatar hermesespinola commented on September 26, 2024

TL;DR; For "City" it seems to me it'd be good to always exclude PPLX places, as they seem to refer to not cities, prefer to use any tags more specific than PPL, and fallback to PPL otherwise. For State admin1CodesASCII.txt looks to be perfect. But I wonder if this would be a good generalization for other countries as well. I might be interested in contributing to improve this functionality if possible

from immich.

mertalev avatar mertalev commented on September 26, 2024

That's a great idea! We don't even ingest these tags into the database, much less use them. For reference, we ingest the geodata here and do the reverse geocoding here.

from immich.

bo0tzz avatar bo0tzz commented on September 26, 2024

cc @zackpollard, you had ideas about improving the geocoder detail level right?

from immich.

zackpollard avatar zackpollard commented on September 26, 2024

cc @zackpollard, you had ideas about improving the geocoder detail level right?

Yea, we do have a lot more detailed data available to us, however it needs a lot of sanitisation to be usable for what we want. It should offer some quite significant improvements to accuracy, especially when in built up areas though.

from immich.

zackpollard avatar zackpollard commented on September 26, 2024

As for the comments above, yea I have also noticed this behaviour previously, if there is a quick improvement we can make here with that date then I think it would be good to do it, but also yes let's check a few other countries to see if it's the same for them too.

from immich.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.