Showing posts with label Nexus 7. Show all posts
Showing posts with label Nexus 7. Show all posts

Thursday, August 28, 2014

An Introduction to Leaflet, Part I: CSVs and Pop-ups

Leaflet is an open source JavaScript library for publishing interactive web-based and mobile maps. Most tutorials on Leaflet's website are geared towards creating basic maps with a small number of features.

Despite this, the code libraries are capable of doing much more!  Today's post will focus on importing and using point data in spreadsheet form, specifically comma separated value files or *.csv.  (In the next post, we will look at other data types and formats.)  l will use the Leaflet Simple CSV Plugin that contains many different features, which I will describe later.

The data
The data set contains locations of homicides (417) in Chicago during 2013.  It also contains attribute data for incident, type, circumstances, arrests, date, and, location.  It is available through Chicago's large open data portal.

End product:
If you want to skip to see the end result, click this link: http://webmapexamples.net/leaflet-simple-csv-master/index.html.  The screenshot below shows the map on an iPad Mini (Gen 1). Click for a closer vew.

On iPad Mini: A Leaflet Map of Homicides in Chicago, 2013
How I got there...
There are several Leaflet plugins to import *.csv files.  On the web, I found the Leaflet Simple CSV Plugin by Matthew Perry that incorporates several different plugins, including a bonus one for clustering/collecting markers, into one set of code. Furthermore, it contains code for allowing attribute data from the *.csv file to be displayed when a marker is clicked.  

Pop-up displaying attribute data from the *.csv about the homicide
The code package put together many different capabilities. It was easy-to-use, modify, has documentation, and a working example.  I accessed the maps on several devices: two different computers, the iPad mini, an iPhone 4S, and a Nexus 7 tablet.  The only device that had an issue was the iPhone 4S.  When clicking a point market, pop-up attribute data was not always displayed and simply flickered.  I am still looking into this and will post anything I found out.

Resources for Learning Leaflet
Leaflet.js Essentials (Published August 2014)

Where to learn JavaScript and more coding skills for free
Codecademy

Thursday, February 27, 2014

QGIS 2.0 Dufour on a Nexus 7 Tablet

An update for readers of last year's post about QGIS on a Nexus 7 tablet/slate.  In this post, I will  cover downloading, installing, and using QGIS on a Nexus 7 Tablet (1st Generation, 8 GB) running Android 4.4.2 KitKat.  This is the same tablet I used last year.  Keep in mind this tablet's touchscreen is only 7 inches.  Larger tablets are on their way, with a 12" Samsung tablet already available.

You will also gain an understanding of what additional apps you will need to make the experience as smooth as possible.  Lastly, I'll discuss the strengths and weaknesses of QGIS on this particular tablet.

QGIS on Android is a work in progress.  Since many people may try installing QGIS for Android on their own tablet, a friend's, or even a work device, proceed at your own risk. To date: I have not had any problems with installing QGIS on my tablet.

Downloading, Pre-Install, and Installation
  • Before installing QGIS, make sure your device has enough space for installation (~600 MB) and downloading at least a few GIS-related shapefiles or rasters.  On mobile devices, storage can run out really fast.
  • Head over to the QGIS for Android page and select the "Download" link, then click the link for QGIS installer at the top of the page to download the *.apk or Android Application Package.
  • You will also have to download Ministro which is available on Google Play.
To make your QGIS experience even better also download a file explorer app, such as File Manager, and a de/compression app like EasyRar or ZArchiver --since GIS files are really a set of files that work together. Clicking on the screenshots below will enlarge them.

A screenshot of an unpacked shapefile in File Manager
After downloading the APK, head to your download folder and follow the onscreen instructions.  Installation will take a few minutes.  QGIS will appear as a little green android icon with a Q on its stomach.  After starting QGIS, you will be greeted with the familiar loading screen and tips.

Using QGIS
When using QGIS on a tablet, you may want to consider un-checking the "render" button until you are ready for your map to be displayed.  You will  also notice a "canvas rendering" progress bar while maps are rendering.

For this post, I visited the National Atlas page in my tablet's Chrome browser and downloaded several tar files.  Next, I navigated to my "Download" folder on my device, extracted then to a new folder, and then unpacked the contents.

A Single Vector Layer
Even on a small tablet,you can see a lot of real estate...

 Unemployment Rate 2009, by County
Raster and Vector Data
Like a desktop GIS and QGIS on desktop, you can begin to create eye catching and more complex map products--with multiple layers, data types, and labels.
Hawaii, cities, volcanoes, and risk of lava flows, transparent, overlaying imagery. 
Metadata 
Metadata, important regardless of where you do your GIS work, can be viewed using several different programs, below using Android's text editor:


Saving a Map
One esoteric step is when you go to save a map or *.qgs file.  You will have to add the file extension ".qgs" to your filename to be able to successfully save your map. Otherwise, the "save" button will not be available.  (I am currently looking through the bug listings to see if this is already a known issue.)

Impressions 
Good with improvements over earlier versions.  Overall, installing, importing data, symbolizing it, and other basic features of QGIS 2.0 are easy to implement on a small seven inch tablet.

However, you will need patience working on a seven inch screen and there are limitations.  For example, some slide bars for large drop down menus were too thin to select, even with a stylus.  Reordering layers was almost impossible using this small touchscreen.  The map composer was also too difficult to use and did not display well.  Crashes are rare and generally occur when the user performs several different actions very close together in time or sequence.  Performance will vary depending on the device you use.

Newer tablets have increased processing power, memory, and storage--all of which should help performance.  Given the rapid rise of mobile, having a free desktop GIS on tablet so soon is a big achievement!  Later this year, I plan to get a larger tablet--which should improve the ease of use with QGIS. I will be sure to install QGIS for Android and give it another go!