-
Notifications
You must be signed in to change notification settings - Fork 382
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
Support batch-rasterization in rs rasterize
#25
Comments
The rasterize tool is associating and caching all features per tile which probably can get large if you rasterize all at once. Try to split it up and rasterize smaller batches, then combine their output. We probably should look into making this more efficient - if possible. |
Adding here: if you want to run this in batches you need to make sure your batched features are from different areas. Otherwise you will get multiple images for the same tile containing only parts of the features in cases where multiple features are in the same tile. |
I'm not really sure how to split things up myself.
What if rs did it by looping over all the features, reading the existing tile from disk (or creating a new empty tile if it doesn't exist), then just setting ORing the new image with the existing image and then writing it out? It would be slower, but more memory efficient, right? (NB there's a chance I completely misunderstand what this tool does🙂)
…On 12 June 2018 15:36:43 CEST, "Daniel J. H." ***@***.***> wrote:
Adding here: if you want to run this in batches you need to make sure
your batched features are from different areas. Otherwise you will get
multiple images for the same tile containing only parts of the feat? res
in cases where multiple features are in the same tile.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
If I split the input features up myself, I could OR the images myself after the fact.... 🤔🤔 There must be an imagemagick command for that.
…On 12 June 2018 22:21:20 CEST, Rory McCann ***@***.***> wrote:
I'm not really sure how to split things up myself.
What if rs did it by looping over all the features, reading the
existing tile from disk (or creating a new empty tile if it doesn't
exist), then just setting ORing the new image with the existing image
and then writing it out? It would be slower, but more memory efficient,
right? (NB there's a chance I completely misunderstand what this tool
does🙂)
On 12 June 2018 15:36:43 CEST, "Daniel J. H."
***@***.***> wrote:
>Adding here: if you want to run this in batches you need to make sure
>your batched features are from different areas. Otherwise you will get
>multiple images for the same tile containing only parts of the feat?
res
>in cases where multiple features are in the same tile.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
The I would be careful with using tools like ImageMagick. The masks have to be single-channel PNG files. If you want to do this you oculd e.g. use the Pillow library, do Probably easier to do: split your GeoJSON file into multiple files and make sure the features in different files are not for the same tile. You can do this e.g. by having one file per city, or area, or boundary. In case you have features falling into the same tile these have to be rasterized at the same time. |
rs rasterize
rs rasterize
I looked into this again. A common use-case is to batch-extract GeoJSON features from OSM and then batch-rasterize them into mask tiles. In case where features are in the same tile but in multiple GeoJSON files we currently rasterize a single tile. We should extend
This will allow users to batch-rasterize masks without having to load all GeoJSON features into memory. |
When
rs rasterize
runs, the memory usage of the process grows and grows, and on my machine is eventually killed by the linux OOM killer. This is the command I use, which tries to generate 28k mask tiles:The text was updated successfully, but these errors were encountered: