MV

MV

Tuesday, September 25, 2012

Fishers Island with Family

Fishers Island is a 9 mile x 1 mile island, close to the tip of Long Island in NY state.


It is not a popular tourist place. In fact, the locals are not keen on attracting tourism. There is only one hotel, one grocery store, and a couple of take-away food shops. There is no taxi service, and no bus service. However, there is an airport right next to a beach, which got my attention.

We packed up our food, towels, and headed off to Elizabeth Field at Fishers Island. Its about 1 hour from Beverly in club Cessna 172EF.

The airport had almost no traffic, and I had no difficulty finding the large airport on a small Island.

See the Video of Landings at Elizabeth Field.

We were surprised to find that there was a lady attending the airport (we paid our landing fee of $10). She also offered us bikes for $10 per bike per day. We decided to just relax on the beach instead.

The beach is right next to the runway, and it was pretty deserted. We walked across the runway to the beach, and relaxed for several hours in hot sunny weather, on white sand, and in complete privacy on a public beach.

Kids threw some rocks in the water, and made sand castles.

It was a very relaxing one day trip.

Some Communities Near Vineyard Sound


Elizabeth Field on Fishers Island

Another View of the Field

A mansion on Fishers Island

Kids and dad at Fishers Island. A Very Deserted and Laid Back Place


Crossing the Runway to Beach


Family at the Beach next to Elizabeth Field



Rare Airplane View from the Beach


The Beach from the Plane

Fisher's Island minus the South Part

Monday, September 24, 2012

Around the Cape with Zain, and Testing Avare

The only other person keen on flying in my family is Zain. I gave him the much deserved front seat on my trip to Provincetown, MA.

The route of flight was from Beverly, to Bedford, over Norwood, Kingston, and then along the inner edge of the Cape, all the way to Provincetown Airport.



I flew low and slow for capturing some abundant breath-taking views of beaches along the inner coast of the Cape Cod Circle.

But the biggest memory of the trip was Zain's taking control of the plane for brief moments, during which he did some Zero G maneuvers with assistance from dad. He would pull back on the yoke so the plane entered an ascent, then he would push down to put the plane in controlled free fall. He did very well, but needed dad to assist him with limits.

Zain tried some steep turns as well. Dad had to brush up on his own skills with steep turns before Zain could try. Since we were on flight following, we were politely asked to resume on-course heading, after ATC noticed some odd behavior.



After putting the plane on auto-pilot, and letting Zain take care of the rest of flying, I decided to snap some pictures, and test Avare (The aviation GPS application that I designed and coded myself).


Avare worked quite well on Nexus-7, although I used an external Bluetooth GPS for better altitude awareness. A WAAS capable GPS gave me altitude accuracy of a few feet. I flew over a certain airport, set the Kollsman window to correct pressure setting at that airport, then compared the altimeter indication with Avare altitude indication. I found error of a few feet to up to 20 feet. In this instance Avare shows 2573 feet, while the altimeter in the plane is showing 2590 feet, an error of only 17 feet. The seam you see in the chart is caused by FAA paper chart seam.

Here are some pictures of the inner Cape Cod coast.








During the flight, I compared Avare with a Garmin aviation GPS. The indications of speed, bearing, distance, and time to destination were within rounding error.
Speed: 109 knots (Garmin), 108 knots (Avare)
Distance: 18.6 (Garmin), 19 (Avare)
Estimated time en route: 10 minute 16 seconds (Garmin), 10 minutes (Avare)
Heading to destination:  86L (Garmin),  86 (360 - 349 + 75) (Avare)

There is a lot of glare from Nexus-7 screen so it probably needs an anti-glare screen cover. Glare did not bother me much though.


There was one point near Sandy Neck area that got my attention. The colors of ocean and sand mixed with underwater sea-algae created dazzling effects.



I have never been to Sandy Neck, but its beach beauty is nearly on top of my list (at least from the air).



This is a light house at the end of Cape, after Provincetown


I tried Avare on dash board, but that restricted my view of the open world.


