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(parser): add a TIFF parser using utif #1131

Merged
merged 2 commits into from
Jun 24, 2019
Merged

Conversation

zarov
Copy link
Contributor

@zarov zarov commented May 9, 2019

It automatically rejects TIFFs that are bigger than 4096x4096, because
it is the minimum that is supported on 99.99% of the devices.

@zarov zarov added ready ✔️ feature 🍏 Adds a new feature labels May 9, 2019
for (let j = 0; j < rowSize; j += alpha) {
resizedData[rowOffset + j] = it.next().value;
resizedData[rowOffset + j + 1] = it.next().value;
resizedData[rowOffset + j + 2] = it.next().value;
Copy link
Contributor

Choose a reason for hiding this comment

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

the alpha isn't take in account?

Copy link
Contributor Author

@zarov zarov May 9, 2019

Choose a reason for hiding this comment

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

It is set to 255 before this loop, I didn't add it here because it needs a if.

src/Parser/TIFFParser.js Outdated Show resolved Hide resolved
src/Parser/TIFFParser.js Outdated Show resolved Hide resolved
src/Parser/TIFFParser.js Outdated Show resolved Hide resolved
itowns.Fetcher.arrayBuffer('https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/tiff/FLAG_T24.TIF')
.then(itowns.TIFFParser.parse)
.then(function _(texture) {
texture.coords = new itowns.Coordinates('EPSG:4326', 1.4116667, 43.6074422);
Copy link
Contributor

Choose a reason for hiding this comment

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

The texture.coords have bad name, because it's actually a Extent.
this Extent allows you to place the texture on the tiles. In particular with initialization from parent texture.

There are little changes to enhance the image display.

  • Use Extent insteaf of Coordinates, and add it a zoom property to set image scale.
  • Add a layer property : use imageParent after zoom max to always display the ColorLayer after the Source.zoom.max.

Copy link
Contributor Author

@zarov zarov May 9, 2019

Choose a reason for hiding this comment

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

This needs another change in MaterialLayer as well.

Add a layer property : use imageParent after zoom max to always display the ColorLayer after the Source.zoom.max.

I don't understand what you mean here

Copy link
Contributor

Choose a reason for hiding this comment

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

A ColorLayer isn't displayed when Source.zoom.max is exceeded, it isn't the expected behaviour because the ColorLayer displaying shouldn't be controlled by the source.

@gchoqueux gchoqueux added this to the 2.11.0 milestone May 10, 2019
@zarov
Copy link
Contributor Author

zarov commented May 17, 2019

Updated, with a tiled example (the same as https://www.itowns-project.org/demo-geoid/) but needs #1126 and #1142 to be merged first.

@zarov zarov added wip 🚧 Still being worked on and removed ready ✔️ labels May 17, 2019
@gchoqueux gchoqueux modified the milestones: 2.11.0, 2.12.0 Jun 4, 2019
@zarov zarov added ready ✔️ and removed wip 🚧 Still being worked on labels Jun 19, 2019
@zarov
Copy link
Contributor Author

zarov commented Jun 19, 2019

Now that all others things have been merged, this PR is now ready !

Copy link
Contributor

@gchoqueux gchoqueux left a comment

Choose a reason for hiding this comment

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

It should be interesting to create a itowns plugin to support Tiff.

examples/tiff.html Outdated Show resolved Hide resolved
src/Parser/TIFFParser.js Outdated Show resolved Hide resolved
src/Parser/TIFFParser.js Outdated Show resolved Hide resolved
Added a method to check the maximum texture size in the same time.
It automatically rejects TIFFs that are bigger than 4096x4096, because
it is the minimum that is supported on 99.99% of the devices.

https://github.com/photopea/UTIF.js
https://www.npmjs.com/package/utif
@zarov
Copy link
Contributor Author

zarov commented Jun 20, 2019

Updated and rebased, I moved the parser to be a plugin. I also exposed the Capabilities class in the same time. In a next PR I'll start cleaning the examples/ folder, because the plugins are hard to see.

@zarov zarov merged commit 5a36f93 into iTowns:master Jun 24, 2019
@zarov zarov deleted the tiff-parser branch June 24, 2019 06:09
@mbredif mbredif mentioned this pull request Jun 26, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🍏 Adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants