More

Ignore empty tiles in gdal2tiles.py when generating tiles

Ignore empty tiles in gdal2tiles.py when generating tiles


I am in the process of generating a large set of tiles from a .vrt file composed of many images. The image is following a road section, being very long and small strip of images and due the shape of the road the bounding box around it contains a ratio of 80% no data and 20% beign the actually road. This means gdal2tiles takes forever since its looping over all tiles in the boundingbox and not just the area that has data.

Is there any way to tell gdal2tiles to skip those tiles?

Alternative I have split the vtr file into lesser areas but then in the intersection of the two tiles sets that I need to combine after the two sets has tiles defined for the same area with half filled map and nodata and taking either of them causes the map to have big black stripes down in between.

Any suggestions to make this go more smooth?


gdal2tiles -xoption will exclude empty tiles.

https://github.com/OSGeo/gdal/blob/master/gdal/swig/python/scripts/gdal2tiles.py#L1141


How do I prevent my platformer's character from clipping on wall tiles?

Currently, I have a platformer with tiles for terrain (graphics borrowed from Cave Story). The game is written from scratch using XNA, so I'm not using an existing engine or physics engine.

The tile collisions are described pretty much exactly as described in this answer (with simple SAT for rectangles and circles), and everything works fine.

Except when the player runs into a wall whilst falling/jumping. In that case, they'll catch on a tile and begin thinking they've hit a floor or ceiling that isn't actually there.

In this screenshot, the player is moving right and falling downwards. So after movement, collisions are checked - and first, it turns out the player character is colliding with the tile 3rd from the floor, and pushed upwards. Second, he's found to be colliding with the tile beside him, and pushed sideways - the end result being the player character thinks he's on the ground and isn't falling, and 'catches' on the tile for as long as he's running into it.

I could solve this by defining the tiles from top to bottom instead, which makes him fall smoothly, but then the inverse case happens and he'll hit a ceiling that isn't there when jumping upwards against the wall.

How should I approach resolving this, so that the player character can just fall along the wall as it should?


3 Answers 3

You're on the right track. However.

O(n*m) runtime is typical with something like this. Your implementation is a bit excessive, however. The real question is, What is making your O(n*m) algorithm take so long?

Why bother to run through every map cell for each influence? It would be faster to have each starting influence also specify some random maximum radius within which it could affect map cells. At the start, store the position of the influence AND it's radius. Then, for each "plate" (influence), attempt to write cell color only within that radius.

Cell-based Voronoi will similarly be O(n*m) if using a similarly naive approach, since you must run through all Voronoi centres for all map cells.

For the approach described above:

  1. Radius-based distance checks use a square root which can be relatively costly use either a radius look-up table to avoid square root calculations, or use rectangular [x,y] bounds range-check for early termination, only checking radius / sqrt once you fall within those [x,y] bounds.
  2. Optimal average radius is going to be based on your average influence point spacing. this is something I leave for you to figure out, as it depends on how you have distributed your initial points.
  3. Some empty cells will remain since radii will not cover all map cells. You can fill these out relatively cheaply in a final step, by taking the colour of a random, populated neighbour.

(1) profile your code and (2) optimise:

  • remove conditionals, the more deeply-nested they are the more impact this will have
  • pack your data tightly and in a cache-friendly fashion (anything from using simple sub-grids to a Hilbert curve or Z-curve).

Unfortunately, to get to closer to O(n) , you would need a continuous function that creates distinct regions of adjacent, uniquely-coloured cells. If anyone knows of such an approach, I would love to hear about it, but I know of no such algorithm. There may be a way to adapt Perlin noise (continuous function) to do this, but not without a significant amount more effort and complexity. Usually, simplicity is best, so I suggest sticking with and optimising your current nested approach.


To save rendered images with transparent background (PNG format for instance), the settings are as follows for "Cycles" and "Blender Render" rendering engines.

Properties Editor > Render Context > Output Panel

Choose RGBA so that the alpha from the renderer is saved in the png

Properties Editor > Render Context > Film Panel

Check Film>Transparent so that the World background is transparent.


Deep map, Python

Goal: apply fn to every element of an arbitrarily nested iterable (tuple, list, dict, np.ndarray), including to iterables. Ex:

