cutting-room-floor / ipad-deprecated

DEPRECATED
Other
0 stars 0 forks source link

Review bounds autodetection #12

Open willwhite opened 13 years ago

willwhite commented 13 years ago

For MBTiles that don't have bounds information in the metadata table, we are auto detecting it. This routine needs review and possibly some additional work.

It doesn't seem to be working correctly for layers that cover the whole world. It also is not working for this tileset http://afghanistanelectiondata.org/open/maps/tiles/afghanistan-ethnic-groups

willwhite commented 13 years ago

It looks like we dropped bounds autodetection in 6686c48ce5d9a5d5de34767bbc8777358b0fc124. Should be fine for now, but I'd like to revisit. TileStream does the autodetection and it's handy because TileMill still does not write the bounds into the metadata table.

Justin, you have any thoughts on whether to include this or not?

incanus commented 13 years ago

I think a good approach here, that I toyed with but couldn't perfect, is to detect which tiles we have at the min zoom. Then, find the approximate center of the resulting stiched image and zoom to it.

willwhite commented 13 years ago

You can use the tiles on zoom level zero to determine the actual bound coordinates, which is probably the safeest approach. You just need to determine the bounds of the tiles in top right and lower left of zoom level zero.

Here's an example of this happening in TileStream: https://github.com/mapbox/tilestream/blob/master/server/tileset.js#L90-95

What's tricky is you may not have a good way to do xyz_to_bbox() in your environment. Maybe @springmeyer has an idea of how to get the logic available in Cocoa.

incanus commented 13 years ago

Do you mean zero, or the min zoom level of the set?

We do have good routines for converting CGPoint to RMLatLong. I don't recall what the trouble was before, but I will give it another shot for the next release.

willwhite commented 13 years ago

Ah yeah sorry, I mean minzoom.

springmeyer commented 13 years ago

regarding xyz_to_bbox() in cocoa - ya its all doable, just let me know if I can help. The python/javascript port of that code we use in tilelive is originally from c so it could be used in cocoa as a c header likely pretty easily.