Reloaded Blog

Tuesday, November 27, 2007

Camping in SweetWaters


Tonight I am staying at the SweetWaters Tented Camps ( these are first grade tents with running water and furniture) in the Ol Pejeta Conservancy on the Laikipia Plateau, nestled between Mt. Kenya and the Abderdares.

The conservancy houses orphaned/rescued chimpanzees from Congo, Cameroon and other parts of central and westerm Africa. It was founded by Jane Goodall. There are also breeding populations of Black and White Rhinos, various other rare herbivores are also conserved. I got to pet and feed sugarcane to a tamed black rhino called "Morani". Here you can just sit outside in the dark with a small ditch separating you from the animals at the water hole, it is a great experience indeed.

Monday, November 26, 2007

Watching Elephants from TreeTops


After all the excitement of last week I am relaxing this weekend in the Aberdares, watching elephants and buffaloes from the windows of the wooden lodge at TreeTops. We also went for a game drive but visibility hampered by the dense thicket in the park. Stay in the hotel , up all night spotting game and chatting with people is more fun.

I did a fair bit of chatting last Friday as well doing an interview with Bertha from Nairobi Star about growing up and education in Kenya and life afterwards. I demonstrated the the time based refugee tracking in WorldWind at UNHCR-Somalia which happens to be in the same building as Nairobi Star.

Friday, November 23, 2007

NASA and its value to the people

Since its inception NASA has tried to justify its raison d'etre, in the beginning it was the space race with the Soviets, but with the warming up of the cold war that incentive has evaporated. These days the public want real deliverables from NASA and the perception is that it is over-funded and under-performing. This is where NASA needs to communicate to the populace how it will directly benefit them much like the national education (NASA has much to educate people about) and health agencies (Space observations can track pollution levels) . This article brings out the discrepancy between people's perception of NASA funding and the reality.

"In a survey ... NASA’s allocation, on average, was estimated to be approximately 24% of the national budget (the NASA allocation in 2007 was approximately 0.58% of the budget.)"

Misconceptions indeed ....

Wednesday, November 21, 2007

Visiting FAO-SWALIM, UNHCR-Somalia and Wananchi Online

I set myself up for a busy day on Tuesday the 20th. Running around Nairobi all day and visiting various contacts Maurizio had dug up. I also had to get to Loita house by 6:00 pm for a talk to SkunkWorks, a Nairobi gathering of techies.

First visit to FAO-SWALIM was fruitful, Craig was eager to embrace the OpenSource ideas and spend their limited budgets on setting up infrastructure in Kenya and capability development rather than on expensive software license purchases. They also have a lot of satellite and thematic data to share and are taking steps towards making it publicly available.

Next I went to UNHCR office for Somalia, John Marinos was trying to publish the data peace keeping, protection forces and aid agencies gather on displaced populations to Google Earth. A small bug in GE due to the asymmetry of KML import and output was frustrating his efforts. This bug is basically discarding the thematic palette information for KML icons when multiple KMZ's are being aggregated. So I had to script the aggregation myself and send him a master KML which can be kept updated with monthly data, ultimately I hope the database will be able to automatically generate proper KML's for distribution. These KML's had folder based time-tags, so I went ahead and extended the WorldWind KML Parser to respect these. Now the TimeController can be use to play through series and fully appreciate the grim reality of life in Somalia. I will try to add a time slider as soon as possible.

The final meeting was at Loita House - Wananchi Online. A selection of SkunkWorks members turned up, my talk on satellite sensors - SAR and Optical went without a hitch. People really perked up when I started demonstrating WorldWind. Lots of questions arose on performance in low bandwidth, age of data, data costs, methods for acquiring street data and building heights: there seems to a lot of need in Kenya for base mapping data and few very expensive sources.

Monday, November 19, 2007

Open Source SAR Analysis - Story of RAT

I have a few more minutes at the airport, the flight is delayed. This is a good time as any to announce that now I am an official RAT - Radar Toolkit developer with commit access to the berlios svn. My contributions so far are only in the "IO" segment, ALOS-PALSAR CEOS, TerraSAR-X COSAR and XML metadata loaders. I am hoping to contribute some dual-polarimetry analysis tools as my skills develop.

