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.

Friday, October 5, 2007

Visiting the Hurt - RIP Little Green Frog

I have been trying to distract myself by trying to get a working Qgis release ready and writing my PhD proposal. Other than that I am on a tight budget and visiting the sick at the hospital. I may go broke paying reparations.

I visited the tow yard to pick up stuff from the car and the full extent of the damage sunk in. Here are some disturbing images, not meant for the faint hearted. If anyone has any contract jobs , I am happy to take them on. I am badly in need of a new car and some extra cash.

Thursday, October 4, 2007

Car Crash - The Aftermath

1 word of advice, DO NOT crash your car, especially with a passenger. It has been a terrible week so far. Crash, trouble with Visa for Holidays, uncertainties in PhD application.

I have been wading through knee deep in forms for personal injury and damages to 3rd party's car. Paying towing fees and fines. Hopefully the insurance will honour the claims and I will not be in debt for the next few years. Also hopefully no demerit points will be taken and I will keep my provisional licence.

The visa may just get delayed enough for me to be unable to get it before I go on holidays, canceling half of it and hitting me with the hotel bill where I will not be staying. It is just not my week.

Monday, October 1, 2007

The Crash

No it's not the server. Rain and my bad driving skills have set me back once more. I turned right in front of a car going 80kph. Ended up being spun out of the road into a ditch , I walked away unscathed but the car is a write off and a friend did not fare so well - broken wrist and hip. I spent the weekend at the hospital.

To add to the spookiness it was the birthday of the driver in the other car and a magpie was eying me strangely while I got into the car, it would not fly away , it stood right at my feet looking up. Talk about signs ...