I tried Avare on an old first generation (Hero) Android device as well. Performance was similar to that on Nexus-7. I am memory bound, not CPU bound, hence the performance bottleneck is unzipping and loading images from the SD-CARD repeatedly in memory as I pan and zoom. The altitude differs between Nexus-7 and Hero, because Hero does not have WAAS capable GPS.

One more view of Sandy Neck



We landed at Provincetown Airport, took a bus to the town, ate our lunch there, had some exceptionally good ice cream, sat on the beach for a while, then took the bus back to the Airport. A very well spent day with Zain.






I relied solely on Avare for my navigation needs. I flew within a few hundred feet of class B airspace in BOS, but was never called by tower. At the end of the flight, I concluded that Avare is ready for prime time, and I can now sell my Garmin on Ebay for a $400 pay day.


Friday, September 14, 2012

Avare is Now on Google Play

I have released Avare on Google Play store.


Avare is an open source aviation GPS with no ads, and free sectional charts. It provides all basic GPS navigation facilities a VFR pilot would need for navigating on FAA sectional charts. All lower 48 states of US are covered.



Here is the latest video showing Avare use on a first generation Android phone device: http://www.youtube.com/watch?v=Mkakc-JVJXY

Here is the link to install Avare:
https://play.google.com/store/apps/details?id=com.ds.avare

The open source page is at https://sourceforge.net/projects/aviationgps/. You can browse the source, compile and load yourself (if you do want to explore technical aspects of it), and even generate sectional maps.

In my last blog I provided some technical details on how to generate the maps. In here, I talk about actual programming.

I am extremely thankful to my fellow pilot John Wiley (ja4u.net) for providing valuable feedback for the product from a user's perspective.

-- Technical details

Generating maps was quite involved. Android programming was the easy part. There are key points that I will mention here that took me a bit of effort to figure out.

1. Large bitmaps cannot be parceled. There are no warnings when parcel fails due to size. Maximum parcel size is 1 MB. This stems from a problem that Android does not free bitmaps automatically in its garbage collector when an activity exits, so large bitmaps must always be created once from within a separate service.

2. Large bitmaps should always be loaded in Async tasks, otherwise the UI thread will hang

3. Google APK size of 50 MB requires this 350 MB software to be loaded in APK + expansion configuration. Maps must also be unzipped from the service in an Async task.

4. All database sqlite queries must also be done from within Async tasks.

5. Since large maps cannot be parceled due to 1 MB parcel size limit, a local bind to a service is required.

6. Save all states in services, because the activities have short life cycle, and state is critical because map state from zipped expansion archive takes up to one minute to restore on a slow device.

Rest can be read from source at the source forge repository online.

Sunday, September 9, 2012

Free Aviation GPS for Android (How to make a moving map GPS)

I am ready to upload my latest application on Android Play store and it is free. There are no po-up ads, and no hidden charges. Similar applications charge $50 to begin with. This is a thank you gift from me to the open source community whose tools I have used throughout my career, and whose tools I used to prepare the sectional maps for the GPS.

I name it Avare. Here is a Video showing Avare use.

Not only that Avare is free, I will give sources, maps, databases, and scripts I used to design and make it.

The application works on any Android device with a GPS. Most of the testing was performed on a first generation Android device running Cyanogen Mod Android 2.2, although I recommend using an external Bluetooth GPS for better accuracy, and at least a tablet device for larger screen area.

Total application size is about 350 MB which includes all 48 state sectional charts, an airport AFD database, fonts, and the application itself. I did not buy the maps, I prepared them using scripts run on free FAA sectional charts raster images. Features include ground track bearing, speed, altitude; distance, bearing, and ETA to the destination, destination AFD, and distance, bearing to any point on the map. Maps can be zoomed, and panned just like pictures using two fingers on the touch screen.

It was mostly an exercise in trigonometry, projections, Geo-tagging, and GPS coordinate systems, more than it was an Android programming experience.

