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

Calculate and display exported image dimensions from selected cm/px export resolutions #1320

Open
jywarren opened this issue May 24, 2020 · 2 comments
Labels

Comments

@jywarren
Copy link
Member

jywarren commented May 24, 2020

Some maps are stalling and hitting on the right resolution isn't easy. See these 2 stalled maps:

image

Note we don't see output resolution until they're complete, and they probably crashed or stalled.

We should be able to calculate at least roughly what the output dimensions in pixels would look like for a given cm/px export, using the new cloud exporter.

Let's try to use the image collection bounds and the cm/px to estimate the output dimensions. We can even say that 10cm/px would result in HxW dimensions and 100 in HxW - in the dialog box where you enter the resolution.

Here is the calculation for x,y pixel dimensions in Ruby, from the exporter code:

https://github.com/publiclab/mapknitter-exporter/blob/db65afbbeccdecedc3c50fa43bbeea3103f3d546/lib/mapknitterExporter.rb#L66-L70

The full exact calculation can be found in this file, using the Proj4.js library to calculate latitude,longitude => x,y projection:

https://github.com/publiclab/image-sequencer-app/blob/fad302f2d15745414bb362f28806a8568b4001c3/src/api/v2/util/converter-multiSequencer.js#L53-L61

This code is a bit tangled up but we could pull out the relevant portions into a JS function that accepts scale and a set of lat/lon bounds, and outputs x,y dimensions. This would be a great first step!

@roli25
Copy link

roli25 commented Apr 2, 2022

@jywarren Can I work on this?

@jywarren
Copy link
Member Author

jywarren commented Apr 6, 2022

Hi @roli25 sure we'd love your help with this. How would you approach the calculation, do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants