Skip to content

Conversation

@dersmon
Copy link
Member

@dersmon dersmon commented Mar 31, 2025

One minor fix for the document view map snuck into the branch. 🙄

  • The new plug relies on libvips instead of imagemagick.
  • It comes with precompiled libvips, so all environments (dev/test/prod) should use the same code, instead of the somewhat hacky development setup with the old solution.
  • There is also no "shelling out of Elixir" to trigger conversions, the preprocessing is now purely Elixir code.

dersmon and others added 29 commits March 24, 2025 15:07
This was a hack to handle the artificially downscaled images used for testopolis in development.
The IIIF Image Plug works on the raw files for the time being.
If the user's preference from localStorage is read, the server needs to be informed about that state in order to correctly display the layer selection.
The IIIF endpoint is now part of the Elixir project itself via `:iiif_image_plug`.
These are not set by Phoenix while running tests, so the image plug returns the default values.
- name: Sleep to await CouchDB startup
run: sleep 15s
- name: Restore dependencies cache
uses: actions/cache@v3
Copy link
Member

Choose a reason for hiding this comment

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

actions/cache@v4 is the most current one, if there's no reason not to, might as well use that?

- name: Sleep to await CouchDB startup
run: sleep 15s
- name: Restore dependencies cache
uses: actions/cache@v3
Copy link
Member

Choose a reason for hiding this comment

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

same here, but your decision

];

const pathTemplate = `/api/image/tile/${projectName}/${info.uuid}/{z}/{x}/{y}`;
const pathTemplate = `/api/image/tile/${projectName}/${info.uuid}/{z}/{y}/{x}`;
Copy link
Member

Choose a reason for hiding this comment

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

okay, just a question: I am used to x,y,z as the order in GIS contexts - but maybe I am thinking of something else here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I used a map tiling preprocesser that is provided by libvips out of the box. Because it is following the same pattern as google maps, the resulting directory structure is basically z/y/x now, instead of z/x/y.

Bildschirmfoto_2025-04-04_15-14-24

base_path = FileService.get_map_tiles_path(name)

Plug.Conn.send_file(conn, 200, "#{base_path}/#{uuid}/#{z}/#{x}/#{y}.png")
Plug.Conn.send_file(conn, 200, "#{base_path}/#{uuid}/#{z}/#{x}/#{y}.webp")
Copy link
Member

Choose a reason for hiding this comment

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

why is the order zxy different here?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, these request parameter variables should be renamed to z,y,x.

Copy link
Member Author

Choose a reason for hiding this comment

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

I reverted to the old API with edf41ef and instead switch the parameters when constructing the file path.

@dersmon dersmon merged commit 31bba49 into master Apr 4, 2025
3 checks passed
dersmon added 3 commits April 4, 2025 15:06
The images in the seed project were initially scaled down in order to not increase the repository size too much. Because of the change to the libvips preprocessing pipeline, the scaled down images now introduce errors because the geometry and other metadata in the database does not match the actual file width/height.
Instead of changing the API, we just switch the file path construction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants