You are on page 1of 20

6/20/2016 InterpolatingPointDataQGISTutorialsandTips

Author
Ujaval Gandhi

Follow@spatialthoughts

Change Language

English

Download PDF
[A4] (../pdf/interpolating_point_data_a4.pdf) [Letter] (../pdf/interpolating_point_data_letter.pdf)

Share
11

Interpolating Point Data


Interpolation is a commonly used GIS technique to create continuous surface from discrete points. A lot of
real world phenomena are continuous - elevations, soils, temperatures etc. If we wanted to model these
surfaces for analysis, it is impossible to take measurements throughout the surface. Hence, the eld
measurements are taken at various points along the surface and the intermediate values are inferred by a
process called interpolation. In QGIS, interpolation is achieved using the built-in Interpolationplugin .

Overview of the task


We will take eld depth measurements for a Lake Arlington in Texas and create an elevation relief map and
contours from these measurements.

Other skills you will learn


Creating contours from point data.
Masking no-data values from a raster layer.
Adding labels to a vector layer.

Get the data


Texas Water Development Board provides the shapeles for completed lake surveys
(http://www.twdb.texas.gov/surfacewater/surveys/completed/list/index.asp).

Download the 2007-12 survey shapeles for Lake Arlington


(http://www.twdb.texas.gov/hydro_survey/Arlington/2007-12/Shapeles.zip).

For convenience, you can directly download the sample data used in this tutorial from link below.

Shapeles.zip (http://www.qgistutorials.com/downloads/Shapeles.zip)

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 1/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

Data Sources: [TWDB] (credits.html#twdb)

Procedure
1. Open QGIS. Go to LayerAddLayerAddVectorLayer..

2. Browse to the downloaded Shapefiles.zip le and select it. Click Open.

3. In the Selectlayerstoadd... dialog, hold the Shift key and select


Arlington_Soundings_2007_stpl83.shp and Boundary2004_550_stpl83.shp layers. Click OK.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 2/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

4. You will see the 2 layers loaded in QGIS. The Boundary2004_550_stpl83 layer represents the boundary
of the lake. Un-check the box next to it in the Table of Contents.

5. This will reveal the data from the second layer Arlington_Soundings_2007_stpl83 . Though the data
looks like lines, it is a series of points that are very close.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 3/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

6. Click the Zoom icon and select a small area on the screen. As you zoom closer, you will see the points.
Each point represents a reading taken by a Depth Sounder at the location recorded by a DGPS
equipment.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 4/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

7. Select the Identify tool and click on a point. You will see the IdentifyResults panel show up on the left
with the attribute value of the point. In this case, the ELEVATION attribute contains the depth of the
lake at the location. As our task is to create a depth prole and elevation contours, we will use this
values as input for the interpolation.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 5/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

8. Make sure you have the Interpolationplugin enabled. See Using Plugins (using_plugins.html) for
how to enable plugins. Once enabled, go to RasterInterpolationInterpolation.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 6/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

9. In the Interpolation dialog, select Arlington_Soundings_2007_stpl83 as the Vectorlayers in the Input


panel. Select ELEVATION as the Interpolationattribute. Click Add. Change the CellsizeX and CellsizeY
values to 5 . This value is the size of each pixel in the output grid. Since our source data is in a
projected CRS with Feet-US as units, based on our selection, the grid size will be 5 feet. Click on the ...
button next to Outputfile and name the output le as elevation_tin.tif . CLick OK.

Note
Interpolation results can vary signicantly based on the method and parameters you choose. QGIS
interpolation supports Triagulated Irregular Network (TIN) and Inverse Distance Weighting (IDW) methods
for interpolation. TIN method is commonly used for elevation data whereas IDW method is used for
interpolating other types of data such as mineral concentrations, populations etc. See the Spatial Analysis
(http://docs.qgis.org/2.2/en/docs/gentle_gis_introduction/spatial_analysis_interpolation.html) module of
the QGIS documentation for more details.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 7/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

10. You will see the new later elevation_tin loaded in QGIS. Right-click the layer and select Zoomto
layer.

11. Now you will see the full extent of the created surface. Interpolation does not give accurate results
outside the collection area. Lets clip the resulting surface with the lake boundary. Go to Raster

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 8/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

ExtractionClipper.

12. Name the Outputfile as elevation_tin_clipped.tif . Select the Cliipedmode as Masklayer. Select
Boundary2004_550_stpl83 as the Masklayer`. Click OK.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 9/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

13. A new raster elevation_tin_clipped will be loaded in QGIS. We will now style this layer to show the
dierence in elevations. Note the min and max elevation values from the elevation_tin layer. Right-
click the elevation_tin_clipped layer and select Properties.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 10/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

14. Go to the Style tab. Select Rendertype as Singlebandpseudocolor . In the Generatenewcolormap


panel, select Spectral color ramp. As we want to create a depth-map as opposed to a height-map,
check the Invert box. This will assign blues to deep areas and reds to shallow areas. Click Classify.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 11/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

15. Switch to the Tranparency tab. We want to remove the black-pixels from our output. Enter 0 as the
Additionalnodatavalue. Click OK.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 12/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

16. Now you have a elevation relief map for the lake generated from the individual depth readings. Lets
generate contours now. Go to RasterExtractionContours.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 13/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

17. In the Contour dialog, enter contours as the Outputfileforcontourlines. We will generate contour
lines at 5ft intervals, so enter 5.00 as the Intervalbetweencontourlines. Check the Attributename
box. Click OK.

18. The contour lines will be loaded as contours layer once the processing is nished. Right-click the layer
and select Properties.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 14/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

19. Go to the Labels tab. Check the Labelthislayerwith box and select ELEV as the eld. Select Curved
as the Placement type and click OK.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 15/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

20. You will see that each contour line will be appropriately labeled with the elevation along the line.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 16/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

23Comments QGISTutorialsandTips
1 Login

Recommend 3 Share SortbyBest

Jointhediscussion

AxelAndersson 4daysago
Thankssomuchforyourworkwithalltutorials!I'mbuildingmyownpluginwhereIwanttouse
theInterpolationmethodinQgis,isitpossibletocallthefunctionandsettheparameterandrun
theInterpolation?Ihavefoundonewaytostarttheinterpolationpluginfrommypluginwith:

fromPyQt4.QtGuiimportQAction
foriteminqgis.utils.plugins['processing'].iface.rasterMenu().actions():
if"Interpolation"initem.text():
item.menu().actions()[0].activate(QAction.Trigger)

HoweverIcantfigureouthowto"control"theInterpolationPlugin,likesetwhichlayershouldbe
used,thecellsizeetc.andthenruntheplugin(Idontwanttheuserofmyplugintosetthe
Interpolationpluginparameters)
Reply Share

EdwardLo amonthago
HiUjaval,

Thankyouforyourtutorial.Itriedtoimplementthesameproceduretomypointdata,butwithout
muchsuccess.Isuspecttheproblemisrelatedtothewaymydataisorganized.Whatdoyou
think,haveyouseenthisproblembefore?

Thanks!

Reply Share

UjavalGandhi Mod >EdwardLo amonthago

Hmm.Thatdoesn'tlookright.Trychangingyourcellsizevalueandseeifthatchanges
http://www.qgistutorials.com/en/docs/interpolating_point_data.html 17/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips
Hmm.Thatdoesn'tlookright.Trychangingyourcellsizevalueandseeifthatchanges
yourresults.
Reply Share

EdwardLo>UjavalGandhi 20daysago
Changingthecellsizeincreasestheresolutionwithinthesameareabutdoesnot
expandtheinterpolationtotherestofthepolygon.
Reply Share

David>EdwardLo 5daysago
Havingexactlythesameproblemanyideasonthesolution?Isittodo
withtheCRS?
Reply Share

priyankadas 8monthsago
HiiUjaval,
Iamtryingtoimplementordinarykrigingonvectorpointsdata,howeverduetosomereasons
outputisnotgettingdisplayed.Ifthereisanysampleexampleortutorialrelatedtothis,kindlylet
meknow.
Reply Share

Justin 9monthsago
Hello,
Iamtryingtorunaninterpolationonvectorxyzdata(pointshapefile)buttheanalysisdoesnot
seemtowork.Iamusingasimilaramountofdatatotheexampleabovehoweverthecomputer
simplyoutputsa"null"result...Anyideawhythismaybeoccurring?
Reply Share

UjavalGandhi Mod >Justin 9monthsago

Hardtosay.CanyouattachascreenshotofyourdataaswellastheInterpolationdialog
settings?
Reply Share

BruceAtkinson ayearago
Veryhelpfultutorial!!I'mwonderinghowonemightgoaboutdeterminingtheareawithineachof
thecontourlines.Thiswouldjustbethesimple'flat'areawithoutconsiderationofpeaks,valleys,
etc.

Thanks.
Reply Share

MariaMichail ayearago
HiUjaval,
Iwouldliketoaskyouhowisitpossible,aftertheinterpolation,toextractthedatainatextform.
Reply Share

UjavalGandhi Mod >MariaMichail ayearago

Canyouclarifywhatdatayouwanttoextract?

Ifyouhavelocationsofpointswhereyouwanttoseetheinterpolatedvalues,useRaster
Samplingtogetthosevalueshttp://www.qgistutorials.com/e...
http://www.qgistutorials.com/en/docs/interpolating_point_data.html 18/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips
Samplingtogetthosevalueshttp://www.qgistutorials.com/e...
Reply Share

SayanAcharjee ayearago
Iamsorry,ImeanttosayhowcanIpublishthisasaninteractivewebmap....sothatanyseeker
canunderstandandseethedatasonhoveringthemouse
Reply Share

UjavalGandhi Mod >SayanAcharjee ayearago

Bestoptionistoconverttherasterintovectorandusewebmappingserviceslike
CartoDBorMapboxtocreateaninteractivewebmap.
Reply Share

SayanAcharjee ayearago
HowcanIpublishainterpolatedmap?
Reply Share

UjavalGandhi Mod >SayanAcharjee ayearago

http://www.qgistutorials.com/e...
Reply Share

LorraineWang ayearago
HiUjaval,

Thanksverymuchforthegreattutorial!!HoweverImetaproblem.Instep12anewlayercannot
beautomaticallyloadedintocanvas.Whatisthepossiblereasonforthat?

I'dappreciatealotforyouranswer,thanksalot!!
Reply Share

arpi>LorraineWang ayearago
Ihadexactlythesameprobleminstep12andwasunabletogoon(usingQGIS2.8).
ThenIstartedagainandunzippedtheoriginalshapefileandmanuallychosethefirst
occurrencesofthetwofilestoload.Ithelped.
Reply Share

smundLangeland ayearago
HigreattutorialUjaval!
HowwouldIgoaboutmakingpolygons/surfacesoftheareasbetweenthecontoursandthe
elevationastheattributestothesurface?
Thepointbeingtocreateapolygonshapefileforvariablerateapplicationoflet'ssaylimeafter
interpolatingthepHvaluesofsoilsamples.
Thanks.
Reply Share

UjavalGandhi Mod >smundLangeland ayearago

Thegeneratedsurface'elevation_tin'alreadyhastheelevationvalueasanattribute.If
youwanttoconvertthosevaluestoapolygon,youRasterConversionPolygonize
Reply Share

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 19/20
6/20/2016 InterpolatingPointDataQGISTutorialsandTips

Philioso ayearago
HiUjavalgreattutorialsI'mlearningverymuchhere!

Ihavetwoquestions:
Instep13youwrite"Notetheminandmaxelevationvaluesfromtheelevation_tinlayer."When
Icreatetheclipped*.tifmyvaluerangeis0542...WhenIgotothestylingstep,doIhavetoput
inthe507.296(asminimum)manually?Why?

Asyousaidthebluecolorswillbethedeepareasandtheredareaswillbeshallow.While
invertwouldchangethecolorrampmyquestionremainsthatthedeepareashavesmaller
numbersthantheshallowones...?Thisisprobablysincewehaveelevationdata,no?istherea
wayto"turnthisaround"?
Reply Share

UjavalGandhi Mod >Philioso ayearago

InthePropertiestab,click'Load'underthe'Loadmin/maxvalues'section.Thiswillload
theactualminandmaxvalues.Thatshouldshowyouthe507.296valuesasmin.

Forchangingtheelevations,youcanuserastercalculatortocreateanewlayerwith
formulasuchas

545elevation_tin@1

Thiswillgiveyouarasterwithdepthvaluesinsteadofelevations.(545beingtheground
elevation)
Reply Share

DevMohan>UjavalGandhi 13daysago
HiUjaval,IhavesomedatawhichIwanttoplotasimagebandfordifferenttime
frame.HereIamstuckin1ststep,importnothappening.IhaveexcelwhichI
haveintriedwithnotepadbutstillnosuccess.canyouhelpmetostartwiththis.
Reply Share

NarcliodeSPereiraFilho 2yearsago
Greattutorial.SoonIwillcontinuetheworkoftranslationtutorialsinPortugueseBrazil.
Reply Share

ALSOONQGISTUTORIALSANDTIPS

UsingCustomPythonExpression BuildingaPythonPlugin
Functions 36commentsayearago
18commentsayearago MarkOwenFalkenbergHieverybody.Iam
CarlosHernandoRamiroDearall,Ihavea makingapluginwhereIwanttoaddafolder
question/comment.InWindowswithQGIS pathviaaQFileDialogasintheabove
2.14.1inthefunctioneditor,whenIpress example.Iusethe

Copyright 2015, Ujaval Gandhi. Back to top


Last updated on May 13, 2016.
Created using Sphinx (http://sphinx.pocoo.org/) 1.3.6.

http://www.qgistutorials.com/en/docs/interpolating_point_data.html 20/20

You might also like