Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): country geocoding for remote locations #10950

Merged
merged 12 commits into from
Jul 18, 2024

Conversation

pokjay
Copy link
Contributor

@pokjay pokjay commented Jul 7, 2024

Add country reverse geocoding in case city geocoding is null. Uses country boundaries from Natural Earth

Dependencies

base-images PR: immich-app/base-images#80

Database changes:

  1. Create new table naturalearth_countries with country polygons. Each country will have a row for each polygon.

Server changes:

  1. Load geojson file to database
  2. When city geocoding fails, fallback to geocode using country polygon

Note - this uses the current geocoding state metadata for DB import

Web UI changes:

  1. Allow showing partial location info in asset panel in cases where there is no city:
    Screenshot 2024-07-07 at 22 54 03

@zackpollard zackpollard changed the title feat(server): Country geocoding for remote locations feat(server): country geocoding for remote locations Jul 17, 2024
@@ -134,7 +138,29 @@ export class MapRepository implements IMapRepository {
this.logger.warn(
`Response from database for reverse geocoding latitude: ${point.latitude}, longitude: ${point.longitude} was null`,
);
return null;

const ne_response = await this.naturalEarthCountriesRepository
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change the above condition to return if it has a response. Then, de-indent all of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the code. Definitely makes it clearer!

@zackpollard zackpollard enabled auto-merge (squash) July 18, 2024 10:45
@zackpollard zackpollard merged commit 4f89195 into immich-app:main Jul 18, 2024
22 checks passed
@mschiff
Copy link

mschiff commented Jul 23, 2024

What needs to be done after an upgrade to 1.109 in order to make use of this for existing images?

@zackpollard
Copy link
Contributor

What needs to be done after an upgrade to 1.109 in order to make use of this for existing images?

Re-running the extract metadata job for all images should do it 🙂

@mschiff
Copy link

mschiff commented Jul 23, 2024

What needs to be done after an upgrade to 1.109 in order to make use of this for existing images?

Re-running the extract metadata job for all images should do it 🙂

Thanks! I think this would be worth mentioning in the changelog/release notes for such kind of change, thanks for helping! Much appreciated!

@pokjay pokjay deleted the feat/remote-location-geocoding branch August 3, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants