Code Monkey home page Code Monkey logo

Comments (3)

hillsonghimire avatar hillsonghimire commented on June 4, 2024

I suspect the issue might be due to pixel bleeding a little outside the initial input data bounds.
image

Potential solution:

  1. Equal padding the input on all side in tile generating step, so that the width or height = (tile_size * stride_x or stride_y)
  2. After merging remove the extra padding.

image

from geotile.

hillsonghimire avatar hillsonghimire commented on June 4, 2024
k=-1
for j in range(y_gen):
    for i in range(x_gen):
        k=k+1
        z[i*stride_x:(i+1)*stride_x, j*stride_y:(j+1)*stride_y]=tile_dta[k]

// WRITE CODE TO UPDATE **height**, and **width** in **self.meta:**
// **width=new_width, height=new_height**, before using in block below:

with rasterio.open('output.tif', "w",  **self.meta) as outds:
        outds.write(z.astype('uint8'))

pyplot.imshow(z)

As suspected the issue is due to width and height not updated in the **self.meta before writing. I was able to regenerate the image with above modification. Also the performance was greatly improved by first reconstructing the numpy array from tile (since both doesn't have coordinate, it makes sense as well), then writing it on the file, instead of for loop in reading and writing operation, which is more resource intensive.

image

Disc: notice slight padding at the bottom and right after the operation.

from geotile.

iamtekson avatar iamtekson commented on June 4, 2024

For now, I am simply saving all the generated tiles into a new folder and mosaicing it by using gt.mosaic() function. Yes, you are right, we have some issues in merge_tile method and I feel like we need to rewrite the function. So, were you able to solve the issue? if yes, please send a PR.

from geotile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.