SAR is a very specialized sensor without wide spread application, as such good SAR programs are few and far between. Most so called commercial packages are half-hearted commercialization attempts from university research groups. RAT is a robust open-source alternative chiefly developed by the enthusiastic Andreas Reigber at the Technical University of Berlin. IDL is the language of choice for these folk, it is similar to Matlab, high-level and and mainly procedural. Obejct and events support are sort of patched on. Other attempts at similar toolkits have been by Atlanta Scientific-Vexcel-MDA using Python-C base and an OpenEV viewer and by ESA in TCL (PolsarPRO) but neither of these in my opinion offers the easy extensibility and ease of use of RAT, provided you somehow procure an IDL licence. I similar parallel toolkit in Matlab will also come in handy, but the development of this has been sporadic, I really need to dig up the bits I wrote during my undergraduate work and start something going.

One of the best SAR features in RAT so far in my exploration is the LLMMSE Speckle filter, it produces a clear image from the standard speckled SAR image.

Final day in Mombasa - Amenities Failure

For the last day in Mombasa, Kenya struck back with vengeance. The power and water failed for the day. We were glad to be getting out as the five-star service tore apart at the seams. The only cooling was the pool. I did however manage to go to Kilifi and see the swahili huts and a beautiful pristine super white sound beach with clear blue water. The best part was it was totally unpopulated, except for a few sand-pipers and crabs.

Now waiting for the flight back to Nairobi and roaming the net, GPRS is such a boon.

Sunday, November 18, 2007

Weekend in Mombasa - Life on the Beach

Here continues the greatest monologue in my life. I am spending a 3-day weekend in Mombasa , in the Sarova Hotel with a white sand beach just outside the window. Spending time with the family is a delicate balancing act, when you get around it life on the beach is a lot of fun. When you are not losing the rooms keys attached to giant fish in the pool.

Having drinks in the beach bar, lazing about in the pool, taking morning dips in the sea-weed encrusted water. I took a ride on a camel and we went looking for sea-life among the corals, the tropical fish and echinoderms ( starfish, sea-urchins etc.) are beautiful and find a great habitat among the coral. You have to dive or at least snorkel to fully appreciate them. The family insisted on recording every activity with forensic precision. Mombasa feels like some old asian town, with its mostly swahili and arabic population, lots of somali have come in recently as well. We ended up in a packed narrow-lane in the old town looking for a "Kanzu"-traditional swahili long dress. I felt like I was back in the cloisters of chandni-chowk in Calcutta.

I have one more day here, the plan is to see Fort Jesus (old Portuguese Fort), Mamba Village (Crocodile Farm) and Haller Park. Lets see what happens plans never turn out as planned.

Tuesday, November 13, 2007

Mobile Net in Kenya - Vodafone VMC with Safaricom SIM

Restless while being disconnected from the net I took the first opportunity to get my Vodafone Mobile Connect Card from Australia working here with Safaricom. Safaricom is the local representative of Vodafone, the operate the network while Vodafone does all the back-end, billing etc. I am not exactly sure of the relationship, which seems to be fraught with confusion and corruption allegations. As long I can get the net I will bear any back-hand deals, they are for the greater good.

Since Jerry works for Safaricom now I called him up and got the relevant APN and PAP/CHAP authentication details to make my Huawei hardware work properly. He came into the party a bit late, but I definitely owe him a drink.

Sunday, November 11, 2007

Pyramids better wait - Story ni Ndefu


So I am finally in Kenya, having fun here but the pyramids have to wait a few more years in addition to the thousands they have for me to get to them. Unless some ultra-religious group comes to power in Egypt and decides to knock them down like the Bamiyan Buddhas. The visa from Kenya did not materialize.

Meanwhile I have been shuttling around Nairobi-Thika-Juja trying to stay in touch with people and see the sights. Today we ended up in Lake Naivasha, riding in a small boat, spotting birds and hippos.

The other major event was a giant get together of all my friends from Mang'u , after some 7 years. People have moved ahead and become lawyers, doctors, entrepreneurs, pilots and one is even standing in the Kenyan elections. We went on expanding and taking over Kengele's until there were nearly 50 people. I nearly burned a hole in my wallet buying everyone a round of drinks. Catching up was fun and there were excited groups swapping mobile numbers. I need to do this more often.

Sunday, November 04, 2007

On my way

Leaving Australia on another grand adventure to Nairobi then hopefully on to Cairo. Wait for me pyramids.

Sunday, October 28, 2007

Backporting Interactive Compass - Reflector and Obfuscation


Recently a Brazil targeted version of WorldWind was released, called GeoPortal-3D. Chad talks about it in his blog. The main additional features are Brazil specific placenames and imagery, the other useful new feature that quickly meets the eye is the interactive compass. This behaves in a manner very similar to the Google Earth navigation widget, just does not fade out to a normal compass when not in use, I guess we can merge one of WorldWind's existing compasses to achieve the same result. Anyway since WorldWind already has a few navigators another one which is familiar to people will do no harm and offer more choice.

