You are on page 1of 4

9/3/2016

QGISSplitter

QGISSplitter
HomeFreifunkBerlinZufallsdorfswathProfilepluginGeoklickGedankenImpressum

GridSplitter
GridSplittertakesaninputlayerandcutsitintopieces,storingthe
piecesintosubfolders.
CurrentversioninQGISis0.3.5
Thetileswillhavethefollowingproperties:
Mapdataisuntouched.Ifitwasfloat,itwillstayfloat,ifitwas
sevenbands,theystaysevenbands.
Theymaybeatinybitbiggerthanthesizerequested.Gridsplitter
cutsatpixelborders,andifyoursizegivenandthepixelsize
don'tmatch,itwillcutatthenextpixel.
Withthe"cutlayer"option,theremaybeoverlaps,becauseon
nonrectangularshapesitisdifficulttodeteminewhichraster
pixelis"in"andwhichis"out".
GridSplittterprefersGDALforcuttingrasterlayers,butIassumethat
GDALispresentonalmosteveryplatformwhereQGISisrunning.
Ifitcan'tfindGDAL,itusesthe"processing"frameworkofQGIS.
Itisusingthis(external)programbecauseitcancutmoretypesof
rasterdatathanthetoolincludedinQGIS.Also,itdoesn'tproducefile
"locks"onthetemporaryfilesonWindowssystems.TheQGIStoolis
thereasafallback,butitmayclutterupthetempdirectorywithlotsof
tinyshapefiles.
Exampledataarefoundhere.
TheUIofversion0.3lookslikethis:

http://krambach.de/gridsplitter/

1/4

9/3/2016

QGISSplitter

CuttingMethodsexplained(newinv0.3)
Thefirstoptiontakestheextent,dividesitbythenumbersgivenand
makesthatnumberoftiles.So,ifyouwantyourlayertobecutin25
tiles,you'llgivea5anda5.Thetileswillbemadeslightlybiggerifit
wouldcutthroughapixel.
Thesecondoptionsmakesthetilesinmapunits(usuallymeters),and
calculateshowmanytileswillbeneeded.Itstilltakesintoaccountthe
raster'sresolution,andiftheunitsgivenisn'tamultiplierofthe
resolution,itwillberoundeduptothenextresolutionpixel.
Thethirdoptiondoesn'treallytakerasterresolutionintoaccount,itjust
cutsapieceforeverycutlayerfeature.Usefulformakinglotsofnon
rectangularpieces.Theremaybesomeoverlaps.

Structureandcode
http://krambach.de/gridsplitter/

2/4

9/3/2016

QGISSplitter

First,itstartstheGUIandloopstheGUIuntilcancelisclickedorall
parametersaresetand'okay'isclicked.
Then,ititeratesoveralli,jcombinations,createssubfoldersifthoseare
desired.
Ineveryiteration,itmakesatemporaryshapefilewithapolygonthat
describesthetile.TODO:Thisshouldbeoptimized.
Theintersectionisdone,thelayerisaddedtothemap(ifwanted),and
thetempfileiscleanedaway.
Iftheoptionisselected,itwillthenfillashapefilewithdataonwhere
thesingletilesreside(tileindex).Thisprocesscurrentlyisquiteslow
onsomewindowsmachinesandneedsarework.

Bugsandpotentialissuesin0.3.5
Ifyoufindanybugsorunexpectedbehaviour,pleaseusethebug
trackerathub.qgis.org
nonasciifilenamesdon'twork(onWindows,onLinuxwithutf8
filesystemitworksfine)
DoesnotworkwithGRASSinputlayers.
DoesnotworkwithWMSinputlayers
ItsearchesforgdalwarpifGDALisn'tfound,itfallsbackto
processing.runalg.runalgonWindows(andmac?)machines
doesn'tallowcleaningupoftempfiles(duetofilelock).Thismay
clutterupthefilesystem'stempdirectorywithshapefilesnamed
"gridsplitter_tmpfile*".Theycansafelyberemovedafterclosing
QGIS.
seemstobeaproblemfromoutsidetheplugin
(GDAL/processing/inputdatahandling)

TODOfor0.4
removetempfileproblemonwindows>Bugreportissent
addfullnicdespporforWindows>Seemstobeabugin
python2.7whichwon'tbefixed:(
Addoptiontostopcutting
Addanoptiontonameoutputaftersomecutlayerparameter
insteadofid()
Nooverlapsincutbycutlayer.
addingnaminganddirectoryoptions(e.g.bylowerleftcorner
extent)
OptiontomaketheoutputnonGeotiff/nonshapefile.

Download
Version0.3.5,Jan5,2016:gridSplitter.zip
orgetitdirectlyviapluginrepositoryinQGIS.
Toinstallthenewestversion,justunzipthefileintoyourplugin
directory(e.g.~/.qgis2/python/plugins/)andrestartQGIS
CoderepositoryisatGithub.com
http://krambach.de/gridsplitter/

3/4

9/3/2016

QGISSplitter

Changelog
Version0.3.5:buxfix
TypeErrorwhenusingprocessing:runalgframework
Version0.3.4:bugfixesandnewfeature
startsnowevenwithnonogr/nonGDALcompatiblelayers
present(e.g.openlayers)
addingcolandrowdescriptiontothetileindexshape
Version0.3.3:newfeatures
OnlyGDAL/OGRsupporteddatasetsshouldshowupin
input
directlycreatingtileindex
optiontostoreintodifferentsubfoldersorjustinonefolder
passinggdal/ogrerrorstotemplogfile
Version0.3.2:bugfix,tinyfeaturesadded,documentation
Addedswitchtousegdalwarpiffound.Betterhandlingof
exoticinputs
Removedallcallingsofqgis.gui(notinstallingonsome
win7)
removedproblemthatcausedwindowstocutthesame
polygonoverandover(tempfilelock)
addedwarningifoutputexists
addedwarningbeforeexecuting
improvedhandlingofuserdefinedCRS(noannoyingasks
anymore(?))
gettingridofgapsincutbycutlayer
updateddocumentation,addedtooltipsinUI
cleanupdeletedunnecessaryfiles
shinynewuglyicon
reprojectionifcutlayerisn'tinLayerToBeCut'sCRS
Version0.3.1:bugfixes
Severaltyposwhichaffectedpolygoncuttingandnaming
(wrong"X"extentin0.3errorsinexecutingin0.3)
Typoinrasterbytilesizeresultedinwrong"Y"sizein0.3
Coderewritegettingsomegraspofpythonfunctions.Less
ifnesting
Version0.3:newfeatures,bugfix
Bugfix(vectorpolygonsdidnotcutbecauseofwrong
variable)
addedoption:cutbytilesize
addedoption:cutbycutlayer
Version0.2:
AddedtheopportunitytoaddresultinglayerstoQGIS
LastchangedJanuary,5,2016.

http://krambach.de/gridsplitter/

MaximilianKrambach

4/4

You might also like