deeplen should also be a special case of deepmap , with proper fn (just a demo, don't care for optimizing this):

My working implementation, along tests, below. Unsure this works without OrderedDict (Python >=3.6 default) it does if key order doesn't change even as values are changed (but no keys inserted/popped). A resolution is appending actual Mapping keys to key instead of their index, but this complicates implementing. (As for why pass key to fn : we can implement e.g. deepequal , comparing obj against another obj this requires key info. Also deepcopy .)

Any improvements? I haven't tested exhaustively - maybe there are objects for which this fails, hence subject to extendability. Performance/readability could be better also.

Visualization: deepmap traverses a nest left-to-right, inward-first: (code)

  • Purple: fn applied to iterable / element
  • Blue: tuple() applied to list
  • Green: list() applied to tuple
  • Grey: iterable exit dropping key[-1] and decrementing depth - no operation
  • Green + Purple: fn(item) is only assigned to list -cast tuple no 'intermediate' state
  • Empty: see placement of print in linked code this is to show effect of list+fn

Implementation: live demo

deepmap failed with empty iterables, e.g. [] , <> - fixed, tests updated. Also added invalid input handling.

Improved nonempty_iter to use try-iter , and applied it as check on obj at input. Unsure what test to add as my use-case is TensorFlow - a more general suggestion is welcome.


GDAL 1.10.0 - Overview of Changes

  • CPL Thread API: add condition API, modeled on POSIX pthread_cond_ API
  • Add CPLGetNumCPUs()
  • Deserialize various forms of textual representation for positive/negative infinity
  • Add routine to validate a XML file against its XSD schema (needs libxml2) 'optimize' it for GML files
  • CPLRecodeStub(): for Windows, provide an implementation of UTF8 <--> CPxxx conversions using Windows API
  • Make VSIFileManager::Get() thread-safe
  • Fix thread-safety of CPLOpenShared() (#4848)
  • Add CPLZLibDeflate() and CPLZLibInflate()
  • Add API for OAuth2 authentication protocol.
  • Curl: allows setting the CURLOPT_PROXYAUTH setting through GDAL_PROXY_AUTH=BASIC/NTLM/DIGEST/ANY, allow setting CURLOPT_HTTPAUTH through GDAL_HTTP_AUTH=BASIC/NTLM/GSSNEGOTIATE/ANY (#4998)
  • /vsicurl/ and /vsicurl_streaming/ : make it possible to cache the files in RAM with VSI_CACHE = TRUE
  • /vsizip/: fix handling of Eof() that could cause missed last feature(s) of zipped shapefiles (#4748)
  • Add a DMD_SUBDATASETS driver metadata, and advertize it in relevant drivers (#4902)
  • Fix statistics computation when nodata value is +/- infinity (#4506)
  • GDALNoDataMaskBand: implement IRasterIO() for an optimization in common use case (#4488)
  • GDALVersionInfo(): add BUILD_INFO version string
  • GMLJP2: Fix bad interpretation when Lat/Long? (#4657)
  • Set nodata value when creating external overviews so that AVERAGE algorithm works as expected (#4679)
  • EXIFExtractMetadata() moved to gcore/gdalexif.cpp to make it usable for other drivers
  • Fix infinite recursion in GDALOpen() (#4835)
  • GDALRasterBand::IRasterIO() : optimize downsampling/upsampling code path
  • C API: make GDALSetDefaultRAT() accept a NULL RAT. All drivers are ready for that now.
  • GDALRasterBand::GetDefaultHistogram?(): change how min and max bounds are computed in the non GDT_Byte case
  • GDALDataset::BlockBasedFlushCache?(): fix crash when band has sub-blocking
  • GSOC Image Correlator work (preliminary state)
  • Warp: divide Lanczos resampling time by at least a factor of 4.
  • Warp: add NUM_THREADS warping option to set the number of threads to use to parallelize the computation part of the warping
  • Warp: do not stop collecting chunks to operate on just because some subchunks fail (#4795)
  • Warp: add mode and average resampling methods (#5049)
  • OpenCL warper: handle errors in set_supported_formats(), fix memory leaks in error code paths, add detection of Intel OpenCL (by the way, Intel OpenCL seems to work properly only with a Float32 working data type)
  • OpenCL warper: fix segmentation fault related to source/destination validity masks (#4840)
  • Geoloc: do not trust pabSuccess in geolocation transformer (#4794)
  • Geoloc: add bilinear interpolation of coordinates from backmap (#4907)
  • Geoloc: add GDALTransformGeolocations() and SWIG binding
  • Add nearest neighbor and cubic interpolation of DEM in GDALRPCTransform (#3634). User can set RPC_DEMINTERPOLATION to near, bilinear or cubic to interpolate of input DEM file which set in RPC_DEM. The default interpolation is bilinear.
  • gdal_rasterize: fix problem identifying some connected-8 polygons (#4647)
  • gdal_grid: speed-up dramatically nearest neighbour search (with radius1 == radius2) by using a search quad tree
  • gdal_grid: parallelize processing by specifying the GDAL_NUM_THREADS configuration option (default to ALL_CPUS)
  • gdal_grid: for 'invdist' algorithm with default parameters, use SSE optimized version if available (at compile and runtime). Can be disabled with GDAL_USE_SSE=NO
  • General: make usage message more self-explanatory in case of bad option (#4973)
  • gdalmove.py: New application for "warping" an image by just updating its SRS and geotransform.
  • gdal_edit.py: promote it as an 'official' tool (#4963)
  • gdalwarp: add "-r average" and "-r mode" resampling methods (#5049)
  • gdalwarp: copy metadata and band information from first source dataset and detect for conflicting values, new options -nomd and -cvmd (#3898)
  • gdalwarp: optimization when (-tr and -te) or (-ts and -te) are specified (#4804)
  • gdalwarp: assign color interpretation of source bands to target dataset, in the case of target VRT (#4462)
  • gdalwarp: add -setci option to set the color interpretation of the bands of the target dataset from the source dataset
  • gdal_translate: accept -srcwin or -projwin values that fall partially or completely outside the source raster extent. Introduce -epo and -eco options to error out in those situations.
  • gdallocationinfo: add a -overview overview_level option to specify an overview level, instead of the base band
  • gdalsrsinfo: try to open with GDAL and OGR even if argument is not a file (#4493)
  • gdaldem: add a -combined option to the hillshade mode to compute combined hillshading (#4753)
  • gdaldem: fix color-relief output with driver that has only CreateCopy?() capability, and when the source block dimensions are not multiple of the raster dimension (#4764)
  • gdaltindex: add -t_srs option, to transform all input source bounds to same SRS (#4773)
  • gdalbuildvrt: add -a_srs option
  • gdalbuildvrt: add -sd option to select subdataset by its number
  • gdalbuildvrt: add a -b flag (#4992)
  • gdalgrid: increase working buffer of gdal_grid binary to 16 MB
  • gdal_retile.py: Don't pass creation options to the MEM driver used for generating temporary datasets (#4532)
  • gdal_edit.py: make -a_srs option work properly by expanding the user input to WKT support -a_srs with empty string
  • gdal_edit.py: add support for -gcp option
  • gdal2tiles.py: make KML output conformant with KML 2.2 (#4536)
  • gdal2tiles.py: OL 2.12 support (#4742)
  • gdal_polygonize.py: add -8 option to select 8 connectedness (#4655)
  • gdal_merge.py, gdalident.py: remove using of glob() API
  • gdal2xyz.py: fix output of -csv mode with multi-band raster
  • gdal_contour / gdal_rasterize / gdal_translate: accept numeric values in scientific format.
  • crs2crs2grid.py: New sample Python script
  • gdalcompare.py: New sample Python scrip to compare GDAL datasets
  • gdal_calc.py: add --co creation option flag (#4964)
  • gdaladdo: add a -b flag
  • pct2rgb.py: deal with color tables with more than 256 entries (#4905)
  • Add support for reading .j2w, .jp2w and .wld files for JP2ECW, JP2MrSID, JP2OPENJPEG and JPEG2000 drivers (#4651)
  • Fix serious problems with tiled images, particularly when not multiples of tile size (#4548)
  • Added capture of dateTime attribute
  • Support WKT (with Esri style VERTCS) spatial reference
  • Allow WGS84 spatial reference
  • Include compression method in metadata.
  • Check signature in METADATA.DIM, not just file existence
  • Fixed DIMAP2 driver to get the proper absolute path in a specific case
  • Write the updated value of the partial cell indicator to the file (#4687)
  • Honour 'Longitude count' field of Data Record to deal properly with files with missing columns at the left and/or right of the file (#4711)
  • Add support for ECW SDK 5.0
  • Improve picking performance on large datasets (#4790)
  • Use ECW SDK to do super-sampling for SDK >= 4.X
  • Expose 256x256 block dimension instead of scanline
  • Workaround a ECW SDK 3.3 bug, when doing a RasterIO() with the total number of bands, but not in the 1,2. n order (#4234)
  • Add heuristics to detect successive band reading pattern (such as done by QGIS). Beneficial for ECWP
  • Add support for writing RPCs and GCPs
  • Add ability to access all ENVI header fields to the ENVI reader (#4735)
  • Write in the ENVI header metadata found in the ENVI metadata domain (#4957)
  • Fix reading of .sta file on 64bit Linux
  • Assume BSQ interleaving when 'interleave' keyword missing or unknown
  • Fix category names writing
  • Remove 'envi fft result' from the blacklist
  • Report wavelength and wavelength_units as band metadata (#3682)
  • Add spatialExtent and extentSRID create-options (#4529)
  • Fix JPEG quality not updated on metadata (#4552)
  • Search for RDT as regular table
  • Add support for RPC (#4038)
  • Internal libtiff and libgeotiff refreshed from upstream
  • Use EXTRASAMPLE_UNASSALPHA by default (behaviour change w.r.t. previous GDAL versions) (#4733)
  • Add support for reading GeoEye? *.pvl metadata files (#4465)
  • Lossless CreateCopy?'ing() from a JPEG dataset
  • Read EXIF metadata in the EXIF metadata domain
  • Ensure that rowsperstrip is never larger than ysize (#4468)
  • Fix writing of RGBA pixel-interleaved JPEG-compressed TIFF (#4732)
  • Set color interpretation to GCI_PaletteIndex after calling SetColorTable?() (#4547)
  • Conversion for 8-bit unpacked CMYK (PHOTOMETRIC_SEPARATED) to RGBA.
  • Maximize EPSG compatability where PCS is defined (#4607)
  • Ensure that unusual units with an authority node are saved nicely (like EPSG:2066)
  • Add CT_HotineObliqueMercatorAzimuthCenter support
  • Fix PolarStereographic? / 9829 support
  • Make sure that GetMetadata?() initializes the value of GDALMD_AREA_OR_POINT item, if not already done (#4691)
  • When building overviews, if the image has already an internal mask, then build internal overviews for the mask implicitely
  • Better handling of SetMetadata?(a_string) (#4816)
  • Use GTIFAllocDefn/GTIFFreeDefn with libgeotiff 1.4.1+
  • Add support for GEO_NORMALIZE_DISABLE_TOWGS84 (#3309)
  • Improve handling of description and offset/scale without reverting to .aux.xml
  • Workaround defects in libtiff 3.X when generating several overview levels at the same time
  • Special case where the EGM96 Vertical Datum code is mis-used as a Vertical CS code (#4922)
  • Support unsetting geotiff tags when calling SetGeoTransform?([0,1,0,0,0,1]) and SetProjection?()
  • Rework how CSV files are searched w.r.t libgeotiff (#4994)
  • Report nodata value (#4433)
  • Fix fgetc signed/unsigned problem for Grib format VSI*L reader (#4603)
  • Avoid caching more than 100 MB in case of dataset with many bands (#4682)
  • uses meshLat as the latitude_of_origin parameter of LCC projection (#4807)
  • Avoid having big buffer on stack (#4852)
  • Avoid locale floating point parsing problems (similar to r24367).
  • Implement continuued lines mechanism (#4873)
  • Fix various vulnerabilities / DoS
  • Add ability to increase the maximum number of opened HDF4 files
  • Unix build: avoid issue with system hdfeos library
  • Ensure we do not try to use the grid tile api for non-tilesized chunks (#4672)
  • Preserve more Float32 attribute precision
  • Import HDF USGS GCTP angular parameters as radians
  • Restore conventional add_offset interpretation (#4891)
  • Be more careful about missing dimensions (#4900)
  • Make HDF4 driver thread-safe by adding a global mutex (since the HDF4 library isn't thread-safe)
  • Search for "coremetadata" attribute name instead of "coremetadata."
  • Added BASEDATA support for EPT_u1 (#4537)
  • Fix crash on dataset closing when .ige file header is corrupted (#4596)
  • .aux overviews: avoid destroying existing overviews when asking twice in a row to build overviews for exactly the same overview levels (#4831)
  • Fix sizing of RAT string column maxwidth to include null char (#4867)
  • Fix segfault in HFAAuxBuildOverviews with selected bands (#4976)
  • do not reduce tile size to image size (#4856)
  • Fix value inversion when reading type 9 (bitonal RLE) untiled files (#5030)
  • fix slowness and incorrect random reading with RLE datasets (#4965)
  • Enable reading bitonal rle files wider than 22784 (0x5900) pixels (#5030)
  • Add RESOLUTION metadata/option to read/write DPI (#5030)
  • Add write support for .rle (bitonal rle files) to test the above (#5030)
  • Workaround conflict between ECW SDK deinitialization and GDAL deinitialization, as shown by gdaljp2ecw tests of imageio-ext (#5024)
  • Promote 1bit alpha band of a RGBA dataset to 8 bits to improve general user experience (can be turned off by setting GDAL_ECW_PROMOTE_1BIT_ALPHA_AS_8BIT to NO)
  • Capture Corder in metadata for user convenience
  • Fix writing of resolution box where the xresolution value was written instead of the yresolution one
  • Skip bands that have different data type when reading multiple bands in IReadBlock() (#4638)
  • Default to less than 250000 lines per tile (#5034)
  • Require OpenJPEG 2.0.0 now
  • Use several decoding threads when processing multi-tiles IRasterIO() requests
  • Add support for writing georeferencing
  • Read and write JP2 Res box and translate it from/to TIFFTAG_XRESOLUTION, TIFFTAG_YRESOLUTION and TIFFTAG_RESOLUTIONUNIT metadata items
  • Promote 1bit alpha band of a RGBA dataset to 8 bits to improve general user experience (can be turned off by setting JP2OPENJPEG_PROMOTE_1BIT_ALPHA_AS_8BIT to NO)
  • When there are no external overviews built, take advantage of the nature of JPEG compression to expose overviews of level 2, 4 and 8
  • Don't return junk content when requesting xml:XMP but no XMP metadata is present (#4593)
  • add a INTERNAL_MASK creation option to be able to disable appending the ZLib mask if not needed
  • add support for creating a JPEG loss-less file starting with the recentlish IJG libjpeg v9 (with -co ARITHMETIC=yes -co BLOCK=1 -co COLOR_TRANSFORM=RGB1)
  • do not accept by default source bands of type different from Byte, Int16 or UInt16 since they seem to cause crashes in libjasper. This can be overriden, at your own risk, by setting JPEG2000_FORCE_CREATION configuration option to YES (#5002)
  • Add read support
  • Remove bogus code that limited generation to one zoom level (#4527)
  • Set minLodPixels to 1 for zoom level 0 (#4721)
  • Fix bad placing of tiles with raster of the extent of a country or more (#4834)
  • Add FIX_ANTIMERIDIAN creation option (#4528)
  • Fix for gdal_rasterize (#4432)
  • Enable PAM for band histogram and statistics (#4244)
  • Add longitude_of_prime_meridian value to PRIMEM
  • Fix SetNoDataValue?() - do not update when already set to new value (#4484)
  • Convert longitude values in [180,360] interval to [-180,180] (#4512) - override with config option GDAL_NETCDF_CENTERLONG_180=0
  • Support 2D GEOLOCATION arrays when a projected variable has coordinates attribute and supporting lon/at arrays (#4513)
  • Ignore coordinate and bounds variables (CF sections 5.2, 5.6 and 7.1) as raster bands, but expose them as subdatasets - this allows to open files with projected SRS (or dimension bounds) directly, without specifying the variable as a subdataset
  • Better support for Gaussian grids - store original latitude values in special Y_VALUES geolocation metadata item and use it for netcdf export (#4514)
  • Write multi-dimensional variables to a single variable (not one for each unrolled band) in CreateCopy?() (#2581)
  • Fix handling of km units in netcdf driver and importFromProj4() (#4769)
  • Fix detection of 1 and 2 pixel width/height netcdf datasets (#4874)
  • Fix subdataset data type info (#4932)
  • Make netCDF driver thread-safe by adding a global mutex (since the netcdf library isn't thread-safe)
  • nitf_spec.xml: add definition of ACFTB and AIMIDB TREs
  • Don't escape DESDATA for sizes >10mb (#4803)
  • Fix NITF creation when both BLOCKA and TRE are passed in (#4958)
  • Allow reading JPEG-in-NITF where JPEG stream dimensions are larger than NITF dimensions (#5001)
  • Support for cases with 2 LUTs
  • Add CreateCopy?() support
  • Add update support for georeferencing and metadata
  • Add support for selective layer rendering (only with poppler backend)
  • Add GDAL_PDF_BANDS = 3 or 4 config option to select RGB or RGBA rendering add GDAL_PDF_RENDERING_OPTIONS config option to enable selective feature rendering by combining VECTOR, BITMAP and TEXT values
  • Fix parsing of some georeferencing (r24022)
  • Recognized ISO georeferencing set at the image level (and not at the page level) expose such images as subdatasets (#4695)
  • Support Poppler 0.20 (and for current Poppler development version 0.23/0.24)
  • UTF-16 support
  • Report registration points as GCPs (OGC Best Practice)
  • Allow building driver with both Poppler and Podofo (testing purposes mostly)
  • Fix crashes on some PDF files with poppler >= 0.17.0 (#4520)
  • Improve rounding of raster dimensions (#4775)
  • With podofo, avoid launching the 'pdftoppm' process in a visible console on Windows (#4864)
  • Select neatline whose description is 'Map Layers' when it is found, to keep the best neatline for USGS PDF Topo and add GDAL_PDF_NEATLINE config. option to override that default value.
  • Improve detection of DPI for USGS Topo PDF to get the maximum raster quality (will increase reported dataset height and width)
  • Extract USGS Topo PDF embedded metadata in the EMBEDDED_METADATA domain
  • Implement CreateCopy? and Delete (#4530)
  • Supports reading of tiled raster with irregular blocking and irregular pixel size
  • Cache postgres db connection.
  • Use PG enviroment variables as fallback when settings are not provided in the connection string. (#4533).
  • Do not report nodata value when there is none (#4414)
  • Removed dependency on the 'rid' column.
  • Fix to make SQL queries with un-rounded floating point string representations. (#4736)
  • Fix overview support
  • Support all resampling methods for internal overviews (#4740)
  • Fix overview support with multi-table datasets (#4568, #4737)
  • Add RASTERLITE_OVR_OPTIONS configuration option to specify options for the tiles of the internal overviews
  • Relax SanityCheckOK() to avoid rejecting valid CIB datasets (#4791)
  • Avoid selecting a color table that is full black
  • Add missing NITF series code 'TF' for 'TFC' (and fix typo in some other long descriptions) (#4776)
  • Fix TIL driver using overview (#3482)
  • Add set projection and geotransformation for TILDataset
  • VRTWarpedDataset: add INIT_DEST=0 if no INIT_DEST specified (#4571)
  • VRTFilteredSource: fix RasterIO() to take into account source and dest windows (#4616)
  • avoid crashes due to int overflow when dealing with requests filling a buffer larger than 2 GB (#4815)
  • VRTSourcedRasterBand: override ComputeRasterMinMax?(), ComputeStatistics?() and GetHistogram?() to make them run on sources, only when there's one VRTSimpleSource covering the whole VRTSourcedRasterBand
  • solve issue when the VRT is a symlink and that the sources filenames are RelativeToVRT (#4999)
  • Fix relariveToVRT option in VRTRawRasterBand (#5033)
  • Allow reading/writing alpha channel (libwebp >= 0.1.4)
  • Add support for reading XMP metadata in the xml:XMP metadata domain
  • Implement GetMetadataItem?(Pixel_iCol_iLine, LocationInfo?) to retrieve pixel attributes
  • Retrieve nodata, min and max values, defined per band or per dataset in the config file (#4613)
  • Add GetColorTable?(), used by the TiledWMS mini driver (#4613)
  • Update TiledWMS mini-driver to support new variable substitution mechanism, min/max/nodata settings, color table support (#4613)
  • Add a <UserPwd?> element in the XML service description file

There is nothing specifically designed into Blender to tell it to ignore the transparent areas currently.

That being said, there are some things we can do to help speed up the render somewhat.

  1. Transparent Background - Choose transparent in the Film section of the Render properties panel. This will render faster than a coloured background (whether full black or not)

  1. Tile Size- Choose a smaller tile size than your current (this tip is mostly for CPU rendering as GPU rendering generally uses larger tiles). This will help the render times when the buckets are processing the edge of the foreground element.
  1. Targeted Sampling - Use the Branched Path Tracing option in the Sampling section of the Render Properties panel. If you reduce the AA sample some what and raise the bounce samples (Diffuse, Glossy, etc.), you will reduce time spent on rendering the sky/transparent background.

  1. Cropped Render - this option is a little more extreme, but if you have an object that doesn't move much on screen, you can crop the render to only include the portions of the screen it's in. You'd then composite it together with the rest of the full frame renders.

Full disclosure, the add-on I'm about to recommend is a paid for add-on created by me, but I think it does what you need as it was built partially for the very task of skipping transparent parts of an image.

If you were rendering a still image you could use the 'render border' feature of blender to skip areas outside of the chosen area. For animations you can use my add-on, the Animated Render Border (link to Blender Artists thread for add-on). This updates the render border every frame so it always surrounds the selected object or group and works both in the viewport and the final render, allowing the skipping of transparent parts for all frames. It also has an adjustable margin to allow for a slight border around the object.


Open the properties window and open the render context with the triangle button.

Under the Dimensions panel, select an appropriate resolution and frame rate. The resolutions that Youtube uses are the following:

2160p: 3840x2160
1440p: 2560x1440
1080p: 1920x1080
720p: 1280x720
480p: 854x480
360p: 640x360
240p: 426x240

All of these use the 16:9 aspect ratio. So if you're using a different aspect ratio, such as 4:3, youtube will covert it to 16:9 by adding black empty space on the left and right sides. Use one of the above resolutions for predictable results on Youtube. Note that this is not the same thing as the aspect ratio shown in Blender!

Make sure that you have set the end frame for however long you want your video to be. This can be calculated by frame rate x length of video in seconds .

Open the Output panel. Select H.264 for the file format. When you select that, a new panel named Encoding should appear.

Open the Encoding panel. Select the Quicktime format.

Set the max bit rate to 0 to make Blender ignore it.

Set the bit rate to one of the following depending on your video resolution (These are only suggestions given by Youtube themselves. You can find higher quality suggestions on this page.)

2160p: 35000-45000 (kb/s)
1440p: 10000 (kb/s)
1080p: 8000 (kb/s)
720p: 5000 (kb/s)
480p: 2500 (kb/s)
360p: 1250 (kb/s)


1 Answer 1

Take a look at What is a query layer?:


Query Layers behave like any other feature layer or stand-alone table, so they can be used to display data, used as input into a geoprocessing tool, or accessed programmatically using developer APIs.


That is why using it directly (as input parameter) in Feature Class to Feature Class worked (as suggested by Midavalo).

About the ArcPy Error 000229: Cannot open <value> , this article lists possible causes:


Wed, 10 Apr 2019

For many years I've wished I could take a raster map image, like a geology map, an old historical map, or a trail map, and overlay it onto the map shown in OsmAnd so I can use it on my phone while walking around. I've tried many times, but there are so many steps and I never found a method that worked.

Last week, the ever helpful Bart Eisenberg posted to the OsmAnd list a video he'd made: Displaying web-based maps with MAPC2MAPC: OsmAnd Maps & Navigation. Bart makes great videos . but in this case, MAPC2MAPC turned out to be a Windows program so it's no help to a Linux user. Darn!

But seeing his steps laid out inspired me to try again, and gave me some useful terms for web searching. And this time I finally succeeded. I was also helped by a post to the OsmAnd list by A Thompson, How to get aerial image into offline use?, though I needed to change a few of the steps. (Note: click on any of the screenshots here to see a larger version.)

Georeference the Image Using QGIS

The first step is to georeference the image: turn the plain raster image into a GeoTiff that has references showing where on Earth its corners are. It turns out there's an open source program that can do that, QGIS. Although it's poorly documented, it's fairly easy once you figure out the trick.

I started with the tutorial Georeferencing Basics, but it omits one important point, which I finally found in BBRHUFT's How to Georeference a map in QGIS. Step 11 is the key: the Coordinate Reference System (CRS) must be the same in the georeferencing window as it is in the main QGIS window. That sounds like a no-brainer, but in practice, the lists of possible CRSes shown in the two windows don't overlap, so unless you follow BBRHUFT's advice and type 3857 into the filter box in both windows, you'll likely end up with CRSes that don't match. It'll look like it's working, but the resulting GeoTiff will have coordinates nowhere near where they should be

Instead, follow BBRHUFT's advice and type 3857 into the filter box in both windows. The "WGS 84 / Pseudo Mercator" CRS will show up and you can use it in both places. Then the GeoTiff will come out in the right place.

If you're starting from a PDF, you may need to convert it to a raster format like PNG or JPG first. GIMP can do that.

Convert the GeoTiff to Map Tiles

The ultimate goal is to convert to OsmAnd's sqlite format, but there's no way to get there directly. First you have to convert it to map tiles in a format called mbtiles.

QGIS has a plug-in called QTiles but it didn't work for me: it briefly displayed a progress bar which then disappeared without creating any files. Fortunately, you can do the conversion much more easily with gdal_translate, which at least on Debian is part of the gdal-bin package.

That will create tiles for a limited range of zoom levels (maybe only one zoom level). gdalinfo will tell you the zoom levels in the file. If you want to be able to zoom out and still see your overlay, you might want to add wider zoom levels, which you can do like this:

Incidentally, gdal can also create a directory of tiles suitable for a web slippy map, though you don't need that for OsmAnd. For that, use gdal2tiles, which on Debian is part of the python-gdal package:

Not only does it create tiles, it also includes multiple HTML files you can use to display those tiles using the Leaflet, OpenLayers or Google Maps JavaScript libraries. Very cool!

Create the OsmAnd sqlite file

Tarwirdur has written a nice simple Python script to translate from mbtiles to OsmAnd sqlite: mbtiles2osmand.py. Download it then run

So easy to use! Most of the other references I saw said to use Mobile Atlas Creator (MOBAC) and that looked a lot more complicated.

Incidentally, Bart's video says MAPC2MAPC calls the format "Locus/Rmaps/Galileo/OSMAND (sqlite)", which might be useful to know for web search purposes.

Install in OsmAnd

Once you have the .sqlitedb file, copy it to OsmAnd's tiles folder in whatever way you prefer. For me, that's adb push file.sqlitedb $androidSD/Android/data/net.osmand.plus/files/tiles where $androidSD is the /storage/whatever location of my device's SD card.

Then start OsmAnd and tap on the icon in the upper left for your current mode (car, bike, walking etc.) to bring up the Configure map menu. Scroll down to Overlay or Underlay map, enable one of those two and you should be able to choose your newly installed map.

You can adjust the overlay's transparency with a slider that's visible at the bottom of the map (the blue slider just above the distance scale), so you can see your overlay and the main map at the same time.

The overlay disappears if you zoom out too far, and I haven't yet figured out what controls that I'm still working on those details.

Sure, this process is a lot of work. But the result is worth it. Check out the geologic layers we walked through on a portion of a recent hike in Rendija Canyon (our hike is the purple path).


Watch the video: Μέρος 2: τοποθέτηση εξωτερικής σκάλας πλακάκι σε οικία στο Πόρτο Ράφτη