free and open source gis technology workshop - …€¦ · free and open source gis technology...

89
Baltimore Data Day 2017 Baltimore Neighborhood Indicators Alliance Free and Open Source GIS Technology Workshop Jonathan Dandois, Ph.D. 14 July 2017 Prepared for:

Upload: truongthien

Post on 25-Sep-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

BaltimoreDataDay2017BaltimoreNeighborhood

IndicatorsAlliance

FreeandOpenSourceGISTechnologyWorkshopJonathanDandois,Ph.D.

14July2017

Preparedfor:

Page 2: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page2

Background

WhatisGIS?

GeographicInformationSystems

• GISisthetechnologythathelpscombinedifferenttypesofdatatohelpexplore,analyze,andcommunicatespatialpatterns.

• WithGIS,weoftencombinespatialandnon-spatialdata(tables),andstackmultiplelayersofdatatorepresenttheworld

https://www.in.gov/gis/gis101.htm

Page 3: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page3

WhatcanyoudowithGIS?

AnalyzeandCommunicate

• Analyze->Answercomplexquestionsinvolvingspaceandtime:

• Howmanypeoplelivewithin1mileofaparkandhowlonghavetheylivedthere?

• Communicate->makemapstodeliveramessage

• Howdowechoosemapstylestoconveyourmessage:colors,linethickness,transparency,patterns,symbols?

https://www.in.gov/gis/gis101.htm

Page 4: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page4

TypesofGISData

SpatialData– VectorData

Polygons:Neighborhoods,States,Counties,CensusTracts

Points:Events,locations,stores

Lines:Roads,streams,routes

Page 5: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page5

TypesofGISData

Non-SpatialTabularData

DatatablesfromCSVs,Excel,etc.

Page 6: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page6

TypesofGISData

Non-SpatialTabularData

DatatablesfromCSVs,Excel,etc.

WhatinformationinadatatablecanweusetoRELATEtoourmapdata?

Page 7: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page7

AdditionalResourcesforintrotoGIS