Thus began the effort with Reflector and FileGenerator to create the same plugin in the WorldWind core tree. After a few fixes due to code upgrade and path changes the plugin works without a hitch. Useful new addition to moving around the globe. Other than this there are a few more plugins added in GeoPortal with some database features which would be useful to backport.

Back-porting from binaries raises the specter of intellectual rights protection and code security, I guess this is where assembly signing can come in for authenticity verification and this nasty bit of obfuscation can be used to deter the not so eager disassembler.

Saturday, October 27, 2007

Qgis Release - with Grass 6.3RC1

Finally went out for a night in town to celebrate the hard work and final release of Qgis 0.9.0 . The night ended with a predictable crash brought on by too many shots of vodka-midori-cointreau, called "What's That".

Before that I had to spend a few nights relinking Qgis and GDAL with Grass 6.3 Release Tag. Thanks to this a lot of advanced GIS functions are now available in Qgis. The relink brought on a dependency hell which I had to resolve using Dependency Walker. It is a great tool for windows release builder, helps to make sure the user gets all the components bundled in the installer. Just makes the installer very big, but hey it works. If you want better package management use Linux or BSD.

Tuesday, October 23, 2007

New World of SAR - A round-up of SAR Systems

Recently I wrote an article with the same topic for a magazine that shall not be named, and received claims from editor that it was too biased. Since I can't make the deadline for a new article and the editors left it too late to pass on their opinion, I am going to use this soap box to stand and narrate my perspective on the current state-of-art in SAR Systems, commercial and research based, the rest (presumably a lot of them military) are not common knowledge.

  • Air-Borne Systems
    • Commercial - Very few commercial players exist in this field
      1. Intermap IFSAR - Operational X-Band single pass Interferometric System with proven track record and very large archive of proven quality data. The P-Band system feature foliage penetration but is repeat-pass based.
      2. Fugro-EarthData GeoSAR - Newly operational for X and P band single pass interferometry. Available data archive is limited and data validation is not wide-spread. Theoretically should produce good quality DEM's using P-Band but this may conflict with the X-Band results, needing reconciliation. The system is ex-NASA. The accuracy in the system is achieved by redundancy/repeat flights. A good set of samples can be obtained at the NOAA site.
      3. Orbisat InSAR - A Brazilian system with InSAR capability in X and P bands.
    • Research - A fair few research systems exist operated by space agencies and educational institutions, the data from these systems has limited availability is based on pre-planned campaigns. A suitable summary is on the POLSARPRO site. In addition to these a lot of institution have the aspiration to operate a SAR system, it is a highly prestigious club to belong to.
      1. AIRSAR(NASA/JPL) - The elder statesman of air-borne systems, last known campaign was in 2004. The last time I accessed the AirSAR site was offline.
      2. EMISAR(DCRS) - Technical University of Denmark dual-band(L/C) fully polarimetric system.
      3. ESAR(DLR) - Quad-Band(X/C/L/P) fully polarimetric system with very high quality data used for Insar, Polsar and Polinsar research. This system served as a template for the TerraSAR-X sensor.
      4. Pi-SAR(NASDA-CRL) - JAXA Airborne L-Band system, the inspiration behind JERS and ALOS-PALSAR.
      5. RAMESES/SETHI(ONERA) - Someone in France must be obsessed with Egyptian history and pharaohs, or may be it is related to the sand penetration experiments with these systems.
      6. SAR-Convair(CCRS) - Polarimetic X/C-Band system used as a test-bed for Radardat 1 and 2 sensors by the Canadians. Mainly used for research in ice-monitoring, because that's all Canadians are interested in.
  • Space-Borne Systems -Recent years have seen the launch of numerous SAR sensors, both civilian and military. I have started to lose track of the military ones, here are a few: SARLupe-1 and 2(Germany) , YaoGan(Chinese), Cosmo-Skymed 1 and 2(Italy) and many more. The systems of interest to me are those that have readily accessible data, are currently operational or will be near future(which can mean anytime in the next 5 years given the nature of the space industry - you can really feel the relativistic time dilation, we must be near a black hole).
    • Currently In-Orbit Systems - These are either old die-hard systems, long past their scheduled expiry date or recently launched top-of-the-line sensors.
      1. RADARSAT-1 - The long lived Canadian SAR system operating in C-Band HH.
      2. ENVISAT-ASAR - SAR sensor on the multi-sensor Envisat bus. The data from this sensor is accessible for research from a rolling archive over the last 15days. The sensor can operate in alternate polarization mode.
      3. ALOS-PALSAR - The first fully polarimetric L-Band space borne sensor. The data from this sensor is heavily consumed by the Kyoto and Carbon project for global forest monitoring. It collects on a fixed schedule over all land-mass. The data is highly affordable and of good quality.
      4. TerraSAR-X - Newly launched poster child of the SAR world, first commercial SAR sensor to provide upto 1m resolution. Alternate polarization mode is operational, full-polarimetry and along track interferometry are some of the research modes available.
    • Planned/To-be-launched-soon systems - These are the bad boys, getting to school late or the toddlers which show great promise. Not yet in orbit but will be nice to have data from them.
      1. RADARSAT-2 - The naughtiest of the bad boys, showing a lot of promise but not sitting for the exam. Long planned, but delayed in launch, it will be the first fully polarimetric C-band spaceborne system.
      2. Sentinel-1 - Follow on to the aging ENVISAT system mentioned above, with upgrades with new technology in C-band. Unlike its predecessor, it will be a smaller and dedicated SAR bus, other optical sensors will have to find their own rides on Sentinel 2 and 3. It is due for launch in 2011.
      3. TerraSAR-L(Cartwheel) and Tandem-X - The novel concept in SAR systems is a constellation, this will allow single pass along-track and cross-track interferometry.
      4. MAPSAR - An L-band joint program between INPE(Brazil) and DLR, due some time the next decade.
      5. RADARSAT Constellation - Another program due next decade or after that(if RS-2 is anything to go by) designed to provide daily global coverage using SAR.
