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

Add prompt for multi-export scale AND/OR allow setting this in DistortableCollection constructor #471

Closed
jywarren opened this issue Dec 5, 2019 · 3 comments

Comments

@jywarren
Copy link
Member

jywarren commented Dec 5, 2019

This seems to indicate we can set the scale in options:

startExport: function(opts) {
opts = opts || {};
opts.collection = opts.collection || this._group.generateExportJson();
opts.frequency = opts.frequency || 3000;
opts.scale = opts.scale || 100; // switch it to _getAvgCmPerPixel !

But we don't actually use that, here:

Can we make it possible to set the scale dynamically, either by opening a prompt (what if we said scale defaults to a prompt instead of 100?) or by allowing people to pass a function to determine the scale, as a DistortableCollection constructor option? cc @sashadev-sky what do you think?

@sashadev-sky
Copy link
Member

@jywarren I think that was why we held off on docs for the exporter - we were still thinking about how we could make the function customizable without having to re-write the whole action like we did in MK. because we don't have any API for passing options to actions. So we would need to build that.

Also the prompt is really good idea. The prompt could be a GCI issue? The API for passing options to actions would probably be more of a longer consistent effort than a typical GCI task but could be a hall of fame?

@jywarren
Copy link
Member Author

jywarren commented Dec 5, 2019

Yeah this could probably be a GCI issue! I think it's necessary to publish the new MapKnitter version, because with scale pegged to 100 px per cm, if you are mapping a large area like a city block, maps are HUGE files (15000 x 15000 px) and if you're mapping a small area like a garden, they're tiny... 300x300px.

Example of huge -- our exporter can handle this, which the legacy exporter cannot! This is about 15000x8000px:

http://mapknitter-exports-warps.storage.googleapis.com/1575518821/1575518821.jpg

So, we should set it to 100 by default but let people modify it.

Later, we should make a rough calculation -- can we get the bounds of the collection? If so, we could do a rough suggested calculation to offer an initial export scale that generates a roughly 1000x1000px image. Note above it says opts.scale = opts.scale || 100; // switch it to _getAvgCmPerPixel ! which would indeed offer a scaled suggested default!

But let's just get the basic prompt working first!

Could we just literally modify that line:

   opts.scale = opts.scale || 100; // switch it to _getAvgCmPerPixel ! 

so instead of 100, it's prompt("Choose a scale or use the default (cm per pixel):", 100) ?

That'd be a great initial step; later we can offer an override.

@jywarren
Copy link
Member Author

Done in #478!

@sashadev-sky sashadev-sky unpinned this issue Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants