Single Image Google Maps Overlay
Categories: Google Maps
Hi all-
Praveen Ponnusamy, a savvy developer in our group, has cracked the Google Maps API so that single images can be used within Gmaps. For places that store high-quality imagery in SDE or use Mr. Sid files, building 256 X 256 tiles on the fly is not very efficient. It is much more efficient to just select one image over the entire vieawable window. Praveen has worked through the Google javascript and has a working example of publishing Kansas orthophotography as a single image tile within the Google Maps framework.
http://geoportal.kgs.ku.edu/googlemaps/arcims_viewer.html
Praveen has also done a great write-up and supplied the code. Read his write-up to find out more...
Single-tile version for publishing ArcIMS images using the Google Maps API.
http://geoportal.kgs.ku.edu/googlemaps/arcims_viewer.html
This is an example of using a "single tile" to publish ArcIMS images. The viewer shows the default Google Map datasets together with city of Lawrence six-inch imagery and State of Kansas one-meter imagery. The application uses and/or overrides undocumented methods of Google Maps code such as loadTileImagesLayer, configureImage, getBoundsBitmap, getLatLng and the much familiar getTileURL methods. Also, due to namespace restrictions imposed by the Google javascript code, some of the utility methods referenced by the aforementioned methods had to be imported (copied) to the application code.
The application uses its own methods in place of the default loadTileImagesLayer and configureImage methods to publish the ArcIMS imagery and restores them back to the GMaps's implementation when the user switches to one of the default GMap types. The overridden methods resemble their original implementation except for some minor changes to accommodate the single-tile architecture. The trick to achieve this resides in the loadTileImagesLayer method where the for-loop to create the tiles is modified to create just one and to relocate it to the view window. Finally, the moveend event is bound to query the image from server. The server-side script called (to query the ArcIMS server) is the same as that used by Jeremy's tiled-version of ArcIMS viewer.
There are some gotchas to this approach though,
1. The lat-long values for the overlay and the tiles, for the view window, differ a little due to the difference in aspect ratios of the 256 x 256 images used by the GMaps and the variable image size (as dictated by the div element size, for example, 800 x 600) we use for the single-tile ArcIMS images. The calculations for this adjustment are done in the getTileURL2 method of the new ArcIMS map specification class. Essentially, the distance between the envelope's corners and the center of the view window, as given by the GMaps, is "scaled" and latitude-longitude values for the envelopes are recalculated. This is important for the GMaps overlay (roads) and the ArcIMS image to be in sync.
2. Since undocumented methods are used here, the javascript code used by the application has to be updated whenever Google updates happen or else the application will break. However, it should not take much time to update.
Future improvements
1. There may be a better/shorter way to do some of the stuff done here.
2. Cache images on-the-fly.
3. Increase the size of the images (possibly by 50%) queried from the server so as to have a buffer around the view window.
4. Add the ability to publish our own overlays too.
You can download the source code here: http://geoportal.kgs.ku.edu/googlemaps/GM_ArcIMS_1Tile.zip
ppraveen@kgs.ku.edu
Praveen Ponnusamy, a savvy developer in our group, has cracked the Google Maps API so that single images can be used within Gmaps. For places that store high-quality imagery in SDE or use Mr. Sid files, building 256 X 256 tiles on the fly is not very efficient. It is much more efficient to just select one image over the entire vieawable window. Praveen has worked through the Google javascript and has a working example of publishing Kansas orthophotography as a single image tile within the Google Maps framework.
http://geoportal.kgs.ku.edu/googlemaps/arcims_viewer.html
Praveen has also done a great write-up and supplied the code. Read his write-up to find out more...
Single-tile version for publishing ArcIMS images using the Google Maps API.
http://geoportal.kgs.ku.edu/googlemaps/arcims_viewer.html
This is an example of using a "single tile" to publish ArcIMS images. The viewer shows the default Google Map datasets together with city of Lawrence six-inch imagery and State of Kansas one-meter imagery. The application uses and/or overrides undocumented methods of Google Maps code such as loadTileImagesLayer, configureImage, getBoundsBitmap, getLatLng and the much familiar getTileURL methods. Also, due to namespace restrictions imposed by the Google javascript code, some of the utility methods referenced by the aforementioned methods had to be imported (copied) to the application code.
The application uses its own methods in place of the default loadTileImagesLayer and configureImage methods to publish the ArcIMS imagery and restores them back to the GMaps's implementation when the user switches to one of the default GMap types. The overridden methods resemble their original implementation except for some minor changes to accommodate the single-tile architecture. The trick to achieve this resides in the loadTileImagesLayer method where the for-loop to create the tiles is modified to create just one and to relocate it to the view window. Finally, the moveend event is bound to query the image from server. The server-side script called (to query the ArcIMS server) is the same as that used by Jeremy's tiled-version of ArcIMS viewer.
There are some gotchas to this approach though,
1. The lat-long values for the overlay and the tiles, for the view window, differ a little due to the difference in aspect ratios of the 256 x 256 images used by the GMaps and the variable image size (as dictated by the div element size, for example, 800 x 600) we use for the single-tile ArcIMS images. The calculations for this adjustment are done in the getTileURL2 method of the new ArcIMS map specification class. Essentially, the distance between the envelope's corners and the center of the view window, as given by the GMaps, is "scaled" and latitude-longitude values for the envelopes are recalculated. This is important for the GMaps overlay (roads) and the ArcIMS image to be in sync.
2. Since undocumented methods are used here, the javascript code used by the application has to be updated whenever Google updates happen or else the application will break. However, it should not take much time to update.
Future improvements
1. There may be a better/shorter way to do some of the stuff done here.
2. Cache images on-the-fly.
3. Increase the size of the images (possibly by 50%) queried from the server so as to have a buffer around the view window.
4. Add the ability to publish our own overlays too.
You can download the source code here: http://geoportal.kgs.ku.edu/googlemaps/GM_ArcIMS_1Tile.zip
ppraveen@kgs.ku.edu
Posted by jbartley at 9:04 PM | Link | 5 comments
Subscription Options
You are not logged in, so your subscription status for this entry is unknown. You can login or register here.
Re: Single Image Google Maps Overlay
hi,
really interesting your approach, do you think you could tweak it to retrieve single images from OGC WMS servers ?
Using the code and inspiration from Kyle and Brian I ended up with a mashup of gmaps and spanish WMS servers, but I lack the knowledge as to modify it to emulate this arcims single image behaviour of yours.
You can check it at http://personales.jet.es/garfi/gmapicc18.html (geol50m layer, other layers have a small range)
Thanks in advance,
Sensei Garfi
really interesting your approach, do you think you could tweak it to retrieve single images from OGC WMS servers ?
Using the code and inspiration from Kyle and Brian I ended up with a mashup of gmaps and spanish WMS servers, but I lack the knowledge as to modify it to emulate this arcims single image behaviour of yours.
You can check it at http://personales.jet.es/garfi/gmapicc18.html (geol50m layer, other layers have a small range)
Thanks in advance,
Sensei Garfi
Posted by Sensei Garfi on October 26, 2005 at 11:37 AM
Re: Single Image Google Maps Overlay
Hi Sensei-
You should be able to take out the ArcIMS part and include a link to your WMS server. Essentially you need to be able create an image in the Mercator projection based on the geographic envelope that Praveen's code sends back to you. So replace the arcims_image_nocache.cfm page with your WMS request logic.
Jeremy
You should be able to take out the ArcIMS part and include a link to your WMS server. Essentially you need to be able create an image in the Mercator projection based on the geographic envelope that Praveen's code sends back to you. So replace the arcims_image_nocache.cfm page with your WMS request logic.
Jeremy
Posted by jbartley on October 26, 2005 at 3:38 PM
Re: Single Image Google Maps Overlay
thanks for your answer,
does this mean I need a server that supports ColdFusion ? Those cfm components are called from within the js ?
I already said my knowledge is limited, sorry
Sensei Garfi
does this mean I need a server that supports ColdFusion ? Those cfm components are called from within the js ?
I already said my knowledge is limited, sorry
Sensei Garfi
Posted by Sensei Garfi on October 27, 2005 at 8:10 AM
Re: Single Image Google Maps Overlay
No you don't need CF. You should be able to take the HTML file and the js file in combination with your WMS url to make the single image overlay. We will take a look at it and get back to you some time next week with an example.
Cheers,
Jeremy
Cheers,
Jeremy
Posted by jbartley on October 27, 2005 at 4:34 PM
Re: Single Image Google Maps Overlay
i want to see india map
Posted by sultan on November 8, 2005 at 5:31 AM
Commenting has been disabled for this entry.