That is my summary for today. Those that have attended more conferences than I have may have encountered a lot more exotic ideas and sensors. I hope this will attract comments on those sensors not mentioned here and their capabilities.

Monday, October 22, 2007

TerraSAR-X format support in GDAL

SAR data is so out of this world that they always have to invent new data formats to put it in and present it to the end-user. Terrasar-X is no exception, with a new satellite comes a new format. Thankfully DLR has ditched the ever so complicated and CEOS format , which is as not standard as it could be, with simple georeferenced tif files with XML metadata.

This approach is very similar to the data format for RADARSAT-2 , which is quite elegant and richly supported in GDAL (betraying the Canadian roots of the principal author). Now everything would be fine if RADARSAT-2 weren't more that 5years delayed and still scheduled to be launched in this year December.

For the complex data in all modes DLR invented a new format - COSAR. Specifications have been out for a while but no format support was worth building till TerraSAR-X won the race for next generation space-borne SAR sensor in X-Band. Now ironically, another Canadian has added TerraSAR-X format support to GDAL , using the specifications only, which works perfectly for stripmap cosar data. Time to move onto supporting the orbital information and slant-to-ground range conversion.

Thursday, October 18, 2007

Wrestling Xerces on MINGW - Qgis GML support

With all the fuss about using XML based standards, GML is becoming increasingly popular as the medium of vector data representation in the GIS community. For the rest there is always KML /KMZ and for the old-timers Shapefiles. The zip and gzip compression algorithms compress text very well and compressed XML based formats are less bandwidth hungry compared to binary formats. GeoServer can produce all these formats for distribution from various datasources, GML is the primary format. GML2-GZIP fares best in terms of size and speed of creation.
After struggling for weeks to link GDAL with Xerces-C on MINGW I ran across this little nugget, a compiler flag that simply and cleanly allowed static linking to parse GML. Xerces-C is not the most elegant, lean and fast XML library, but it is used in GDAL and conversion to another library, possibly Expat which is also a GDAL dependency will require developer resources not currently available. So finally after all the fiddling around I have GML loading in QGIS and hopefully better luck with WFS servers providing it.

Sunday, October 14, 2007

Saving World Wind .NET Sessions - The long xml road

XML can be a blessing and a bane. It is the rose that is full of prickly thorns. Original World Wind XML configuration engine used Altova for marshalling and unmarshalling objects. Since then the parsing got moved to MSXML using XPath to remove the Altova dependency, but the configuration saving is not tied cleanly to .NET object serialization system leading to the need the a long-hand major layer parameters-to-file scheme I am working on. May be this can be extended to plugins once there is a common repository for them.

Hopefully this will be standardized to something allowing saving-restoring and network transmission of World Wind sessions, allowing people across the globe to view the same "world" in their respective World Wind installs.

Saturday, October 13, 2007

Quaternions, Embedding Python and just passing time

Quaternions are an old and elegant mathematical concept. Superseded in higher dimensions by tensors and other associated constructs but still holding sway in graphics and gaming and mechanics. I have had exposure these fun representations of rotation through both graphics in WorldWind and lately, satellite mechanics, through implementation of optical models in Ossim. There is talk of implementing matching and stereo analysis solution for terrain generation using the optical models within the ossim framework, let's see where it leads.