Following are some technical details related to the maps and databases preparations. You can email me at governer@gmail.com if you have technical questions on this topic. I will cover Android application programming technical details with code snippets in next few blogs to keep this blog entry manageable.

---- Technical details for preparing maps

The raster maps are available on FAA website at http://aeronav.faa.gov/index.asp?xml=aeronav/applications/VFR/chartlist_sect.

There are 37 sectionals for 48 states, each one divided into 2 parts, North and South. File format is TIFF with Lambert-Conformal-Conic-2 "projection". Total combined data size of these maps is about 10 Gigabyte. The maps are typically updated every 6 months on a per sectional basis.

I needed a script that could automatically download the 37 zip files, unzip them, re-project them to WGS84 (GPS longitude, latitude), burn the borders and legends, combine the 74 TIFF files to generate a master map for the 48 states, then cut this master map to tiles of 512x512 pixels, convert each tile to JPEG while storing the longitude, and latitude of each tile in a Sqlite database, appending the airport facilities directory (also downloaded from FAA) to this database, then zipping the entire structure into one big zip file that will be used the application.

Since Google store does not allow application sizes of greater than 50 MB, I had to split the maps from the application. The maps also get uploaded to the Play store, and my application downloads them when installing on the devices. Android allows loading resources from a ZIP file so I do not unzip the 16000+ JPEG tiles and some databases because that doubles the storage requirement.

The script is a combination of perl, bash, make, C, and uses GDAL python, and TIFF tools. I had to recompile GDAL with BigTIFF support because the master map is 10 GB large TIFF picture, and TIFF files cannot be bigger than 4GB unless BigTIFF is enabled.

Why did I divide the master map into 16000 tiles? This is because even a PC cannot display such a large map, so I have to have tiles on the phone device which I can load from a particular section of the map under the GPS location.

This is  (100th the area) scaled image of the New York North Sectional. 
74 such maps are combined to generate the master map. The legends on the left (and on South for South maps) need to be burnt.

This shows the considerably smaller version of the 100000 pixel  by 40000 pixel master map. 
You can see some seams along sectional boundaries which are due to scanning seams in the individual maps themselves

And this is Alaska


This is the actual size 512 pixel by 512 pixel tile generated by cutting the master image (above) into 16000 equal area pieces. 15 such tiles will be loaded from the area under the aircraft by the app. I store the longitude and latitude of each tile in a Sqlite database.
As you can see there are some black tiles in the master images. I detect and throw away these black tiles by doing a simple Unix diff with a reference zero energy JPEG as part on my automated script.

Everything is done automatically. I just run the script on a fast machine at night, and the maps/database zip file for the application is ready in the morning. Downloading takes an hour on a fast connection, processing the maps takes about 7 hours. The scripts are easy to write once you figure out the technical details with projections, and all technology related to Geo-Tagging. Can I be called a Cartographer after exploring these details?


FAA raster maps can be downloaded using a modified Perl script of http://www.mikealeonetti.com/wiki/index.php/Download_all_files_on_a_website_perl_script (Thank you  Mike A. Leonetti).

So a simple make rule will be:

download:
        mkdir charts
        cd charts && \
        rm -rf *.zip && \
        perl ../reapfiles.pl -f zip http://aeronav.faa.gov/index.asp?xml=aeronav/applications/VFR/chartlist_sect

Then unzip rule is:

unzip:
        cd charts && \
        rm -f *.tif && \
        unzip \*.zip \*.tif && \
        for file in *\ *; do \
                mv "$$file" `echo $$file | sed 's/ //g'`;\
        done

Then I wrote a simple C program that I call stage. This program uses GDAL to stage the 74 charts for combining into a master image. stage.c is attached at the end of the blog.

stage:
        cc stage.c -o stage
        rm -rf merge
        mkdir merge
        ./stage


Maps need to be merged, projected/warped, converted to RGB,  and legends removed. This is done with the stage.c program which uses GDAL (gdal.org).

This is New York North/South joined, and projected to WGS84 ( EPSG:4326). Legends on left and bottom need to be removed.

