1.I will be using QGIS 2.8 for this tutorial and an excel file containing X and Y coordinates of crops affected by bacterial diseases in Western Kenya.The data was collected using a handheld GPS.




2.In QGIS go to Layer>Add Layer>Add delimited layer.




3.Browse the location of the excel file and under the x-field,put the column containing the Easting,and y-field the northings.




4.Click OK and choose the appropriate reference system in the coordinate reference system selector window that pop-ups.



5.Finally,right click on the loaded excel file and save it as a shapefile.














A Digital Elevation Model (DEM) is a 3D representation of a terrain surface.It represents the elevation of the earths surface,including features(vegetation,buildings etc.)The terrain elevations for ground positions are sampled at regularly spaced horizontal intervals.

DEMs are mostly derived from hypsographic data(contour lines) and this is what i have demonstrated below using QGIS version 2.8.

DEMs are useful and has many applications;
  • creation of relief maps
  • rendering of 3D visualization
  • 3D flight planning
  • Line of sight analysis
  • Modelling water flow etc.
  •  
1.In this tutorial,we will be using GRASS,which has a plug-in inQGIS.So to start ensure that the GRASS plug-in is installed.Go to Plugins>Manage and install plug-ins and search for GRASS and install it.For my case it is already installed.






2.Load your contours shapefile.For my case,i have a contour shapefile covering the whole of Kenya.


3.Under Plugins>GRASS,select New Mapset



4.Browse to a folder that will hold your data and click Next


 5.Create a new location and click Next



6.Choose a projection that you will work in and click Next.Since i am working with data for the whole country,Kenya,i have choosen WGS 84/UTM zone 37s.In case you dont know which zone you are in then you can check this website  http://whatutmzoneamiin.blogspot.co.ke



7.A red triangle is drawn showing the area covered by the shapefile.Click Next and enter the name of the Mapset.









8.A window pops up showing the details that you have entered.If you are comfortable with them then click finish.






9.The next step is to load the contours shapefile in our QGIS canvas to the GRASS mapset.
Go to Plugins>GRASS>Open Grass Tools.


10.Under Module List,search for v.in.ogr.qgis.


11.Load the contours shapefile and give the output name then click Run.

 

12.Go to Module List again and search for v.rast.attr.This will convert the vector data to raster.




13.Input the vector data,check in the attribute table which column contains the elevation data and put this as the Attribute field.Then give it the output name and click Run.



14The final step is to convert the raster data into a surface.Go to Module List once again and search for r.surf.contour.




15.Input the raster data and the name of the output and click Run.



16.This generation might take some time and thus patience is necessary.











I used google fusion tables to create an intensity map to visualize equitable revenue allocation per county for the FY 2014/2015 as proposed by the National Government.First i converted the counties boundary shape file to KML(readable by google maps) using the SHAPE SCAPE TOOL,and then merged it with an Excel sheet holding the revenue amount.After some styling,the map is as shown in the link below

Click here to have a feel of the web map


Below is an image showing how the counties KMZ file(which was converted from shapefile) fits exactly onto the Google Earth Kenyan boundary.

As i had promised,today i will talk about openlayers API.I learnt an important principle from my survey class that i would like to put into play in this article i.e 'working from whole to part'.

So first,i will provide an excerpt of the code i compiled to display a map centered at Nairobi.This map contains google maps terrain,street and satellite as its base layers.


OpenLayers is an open source javaScript web map library for displaying map data in web browsers.It provides an API for building rich web-based geographic applications similar to Google Maps and Bing Maps.

It supports GeoRSS,KML,GML and GeoJSON and map data from any source using OGC-standards as Web Map Service or Web Feature Service.

Downloading and using OpenLayers

1.Download the latest version of OpenLayers in .zip or.tar format from http://openlayers.org

2.Once downloaded the compressed folder needs to be extracted,placed into appropriate folder of your choice,and it is recommended that any HTML documents being produced using OpenLayers JavaScript library be saved within this folder

3.The HTML,CSS and JavaScript codes will be written in a text editor,preferably Notepad++(download Notepad++) which is a free text editor based software that offers an easy way to create scripts

