-
-
Notifications
You must be signed in to change notification settings - Fork 218
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 basic cog support #1590
base: main
Are you sure you want to change the base?
Add basic cog support #1590
Conversation
cf4ac6f
to
e6536e4
Compare
eb5ed75
to
15ce642
Compare
You could made a quick check that the tiles is where it should be. configuration file keep_alive: 75
# The socket address to bind [default: 0.0.0.0:3000]
listen_addresses: '0.0.0.0:3000'
# Number of web server workers
worker_processes: 8
# Amount of memory (in MB) to use for caching tiles [default: 512, 0 to disable]
cache_size_mb: 8
# Database configuration. This can also be a list of PG configs.
cog:
paths:
- tests/fixtures/cog npm create ol-app my-app
cd my-app
npm start Copy below to replace the import './style.css';
import { Map, View } from 'ol';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import XYZ from 'ol/source/XYZ.js';
import TileGrid from 'ol/tilegrid/TileGrid.js';
// the tiling schema could be GoogleMapsCompatible, see https://gdal.org/en/latest/drivers/raster/cog.html#reprojection-related-creation-options
var custom_grid = new TileGrid({
extent: [
1620750.2508,
4271892.7153,
1625870.2508,
4277012.7153],
resolutions: [
80,
40,
20,
10],
tileSize: [256, 256],
origin: [1620750.2508, 4277012.7153]
});
var source = new XYZ({
url: "http://10.1.155.35:3000/rgb_u8/{z}/{x}/{y}", tileGrid: custom_grid
});
const map = new Map({
target: 'map',
layers: [
new TileLayer({
source: new XYZ({
url: 'https://api.maptiler.com/maps/basic/{z}/{x}/{y}.png?key=vgdy5zgzM4IIqQCC6SOn',
attributions: '© MapTiler © OpenStreetMap contributors'
})
}),
new TileLayer({
source: source
}),
],
view: new View({
center: [(1620750.2508 + 1625870.2508) / 2, (4271892.7153 + 4277012.7153) / 2],
zoom: 14
})
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good to me.
I have left a few comments below.
@nyurik Yes they are seperated. COG and GeoTIFF are all valid tiff files. GeoTIFF extend the tiff tags (something like key-value paris) to save some spatial informations. COG is based on the GeoTIFF standard and does not introduce additional capabilities to the TIFF v6. And some requirements/recommendation are introduced in COG(still valid tif and geotiff then) like:
|
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
Any update? @nyurik @CommanderStorm |
This comment was marked as resolved.
This comment was marked as resolved.
I'm a little bit worried about the Squared Not Squared If it's not square, we should adjust the output png size based on the resolution of X or Y and we should tell user the resolution we picked in our tilejson. I will make a proposal in #875 # with gdalinfo you could check the pixelsize
gdalinfo /path/to/some.tif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my POV there are no things left to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there! Please fix the tiny nits i listed, and feel free to merge
File::open(&self.path).map_err(|e| FileError::IoError(e, self.path.clone()))?; | ||
let mut decoder = | ||
Decoder::new(tif_file).map_err(|e| CogError::InvalidTifFile(e, self.path.clone()))?; | ||
decoder = decoder.with_limits(tiff::decoder::Limits::unlimited()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meh, should be ok i guess?
seems like all is good, feel free to merge once it passes - although something tells me there is an issue with the current main branch due to some tests failing there |
And huge thanks for such a hard work on this! |
Try to fix #875 . Still a draft and a lot to discuss and finish.
Color types and bits per smaple
Comporession
The crate we used support these methods.
Some terms and ref links
7.1.2 Tiles in COG spec
Tiff 6.0 spec page 67
Chapter 4 of COG spec
Tile and padding