Side legends removed. This map is ready to be integrated with 36 others to create the master map. Note that circles appear as ovals in projected maps. I have a solution for this when displaying them.

Next, all 37 staged maps are combined to one master image. The master image, matser.tif is 10 GB large.

oneimage:
        rm -f master.tif master.jpeg
        gdal_merge.py merge/*_c.tif -o master.tif
        gdal_translate -outsize 2% 2% -of JPEG master.tif master_small.jpeg

Then split to 512x512 tiles.

split:
        rm -rf tiles
        mkdir tiles
        gdal_retile.py -targetDir tiles -ps 512 512 -useDirForEachRow master.tif


And then the rule for database preparation (see the import of AFD data in the end):

finalize:
        rm -f maps.db
        sqlite3 maps.db 'create table files(name varchar(64),lonul float,latul float,lonll float,latll float,lonur float,latur float,lonlr float,latlr float,lonc float,latc float);'
        for file in `find tiles -name "*.tif" -print | sed 's/.tif'// | sort`; do \
                echo $$file ; \
                gdal_translate -of jpeg -co QUALITY=50 $$file.tif $$file.jpeg; \
                rm -f $$file.jpeg.aux.xml ; \
                cmp -s $$file.jpeg black_tile.jpeg ; \
                RETVAL=$$?; \
                if [ $$RETVAL -eq 0 ]; then \
                        echo removing $$file.jpeg because it has no info ; \
                        rm $$file.jpeg ; \
                else \
                        sqlite3 maps.db "insert into files values(\"$$file\",`gdalinfo $$file.tif | grep "Upper Left" | sed 's/Upper Left\s*(\s*//' | sed 's/).*//'`, `gdalinfo $$file.tif | grep "Lower Left" | sed 's/Lower Left\s*(\s*//' | sed 's/).*//'`, `gdalinfo $$file.tif | grep "Upper Right" | sed 's/Upper Right\s*(\s*//' | sed 's/).*//'`, `gdalinfo $$file.tif | grep "Lower Right" | sed 's/Lower Right\s*(\s*//' | sed 's/).*//'`, `gdalinfo $$file.tif | grep "Center" | sed 's/Center\s*(\s*//' | sed 's/).*//'`);" ; \
                fi ; \
        done
        sqlite3 maps.db < import.sql

And in the end, generate the zip file for use by the Android app:

zip:
        rm -f tiles.zip
        zip -r -i \*.jpeg -i \*.db -1 -T -q tiles.zip tiles maps.db


Application details coming up in next Blog, at the launch of the application.


If you use my application, or you find this information helpful, I request you to donate some money to keep my PC generating maps when there are FAA updates:

Wednesday, September 5, 2012

Love of Aviation: My First Android Application

Recently Google came out with Nexus-7 Android tablet. While general consumers are salivating about the screen size, processor speed, memory, and flash, any pilot would notice the inclusion of a gyroscope in the device.  Gyroscopes are the backbone of flight instruments and when I first heard about Nexus-7, I thought it would be nice if I could come up with an application that could use the Nexus-7 gyroscope to provide an artificial horizon (attitude indicator), and a heading indicator.

I did end up writing a gyroscopic based in-flight instruments application, and yesterday, I uploaded it to the Google app store (called Google Play).  You can find it when you search for "Attitude Indicator". Direct link is: https://play.google.com/store/apps/details?id=com.ds.gyro

Making the application was simple. Google solved the hard part of combining the gyroscope (http://www.youtube.com/watch?v=C7JQ7Rpwn2k), the accelerometer, and the magnetic compass to provide quaternion, which I converted to pitch, roll, and yaw, using some simple math. Then I used Gimp image editor to create some graphics around the orientation and some simple programming to connect the images to the rotation axis.

There are other applications that exist with similar functionality, but that does not stop me from exploring the technology, and feeling excited about it. 

The application is free. Please install it, test it, then leave comments. If I see some encouraging comments, I will put some more applications on the store, including the one I am currently working on (in testing stage), a free aviation GPS with VFR sectionals of the 48 states.