Replies: 5 comments
-
I found vips dzsave for this |
Beta Was this translation helpful? Give feedback.
-
So it looks like the --layout Google option doesn't actually build web mercator map tiles. Has anyone gotten this to work with web mercator projection? |
Beta Was this translation helpful? Give feedback.
-
For example: #!/usr/bin/python3
import sys
import pyvips
image = pyvips.Image.new_from_file(sys.argv[1])
if not image.hasalpha():
image = image.addalpha()
# this makes an image where pixel (0, 0) (at the top-left) has value [0, 0],
# and pixel (image.width, image.height) at the bottom-right has value
# [image.width, image.height]
index = pyvips.Image.xyz(image.width, image.height)
# move the origin to the centre, negative values up and left,
# positive down and right
centre = index - [image.width / 2, image.height / 2]
# to polar space, so each pixel is now distance and angle in degrees
polar = centre.polar()
# scale sin(distance) by 1/distance to make a wavey pattern
d = 10000 * (polar[0] * 3).sin() / (1 + polar[0])
# and back to rectangular coordinates again to make a set of vectors we can
# apply to the original index image
distort = index + d.bandjoin(polar[1]).rect()
# distort the image
interp = pyvips.Interpolate.new("bicubic")
distorted = image.mapim(distort, interpolate=interp)
distorted.write_to_file(sys.argv[2]) Makes images like this: Just plug in your reprojection formula and write with |
Beta Was this translation helpful? Give feedback.
-
I don't think this is what I'm looking for. The aerial raster is already geo referenced to a coordinate system. So I know the x,y of each corner. What I need is a conversion from map coord to image coord. So that I can scale the image up or down and make tiles out of it. |
Beta Was this translation helpful? Give feedback.
-
Exactly, if you can write a formula for how your input and output pixel coordinates relate to each other, If all you need to do is resize, translate, or rotate, then there are quicker methods. |
Beta Was this translation helpful? Give feedback.
-
Has anyone seen or used libvips to process gis raster tifs to a tile cache in a WMTS format? Currently the best opensource tiler is gdal2tile.py. But it depends on python and isn't very performant. These are tiles used in web maps.
Beta Was this translation helpful? Give feedback.
All reactions