Zao Liu CGL Report

Monday, March 12, 2007

Adding map server overlays on Google Earth



KML2.1 allows dynamically adding layers from ArcIMS, WMS, MapGuide to Google Earth. The method is:
1. Build a .kml file like below:
<networklink>
<name>Example of Overlays</name>
<flytoview>1</flytoview>
<link>
<href>http://156.56.104.164/GoogleCacheServer/servlet/WMSConnection?</href>
<refreshmode>onInterval</refreshmode>
<refreshinterval>30</refreshinterval>
<viewrefreshmode>onStop</viewrefreshmode>
<viewrefreshtime>7</viewrefreshtime>
<viewformat>BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth];CAMERA=\
[lookatLon],[lookatLat],[lookatRange],[lookatTilt],[lookatHeading];VIEW=\
[horizFov],[vertFov],[horizPixels],[vertPixels],[terrainEnabled]</viewformat>
</networklink>

If you specify a <viewrefreshmode> of onStop and do not include the <viewformat> tag in the file, the following information is automatically appended to the query string:

BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]

This information matches the Web Map Service (WMS) bounding box specification.Also, horizPixels and vertPixels defines the bounding box's width and height.

When load this file in Googel earth, it will make a http "get" query to the link URL you defined with the query values.

2. Then we can easy build a CGI or servlet to deal with the query string and build a wms like query string to query for the county servers layers and dynamiclly write a KML file with the layer URL back. Google earth could add the layer according to this kml file. Please note: must access to a WMS server that can output WGS84 coords (EPSG 4326).

Image resizing in JAI vs. ImageMagick

Part of the functionality of the cacheing server application is the dynamic and on-the-fly resizing of images to whatever dimensions are required by the client.

I wrote the first version of the image resizing code using Java Advanced Imaging (JAI), but it is apparent that the quality of the resized images wasn't quite good. I tried setting JAI to use bicubic interpolation (InterpolationBicubic and InterpolationBicubic2) instead of the default nearest-neighbour (InterpolationNearest) method. Still produced inconsistent results.

I had looked at using ImageMagick, using the java JMagick bridge, but that was just plain funky.. It relies on a JNI bridge that apparently doesn't compile well.I decided to try an ImageMagick solution using java's Runtime.exec() - and it works perfectly. Image quality is much better. The memory issues we were seeing with JAI disappeared (JAI was barfing on Very Large Images, where ImageMagick chews through them with ease). The downside is that it takes considerably longer to process the resized images, and since ImageMagick can only work with local files (not URLs), I have to download the image from the web each time I want to process it.

Thursday, March 08, 2007

Status report for March 7th

1. Built the offline version of Quicksim2.
2. There is an interesting website called Flash Earth. An application built in Flash that uses satellite and aerial imagery from a variety of online mapping websites,like Google map, yahoo, ask.com, even NASA daily image of cloud. Also, when we zoom in or zoom out using Flash Earth, the feeling is more like Google earth, better than Google map.This give me some idea of building a flash-based map client with collaboration. Also, some useful layers we can add to our servers.
3. Working on add Morgon County GIS server layers to our cache server. Also, I need do more work to build a good cache version for Monroe county.
4. Marlon pierce has updated the paper for the IndianMashUp project. The link is:
http://www.servogrid.org/slide/iSERVO/CacheMap/