4.To find this walk easy,it is appropriate to have some basic knowledge of HTML,CSS and JavaScript.

For starters,here are some books that i used that i think can be helpful.You can supplement with some youtube videos

The OpenLayers code contains the following items

1.JavaScript Library Source: This is the source of any JavaScript library being used e.g

  • OpenLayers JavaScript Library: src="http://openlayers.org/api/OpenLayers.js"

  • Google API:src="http://maps.google.com/maps/api/js?sensor=false"

2.Map Object:The mapobject that will contain the OpenLayers map layers

3.Map Layers: which are the actual map data that will be added into the map object.The layers are created and and added into the map using using the code:

OpenLayers.LayerType(parameters)

In the example above,i have used the google layers.Other layers that can be used include OSM,Bing maps and Web Map Service(WMS) .In my future projects,i will be adding a WMS from Geoserver.

You can view a list of compatible OpenLayers map layers in the website's documentation

3.Map Commands: which controls the map object and map layers.Commands include adding layers and controls to the mapobject.Below are examples of available commands

  • map.addLayer("layer name").It is a command that adds a layer to the map

  • map.addControl is used to add controls e.g layer switcher overview maps etc.

  • map.zoomToMaxExtent makes the map zoom to the maximum extent set by the layer

There is much more to OpenLayers than what i have written here.Time,space and energy cannot allow me to exhaust everything,given that it is an open source API with development being made regularly

If interested in openlayers then you can download the books that i have provided in the links above.

When i was starting this journey of web mapping it took sometime to find resourceful books,and i don't want you to go through the same.That's why i have made it easier by consolidating the resources for you.

With this foundation of openlayers my next article will be 'Combining Postgis,Geoserver,OpenLayers & PHP to build an interactive University of Nairobi Campus Web Map'.

They say charity begins at home and of course there is a motivation behind this topic which i will talk about as a prelude,then discuss briefly about PostGis,Geoserver and PHP before going to the meat of the article.

Just to keep you thinking for the time being you can view examples of beautiful Campus Gis built using various platforms:

Have a blessed week.

I am glad to be back after some time,been busy with other important things,but my silence should not be mistaken for lack of interest in GIS.I was almost being crucified for not updating my blog but from now onwards i will form a habit of doing so more often so as to appease the GIS starved masses out there.

So far so good with my journey of gaining insight about web mapping thanks to my great friend Joseph and my online pal Wanjohi Kibui .I cannot overemphasize the instrumental role the two have played in encouraging me and advising me on which platforms to use to put my maps on the web.

Particularly thankful to Joseph for 'singing' to me continuously about web mapping as early as first year.Back then i didn't have any interest,let alone knowing what it was.

I decided to try it out after my 2nd year internal attachment,gaining some insightful wisdom from Wanjohi Kibui,who went to an extent of sending me some books to kick start this journey.Forever thankful......

Now to the business of the day:

Today i will make my hands dirty with a practical session where i will show you how to get shapefiles from the Open Street Map(OSM) .Getting data out of OSM presents more technical challenges than putting data into it.

I used the spatial manager software to do this(download Spatial manager).Of course there are other methods of doing this e.g using QGIS but personally i prefer doing it this way.

1.Visit Open Street Map(OSM) and zoom in to the area of interest.I choose UoN main campus

2.Click the export tab and save the .osm file in the desired directory
3.Open Spatial Manager and navigate to where you stored the .osm file
4.Right click the file then 'export'
5.Since i am interested only in the buildings in UoN main campus,i will uncheck all the other options
6.Choose the appropriate geometry under the 'Allowed geometry type'.
7.Choose the appropriate co-ordinate system
8.It is indeed a success
9.You can now upload the shapefiles to any GIS software for further analysis

With a few clicks,we have gotten the necessary data and this has saved us the process of doing the donkey work of digitization.

My next article will be on 'Demystifying Openlayers Application programming Interface'.It actually plays a pivotal role in my web mapping venture and saw it fit to disect it so that any one who hasn't had a hands on experience with it can do so or for those doubting its capabilities can have second thoughts.