tailieunhanh - Beginning Google Maps Applications with PHP and Ajax From Novice to Professional PHẦN 8

bạn có thể sử dụng phương pháp (). Tương tự như vậy, để ra một liên kết có thể click, chỉ cần vượt qua một URL vào (). WriteUrl () là phương pháp đặc biệt hữu ích khi tạo ra các ô bản đồ của riêng bạn, như bạn sẽ thấy trong phần "Thực hiện Loại Bản đồ của, | CHAPTER 9 ADVANCED TIPS AND TRICKS 249 180 var lat parseInt zoom 2 180 - 90 var point new GPoint lng lat return point function pixel zoom unbounded var lat 90 - zoom 2 180 var lng zoom 360 - 180 var latlng new GLatLng lat lng return latlng function tile zoom tileSize var rez zoom if 0 tileSize rez 2 return false if 0 tileSize rez var e rez tileSize e if 0 e return true function zoom return zoom The Blue Marble Tiles The Google Maps API assumes a tile size of 256x256 pixels. Although you can change the tile size by using the GMapType tileSize option the Blue Marble images divide nicely by 256 so there s no reason to change the default size for this example. Keeping the same tile size will also allow you to continue reusing most of the other examples in the book without the need to modify code to accommodate a different tile size. Slicing and Dicing To serve up the tiled images for the three maps you have a few options including dynamically creating each tile on the fly preslicing the images and storing them all appropriately on the server or a combination. Taking into consideration the storage requirements discussed earlier and the processing power you ll need to continually slice the images on the fly you ll probably opt to spend a little money on a hard drive if necessary and preslice your images. The three maps sliced for each zoom level will occupy only about 40MB of disk space whereas slicing the images at each request will create a huge drain on resources and slow down the server. 250 CHAPTER 9 ADVANCED TIPS AND TRICKS To slice your images you could use Adobe Photoshop s scripting capabilities and follow the instructions at http .