• PennStateUniversityOpenCourses (http://open.ems.psu.edu/courseware)

• Basic:Geography160:MappingourChangingWorld(https://www.e-education.psu.edu/geog160/)

• Complex:GEOG585:OpenWebMapping(https://www.e-education.psu.edu/geog585/)

• QGIS(QuantumGIS)Tutorialshttp://www.qgistutorials.com/en/

Page 8: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page8

ToolsandSoftware

MainTools

GISSoftware

• QGIS(QuantumGIS)http://www.qgis.org/en/site/

• DesktopGISApplicationformapping,cartography,analysis

OfficeTools(somethingtomanagespreadsheetsandtables)

• LibreOffice (https://www.libreoffice.org/)

• FreeandopensourceOffice

Page 9: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page9

ToolsandSoftware

OtherTools

• OSGeo ‘Suiteofgeotools’http://www.osgeo.org/

• GRASSGIS– GISformorecomplexanalyses

• Geoserver /MapServer forsharinglotsofdataontheweb

• OpenStreetMap (mapwebsite,downloadbasemaps,useopengeotoolslikeageocoder)

• ESRIsuiteoftools– usewhatyouhave.

Page 10: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page10

EXAMPLE!CookingClass

Whereare311callsforrats?

Combine311tabledatawithcensustracts.Mapby:‘callcount’pertract.

Page 11: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page11

Getthingssetup

Installprograms

GetandinstallQGISandLibreOffice

QGIS(QuantumGIS)http://www.qgis.org/en/site/

LibreOffice https://www.libreoffice.org/

Page 12: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page12

GetData!

Whatformatsofdataarewelookingfor?

SpatialData

• Shapefile(SHP)- oldformatfromESRI,usuallycomesasazipcomposedofmanyfiles

• GeoJSON (GeoJavascriptObjectNotation)allthedataisstoredinasingletextfile

Others(TopoJSON,geodatabase…)

Page 13: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page13

GetData!

Whatformatsofdataarewelookingfor?

TableData

• CSV(commaseparatedvalues)

• Excelspreadsheets

• TXTtextfile

Page 14: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page14

GetData!

CensusTracts

StartatBaltimoreCityOpenData

1. https://data.baltimorecity.gov/

2. Searchforcensustracts

Page 15: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page15

GetData!

CensusTracts

Page 16: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page16

GetData!

Unzipthefile

Allofthesefiles(exceptforthezip)makeuptheshapefile!

Page 17: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page17

LoadthecensustractsintoQGIS

Page 18: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page18

LoadthecensustractsintoQGIS

Page 19: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page19

LoadthecensustractsintoQGIS

Page 20: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page20

LoadthecensustractsintoQGIS

Page 21: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page21

LoadthecensustractsintoQGIS

Onlyselectthe.shp file,clickOpen.

Page 22: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page22

LoadthecensustractsintoQGIS

Page 23: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page23

LoadthecensustractsintoQGIS

Page 24: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page24

LoadthecensustractsintoQGIS

Page 25: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page25

GetData!

311Data

https://data.baltimorecity.gov/City-Services/311-Customer-Service-Requests/9agw-sxsr/data

Page 26: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page26

GetData!

Startbyapplyingsomefilterstogetthedatawewant

Page 27: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page27

GetData!

Page 28: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page28

GetData! AddfilterforSRType contains‘rat’

Page 29: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page29

GetData! AddfilterforCreatedDate after7/7/2017

Page 30: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page30

GetData! Download/Exportthedata

Page 31: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page31

GetData! LoadCSVintoLibreOffice

Page 32: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page32

GetData! LoadCSVintoLibreOffice

Page 33: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page33

GetData! LoadCSVintoLibreOffice

Page 34: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page34

GetData! LoadCSVintoLibreOffice

Page 35: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page35

GetData! LoadCSVintoLibreOffice

Page 36: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page36

Wehaveneighborhoodinformation:

SoifwehaveamapofNeighborhoodnames,wecouldtrya‘TableJoin’http://www.qgistutorials.com/en/docs/performing_table_joins.html?highlight=table%20join

Wehaveaddresses,sowecould‘geocode’(assignmaplatitudeandlongitudecoordinatestoaddresses:https://www.census.gov/geo/maps-data/data/geocoder.htmlhttp://wiki.openstreetmap.org/wiki/Nominatim

GetData! HowdowemakethisdatareadyforGIS?

Page 37: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page37

Butwealsohavea‘GeoLocation’column

Itismadeupofaddress,zipcodeandcoordinates"1947E31STST21218(39.32634,-76.587748)“

Wewantjustthosecoordinates

GetData! HowdowemakethisdatareadyforGIS?

a.k.a Pointdata

Page 38: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page38

Todothis,wewillusetwotoolsinthespreadsheet:

• FindandReplace(Ctrl+H)

• TexttoColumns

Convertweirdgeolocationtopointdata

Page 39: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page39

SelectthewholeGeolocationcolumnbyclickingtheheaderrow

Convertweirdgeolocationtopointdata

Page 40: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page40

Openfindandreplace

Convertweirdgeolocationtopointdata

Page 41: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page41

Replacelinebreaks(\n)withasemicolon(;)Thisrequireschecking‘regularexpressions’on.The\nisa‘regularexpression’computercodeforalinebreak.

Whenready,clickReplaceAll.

Convertweirdgeolocationtopointdata

Page 42: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page42

NowtheGeolocationisonasingleline

Convertweirdgeolocationtopointdata

Page 43: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page43

Next,splittheGeolocationcolumnintothreenewcolumnsbybreakingeachrowatthesemicolon(makesuretheGeolocationisselected)

Convertweirdgeolocationtopointdata

SelecttheData>TexttoColumnstool

Page 44: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page44

UnderSeparatorOptions,selectonlythesemicolonseparator.

Weusedsemicolontoavoidanyconfusionbetweentabs,spaces,orcommasthatareintheotherpartsoftheGeolocation.

Thepreviewshouldshowthecoordinatesinanewcolumn.

Convertweirdgeolocationtopointdata

Page 45: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page45

Nowwehave3columns.Nextwearegoingtosplitthe3rd columnwhichcontainsthelatitudeandlongitudecoordinatesintotwomorecolumns(oneeachforlatitudeandlongitude

SelectthatlastcolumnandselectData>Texttocolumnsagain.

Convertweirdgeolocationtopointdata

Page 46: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page46

Thistimewewillsplitbasedonthecommatogettwonewcolumns.

Convertweirdgeolocationtopointdata

Page 47: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page47

Highlightthecolumnwiththe(39….NumbersandclickFindandReplace.

Convertweirdgeolocationtopointdata

Page 48: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page48

Almostdone,setuptheFind&ReplacetoFindthesymbol(andreplaceitwithnothing(leavereplaceblank).ThistimeweturnoffRegularexpressionsbecausewecareabouttheactual(character.

Convertweirdgeolocationtopointdata

Page 49: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page49

Tada!Callthisnewcolumnlatitude

Convertweirdgeolocationtopointdata

Page 50: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page50

Nowthistimewiththelastcolumnwiththe-76…numbers,againselectthecolumnandthengotoEdit>Find&Replace

Convertweirdgeolocationtopointdata

Page 51: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page51

Nowreplace)withnothingasbefore

Convertweirdgeolocationtopointdata

Page 52: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page52

Phew,alldone!Callthenewcolumnlongitude.

Youcandeletetheextraleftovercolumnwiththezipcodes(Q)aswedon’tneeditanymore.

SavethisnewfileasaCSV.

NowitstimetobringitintoGIS!

Convertweirdgeolocationtopointdata

Page 53: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page53

BackinQGIS,clicktheiconthatlookslikeacommafor‘AddDelimitedTextLayer’

YoucanalsoaccessthisfromLayer>AddLayer>AddDelimitedTextLayer

Addthe311tabletothemap

Page 54: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page54

UseBrowsetoselecttheCSVfilewejustcreated.

InFileFormat,checktheCSVbox,thewindowshouldautomaticallyreadourfileandrecognizethecoordinatefieldslatitudeandlongitude.

Leaveeverythingelseasdefault.ClickOK.

Addthe311tabletothemap

Page 55: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page55

AnewwindowpopsupaskingfortheCoordinatesystemreferenceforthe311layer.

SelectWGS84

Coordinateslikethis:39.315295,-76.57893AretypicallycalledgeographicorWGScoordinatesandareacommonGPSlatitude,longitudeformat.

Addthe311tabletothemap

Page 56: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page56

Projections/coordinatesystemsareaveryimportantpartofGIS.IfGISfilesarebooksindifferentlanguagesandtheGISsoftwareisatranslator,thentheprojectionstellthetranslatorwhatlanguagethebookwaswritteninsothatitcandoitsjoboftranslating.

Coordinateslikethis:39.315295,-76.57893aretypicallycalledgeographicorWGScoordinatesandareacommonGPSlatitude,longitudeformat.Theircoordinatesystem(projection)languageisWGS84(WorldGeodeticSystem1984).BytellingtheGISsoftwarethatour311coordinatesareoftheWGS84coordinatesystem,itwillknowhowtocorrectlytranslateorpositionthosecoordinatesonamap.

Sometakeawaysonprojections:1. Theyarealwaysneeded2. Ifworkingwithmultipledatalayersyoushouldstrivetogetallyourlayerstobethe

samecoordinatesystemthrough‘re-projecting’thelayers.

QGIShasgreatinformationonprojections:https://docs.qgis.org/2.2/en/docs/user_manual/working_with_projections/working_with_projections.html

Projections!!!

Page 57: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page57

Yeah!Nowour311Ratruboutpointsareonthemap!

Addthe311tabletothemap

Page 58: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page58

Beforewegoon,weneedtosaveour311pointsasashapefilesothatQGISrememberswhatitsprojectionisandsothatifwewanttocomebacklaterandusethisdata,wedon’thavetoreloaditfromcsv.

RightclickthepointlayerintheLayersPanelandselectSaveAs.

Savethe311dataasaShapefile

Page 59: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page59

ClickBrowsenexttoSaveAsandspecifyafilenameandalocationforsavingthenewfile.Iused:311_Customer_Service_Requests_WGS84.shp

LeaveeverythingelsethesameandclickOK.

Savethe311dataaShapefile

Page 60: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page60

RightClickontheoriginal311pointslayerandselectremovetoremoveitfromthemap.

Savethe311dataaShapefile

Page 61: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page61

Nowweshouldsetthewholemap(thepartofQGISthatwearelookingat)tothesameprojection.Atthebottom-leftoftheQGISwindowtherewillbesometextwithalittleglobenexttoit,thistellsusthecurrentmapprojection,wewantthistobethesameasourWGS84shapefiles.Clickthetextnexttotheglobe.

Settheoverallmapprojection

Page 62: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page62

SelecttheWGS84projectionandclickOK.Themapshouldn’tchange,butthetextinthecornerwillnowsayEPSG:4326,whichistheprojectioncodeforWGS84,youmighthavetosearchforit.

Settheoverallmapprojection

The(OTF)meansthaton-the-flyprojectionsareenabled,whichallowsQGIStoautomaticallytranslatebetweendifferentprojections.

Page 63: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page63

NextwearegoingtousetheVector>AnalysisTools>PointsinPolygontooltoperforma‘Spatialjoin’countinghowmany311onepointsfallinsideeachcensustract.

Combiningthetractsand311points

Page 64: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page64

Inthewindowthatpopsupwewanttoleaveeverythingasdefault.TheInputpolygonvectorlayeristhecensustracts.Thepointvectorlayeristhe311pointsandwewanttouseSUMtoaggregatethedata.

Atthebottom,clickBrowse,andspecifyanoutputfilenameandlocation,clickOK.

Combiningthetractsand311points

Page 65: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page65

Uhoh!ACRSWarning!Thetwolayersarenotinthesamecoordinatesystemandaspatialjoinisnotagoodidea!

ClickOK.ItturnsoutQGISwilllettheactiontakeplaceanyway,makingthenewlayer,butwewanttofixthisCRSproblemsincewedon’twantbadresults.

CloseCountPointsinPolygon.

Combiningthetractsand311points

Page 66: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page66

Thenewlayerwejustcreatedwiththedifferentcoordinatesystemsnowshowsupinthe‘LayersPanel’

Let’sremoveitfromthelistandthemapbyrightclickingthenameintheLayersPanelandselectingremovelayer.

ConvertingtheCensusTractLayertoWGS84

Now,rightclicktheinitialcensustractslayerandselect‘SaveAs’

Page 67: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page67

FromthiswindowwearegoingtotellQGIStosaveanewcopyofthecensustractslayer,butthistimewewanttotranslateitandchangeitscoordinatesystemtomatchthepointslayerWGS84.

SpecifyaSaveAsnamebyclickingbrowse,thenselectingalocationandafilename,Inamedmynewfile2010_Census_Profile_by_Census_Tracts_WGS84.shp

ClicktheglobeicontorightofCRS

ConvertingtheCensusTractLayertoWGS84

Page 68: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page68

Thislooksfamiliar!

SelectWGS84.QGISknowstheinitialcoordinatesystemofthecensustractsandbytellingitherewewantittobeinWGS84instead,itwillknowhowtotranslatethecoordinatesfromoneprojectionlanguagetoanother.

ClickOK,thenOKagainonthepreviouswindow.

ConvertingtheCensusTractLayertoWGS84

Page 69: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page69

ThenewWGS84censustractslayerwasaddedtothemap,soletsgoaheadandremovetheinitiallayerbyrightclickingonitandselectingremove.

ConvertingtheCensusTractLayertoWGS84

Page 70: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page70

Nowboththe311pointsandthecensustractsareWGS84shapefilesandthemapisinWGS84.LetsgobacktoPointsinPolygonandtrythatagain.

Combiningthetractsand311points

Page 71: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page71

We’lldoallthesamestepsasbefore,butthistimewhenweclickOK,wewon’tgetaCRSwarning.

Youcanclosethiswindowwhenitsdone.

WecanalsoremovetheotherCensustractslayertoo.

Combiningthetractsand311points

Page 72: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page72

AnalyzingandMappingtheresults

Let’sexploreallourhardwork.Clickthelittleiconwithan‘i’inabluecircle.

Thisistheidentifytool.Clickingonthedifferentcensustractsonthemapwillrevealtheirinformation.

Page 73: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page73

AnalyzingandMappingtheresults

Wecanalsolookattheentireattributetableofthecensustracts.

RightclickthecensustractslayerandselectOpenAttributeTable.

Page 74: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page74

AnalyzingandMappingtheresults

Eachrowisacensustractpolygonandeachcolumnisadifferentattribute.AllthewayattherightisthefieldPNTCNTthatgotaddedwhenwejoinedthe311data.Thisrepresentsthenumberof311pointsineachpolyon.

Letscolorthemapbasedonthisfield!

Page 75: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page75

AnalyzingandMappingtheresults

Closetheattributetable,rightclickonthecensustractlayerintheLayersDialogandselectProperties.

InthewindowthatpopsupselectStyle.

ClickthedropdownthatsaysSingleSymbolandselect‘Graduated’

Page 76: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page76

AnalyzingandMappingtheresults

ChangetheColumntoPNTCNT.Pickacolorrampyoulike.ClickClassify– thewindowwillautomaticallybuildalegend.ClickOKtoseeyournewmap!

Page 77: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page77

AnalyzingandMappingtheresults

Woohoo!That’snotveryexcitingIguess.LooksliketheCitymighthavebeenrespondingtoalotofcallsinthoseneighborhoods.Plusthefirstcategoryis0-78,whichseemslikeitwouldbemisleading!

Page 78: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page78

AnalyzingandMappingtheresults

Let’sadjustthecategoriesabit,leavingonecategoryforjustcensustractsthathadzerocalls,andthenacategoryfortractswithonlyonecall.

Page 79: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page79

AnalyzingandMappingtheresults

That’salittlemoreinteresting,letsmakeamapPDFofthisandshipit!

ButfirstweneedtomakeBaltimorelooknormalandnotallsquishy.

Page 80: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page80

OntheFlyprojection

Before,wesetthelayersandmaptoallthesameprojection,WGS84.Butthatprojectionisjustforgeneraluseanddoesn’tdoagoodjobofpreservingthetrueshapeofthings.Sinceprojectionsarerulesforhowtomaketheroundglobelayflatonapage,somethingisalwayslostordistortedintheprocess.

ButwiththeOntheFlyprojectionmodewecanchangethemaptoabetterprojectionforshowingthetrueshapeofBaltimore,withouthavingtochangeourlayers.

ClickthetextnexttotheglobeagainandthistimeselecttheprojectionwiththeEPSGCode102285thisisforthe“NAD1983HARNMarylandStatePlaneLambertConformalConic”projection!

Page 81: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page81

OntheFlyprojection

Now,thatlooksbetter.

Page 82: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page82

Ctrl+PorFile>NewPrintComposertobringuptheComposerwindow.Giveanamewhenprompted.

Let’sprintthemap

Page 83: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page83

IntheleftpaneloftheComposerwindowselecttheAddNewMapiconandclickanddragasquareontheblankcanvasforwhereyourmapwillbe.

TherearegreatTutorialsforcomposerhere:

http://www.qgistutorials.com/en/docs/making_a_map.html

Let’sprintthemap

Page 84: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page84

UnderLayout,selectLegendanddrawarectangletocreateanewareaforthelegend

Let’sprintthemap

Page 85: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page85

Intherightpanel,selectingItemProperties,thenuncheckingAutoUpdate,willallowyoutoremoveandchangetheitemsthatappearinthelegend.

Let’sprintthemap

Page 86: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page86

Othertoolsallowyoutoaddtextlabels,images,orothermaps.WhenyouaredoneyoucanexportasaPDForanimage.

Let’sprintthemap

Page 87: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page87

• Downloadedspatialandnon-spatialtabledata

• Performeddatatablemanipulationstogetthe311dataintothe

correctformatusingFOSSOfficeSuiteLibreOffice.

• Importedandre-projecteddatainFOSSQGIS

• Performedaspatialjoinbetweenpointandpolygondata

• Styledmapsymbologytobetterreflectthedata

• BuiltasimplemaplayoutandexportedittoaPDF

Summary

Page 88: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page88

• OnlineGISclassesandTutorials:http://open.ems.psu.edu/courseware,http://www.qgistutorials.com/en/

• FOSSSoftwareforGISQGIS(QuantumGIS)http://www.qgis.org/en/site/,LibreOffice (https://www.libreoffice.org/)

• SpatialJoins:http://www.qgistutorials.com/en/docs/performing_spatial_joins.html

• TableJoins:http://www.qgistutorials.com/en/docs/performing_table_joins.html?highlight=table%20join

• Geocoders:https://www.census.gov/geo/maps-data/data/geocoder.htmlhttp://wiki.openstreetmap.org/wiki/Nominatim

• Projections:https://docs.qgis.org/2.2/en/docs/user_manual/working_with_projections/working_with_projections.html

• MapComposer:http://www.qgistutorials.com/en/docs/making_a_map.html

Resources:

Page 89: Free and Open Source GIS Technology Workshop - …€¦ · Free and Open Source GIS Technology Workshop ... page 22 Load the census tracts into QGIS ... //docs.qgis.org/2.2/en/docs/user_manual/working_with_projections

©Fearless|page89

Bonus!– show311callsaonawebpage

Iincludedasimplehtmlwebpagewithsomejavascript forshowingour311callsonamap.

The311callswereexportedasGeoJSON inQGIS,thensavedtoavariableinajavascript filerat_311_calls.js.

ThenasimplehtmlpagewassetupwithLeaflettodrawamarkerforeachofthecallsonawebmap.

Youcanaddlotsoffeaturesofyourownincludingcustomiconsandreadingthecalldatawhenyouclickapin:http://leafletjs.com/examples/quick-start/http://leafletjs.com/examples/custom-icons/