The other thing taking up my time is getting a Qgis release out. The one with Python bindings is proving to be a real nuisance, making installers in Windows is such a pain mainly due to lack of coherent location of all the dependencies and mess in the registry for locating them even while they are there. Hence the windows package inherently gets larger and larger as I struggle to throw all but the kitchen sink in to ensure all the stuff needed is there and the user does not fall into dll-hell. So far I have packaged Qt,Gdal,Grass,Msys-Mingw,Gpsbabel,PyQt4 and who knows what else into it. I might also have to include an optional embedded python, just in case Python is not cleanly detected on the system. So far Gary Sherman has managed to coax it to work on Windows Vista and Aaron Racicot on Windows XP.

Here are revised steps:
  1. Install Python 2.5
  2. Install PyQt4
  3. Install Qgis with Python bindings - will replace some PyQt4 binaries with compatible ones.
The whole beast is now some 62MB-20MB is PyQt4 I had to include. I am looking at adding SIP as well, to get rid of step 2. If need be a simple python distro to rid of 1 as well. Since this will bloat things up there will be a Python-less installer too, as a compromise. I simply wish windows had a better system for binary reuse ( well outside of .NET and the evils of the registry).

When the installer is not building in NSIS I have been raking up gold and monster corpses in Dungeon Runners, lucky it is a fast hack and slash. Cheap ($5 p.m), totally unaddictive (unlike WoW) and free from gold farmers since you can't drop the gold.

Thursday, October 11, 2007

Finishing off Polygons - Area Measurement in World Wind

Back on the theme of polygons , another common problem is measuring area of 2d and 3D polygons, polygons on an ellipsoid and polygonal meshes (think realistic farm area measurement for a large farm with hills and valleys).

World Wind now has simple sphere based area calculations suitable for roughly measuring countries, states and something of similar scale. I have finally hooked up the calculations to the measuretool display. The goal is still to allow access to the triangulated terrain mesh and calculate areas with known accuracy for personal properties.

The simple area measurement produces passable results for Metropolitan France ( area 543,965 - 551,695 km² according to wikipaedia article) as shown:

Qgis 0.9 Release and Religion in Space - The re(li)gion outside Earth's Atmosphere



Finally managed to put together a working Qgis installer with GRASS and PyQt4. The major issue was binary incompatibilities between the MSVC builds of PyQt4 released by Riverbank and the MSYS-MINGW builds of QGIS. With the MSVC build of QGIS going ahead these issues will probably disappear by the next release. Aaron Racicot has been nice enough to provide constant feedback and help me fill the holes in the installer.

Coming to the other niggling topic - that of practicality of Earthly religions in the heavenly frontier (or just space). Most of the religious dogma is built with earth-bound mortals in mind. At the ISS in polar orbit with 15-16 sunrises a day fasts and prayer times become rather irregular, as does prayer direction. There have been a few articles about this issue with a Malaysian astronaut heading to the ISS. The official "how-to-behave-guide" bases things on an initial condition/launch site perspective rather than dynamic time. I was disappointed since I was dreaming up a gyroscope stabilized Kabba facing prayer mat for orbital. Anyway it is good to see dogma and rites being shredded by zero-gravity and fast-moving space-time and the core of the belief system being exposed. This is in the wake of reading some Richard Dawkins evangelism, he is just as bad and narrow minded in his way as the rest of the religious folk.

Wednesday, October 10, 2007

New solutions to old problems - Point in Polygon

Some algorithms in computer graphics and topology never get a satisfactory solution that is both fast and logically simple to implement. One is line segment intersection , the other is the classic point-in-polygon (PIP) , fundamental to object selection / picking. I was attempting to make an implementation for World Wind for generic PolygonFeature picking.

Polygons rendered can be quite complex with holes and are curved to the earth's surface. 2D-topological solutions may not be adequate in all cases and DirectX based object selection may not be accurate. There are multiple strategies for PIP solution, here is the summary of a few:
1: Ray-Trace Test
2: Winding Number Test
3: Successive approximation using grids and bounding boxes
4: Triangle test

Not all strategies work for complex polygons(re-entrant,concave, with holes and what have you), and need to be carefully chosen for intended use and efficiency.

The strategy I am proposing for World Wind will be bounding box checks then rigorous checks using winding rule for holes and outer ring, that is if I don't get lazy and choose to use NTS instead, or just tag any quads being rendered using Direct-X ( filled polygons at altitude) and use DirectX picking.