Hi,

I'm using a real empty tile ("empty.png") as a reference for all empty
tiles. 

Here is the code snippet:
                empty= ''
                if bytes == 137:
                    empty = " Empty Tile "

                if "__EMPTY" not in render_tiles.__dict__:
                    render_tiles.__EMPTY_FILENAME = "empty.png"
                    if os.path.exists( render_tiles.__EMPTY_FILENAME ):
                        render_tiles.__EMPTY = open(
render_tiles.__EMPTY_FILENAME, 'rb' ).read()
                    else:
                        render_tiles.__EMPTY = None

                if "__EMPTY" in render_tiles.__dict__:
                    if render_tiles.__EMPTY != None:
                        if os.stat( tile_uri )[6] == len(
render_tiles.__EMPTY ):
                            if open( tile_uri, 'rb' ).read() ==
render_tiles.__EMPTY:
                                os.remove( tile_uri )
                                print ">" * 10, "Empty tile erased:",
tile_uri

cheers
jürgen


Hemant Bist-2 wrote:
> 
> Hi,
> Sending it again since first mail somehow didn't make it
> Hb
> 
> On Nov 29, 2009, at 9:22 PM, Hemant Bist <[email protected]> wrote:
> 
>> Hi,
>> Mapnik is correctly generating the tiles for me.
>> I am trying to figure out if Mapnik can tell me if the tile (or map  
>> I generated) is empty(i.e. there is no information in the tile).
>> I have a sparse map with few polygons covering less than 50% of the  
>> total map rendered.
>>
>> The empty tiles have small  size so that would be one heuristic. I  
>> am hoping there is some better way: either Mapnik can tell me or may  
>> there is some imagemagick or some other tool that can check that all  
>> the pixels in the png are transparent(I am using transparent  
>> background).
>>
>> I am currently using generate_tiles.py.
>>
>> Would appreciate any pointers. In past I have benefited from  
>> suggestion for workarounds  on this list, even if there is no direct  
>> solution.
>>
>> Happy Holidays!
>> HB
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Identifying-%28correctly-rendered%29-empty-tiles-for-a-sparse-map-%3A-tiles-generated-by-modifying-generate_tiles.py-tp26568721p26621732.html
Sent from the Mapnik - Users mailing list archive at Nabble.com.

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to