lecture 0 - Introduction Programming in geoinformatics Autumn 2015 VISION - “Not everyone can be a programmer” ? http://programmers.stackexchange.com/questions/163631/has-not-everyone-can-be-a-programmer-been-stu died http://www.makeuseof.com/tag/6-signs-meant-programmer/ - Final Thoughts VISION - objectives IT - a place for everyone? outside of IT: -science -journalism -data analyses -services -mechanical engineering -... programming in geoinformatics - a basic course? PROGRAMMING LANGUAGES (IN GEOINFORMATICS) -why python? -“Is it true that once you learn one language most of the rest come easy?” (http://programmers.stackexchange.com/questions/108578/is-it-true-that-once-you-learn-one-language- most-of-the-rest-come-easy) -what is next? PROGRAMMING LANGUAGES IN GEOINFORMATICS C / C++ extremely fast low-level most of software written in C++ (ArcGIS, QGIS) big desktop applications not so easy for “everyday-use” problems PROGRAMMING LANGUAGES IN GEOINFORMATICS Java / C# C# - “Microsoft version of Java” mostly desktop application, servers, databases Java - Android JTS, GeoServer PROGRAMMING LANGUAGES IN GEOINFORMATICS Javascript primary client-side web applications server side (node.js, io.js), desktop, mobile (phonegap, react.native), … cartography - visualization and sharing -leaflet.js -turf.js -openlayers -google maps no-sql databases (mongodb, couchdb) ... PROGRAMMING LANGUAGES IN GEOINFORMATICS R -designed by statisticians, for statisticians (?) -created primary for (big) data analysis -implemented statistical methods -creating graphs, visualizations, maps… -shiny - web applications PROGRAMMING LANGUAGES IN GEOINFORMATICS Python -universal language - lot of possibilities -in geoinformatics: -ArcGIS scripting - automatization of processes -visualization and mapping -processing data -... -easy to learn -“scientific language” -web applications, servers, desktop -UNIX -python 2 v 3 ! ( http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html ) PROGRAMMING LANGUAGES IN GEOINFORMATICS Summary http://gis.stackexchange.com/questions/61221/what-programming-languages-are-used-by-different-gis-p latforms http://www.atlefren.net/post/2015/04/gis-programming-languages-breakdown/ http://www.quora.com/Which-programming-language-is-best-for-geographical-information-system-GIS-sof tware http://cdn-media-2.lifehack.org/wp-content/files/2015/07/e25a76a815e29c38d88f1035629b7eaa-2.jpg MOTIVATION - Python is everywhere https://www.python.org/about/success/, https://wiki.python.org/moin/Applications MOTIVATION - Solving problems -automatization of work -tasks that could be repeated -tasks that are boring,... -creating interactive tool for solving task -diploma thesis, -getting data, -parsing data, -visualization, -... import os,os.path,shutil import osgeo.ogr import shapely.wkt shapefile = osgeo.ogr.Open("TM_WORLD_BORDERS-0.3.shp") layer = shapefile.GetLayer(0) thailand = None myanmar = None for i in range(layer.GetFeatureCount()): feature = layer.GetFeature(i) if feature.GetField("ISO2") == "TH": geometry = feature.GetGeometryRef() thailand = shapely.wkt.loads(geometry.ExportToWkt()) elif feature.GetField("ISO2") == "MM": geometry = feature.GetGeometryRef() myanmar = shapely.wkt.loads(geometry.ExportToWkt()) commonBorder = thailand.intersection(myanmar) if os.path.exists("common-border"): shutil.rmtree("common-border") os.mkdir("common-border") spatialReference = osgeo.osr.SpatialReference() spatialReference.SetWellKnownGeogCS('WGS84') driver = osgeo.ogr.GetDriverByName("ESRI Shapefile") dstPath = os.path.join("common-border", "border.shp") dstFile = driver.CreateDataSource(dstPath) dstLayer = dstFile.CreateLayer("layer", spatialReference) wkt = shapely.wkt.dumps(commonBorder) feature = osgeo.ogr.Feature(dstLayer.GetLayerDefn()) feature.SetGeometry(osgeo.ogr.CreateGeometryFromWkt(wkt)) dstLayer.CreateFeature(feature) feature.Destroy() dstFile.Destroy() Calculate the border between Thailand and Myanmar (WESTRA - Python Geospatial Development) MOTIVATION - Getting jobs COURSE - conditions and grading system 7 short exams (+- 5 questions) for -2 to +1 points 2 tests (with internet) for 0 to 10 points and 0 to 10 points 1 team project for 0 to 20 points grading (required min. 5 points from team project): 0 - 17 F 18 - 24 E 25 - 28 D 29 - 32 C 33 - 36 B 37+ A COURSE - organization Monday 9:00 - 13:00 Z7 I.05. 10. 2015 - Variables, basic commands, basic data structures II.12. 10. 2015 - Conditions, lists, cycles (+ exam) III.19. 10. 2015 - Tuples, dictionaries, sets, functions (+ exam) IV.26. 10. 2015 - Reading/writing files, exceptions, repeating (+ exam) V.02. 11. 2015 - Libraries - numpy, pyqt, request (+ exam) VI.09. 10. 2015 - Test 1 VII.16. 10. 2015 - Visualization (+ exam) VIII.23. 10. 2015 - Handling data (+ exam) IX.30. 10. 2015 - QGIS / arcGIS scripting (+ exam) X.07. 12. 2015 - Test 2 XI.14. 12. 2015 - Project presentations COURSE - organization Homeworks -not graded, optional -solutions in IS later Team project -team ~ 3 people -presentation -protocol -documented code Absence -send mail before Short exams -at the beginning of the lesson WHERE TO LEARN Online https://codecombat.com/play codeacademy - https://www.codecademy.com/en/tracks/python learn python - http://www.learnpython.org/ learn python the hard way - http://learnpythonthehardway.org/book/index.html python scientific lecture notes - http://scipy-lectures.github.io/index.html pyQGIS - http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/ tutorialspoint - http://www.tutorialspoint.com/python/ Python course - http://www.python-course.eu/course.php http://www.learnpython.org/ WHERE TO LEARN Ebooks SWAROOP - A Byte of python (http://www.mybridge.co/view/5668) SWEIGART - Automate the boring stuff with Python (https://automatetheboringstuff.com/) SEVERANCE - Python for Informatics (http://do1.dr-chuck.com/py4inf/EN-us/book.pdf) LAWHEAD - Learning Geospatial Analysis with Python WESTRA - Python Geospatial Development (http://www.allitebooks.com/python-geospatial-development) MCKINNEY - Python for Data Analysis (http://www.cin.ufpe.br/~embat/Python%20for%20Data%20Analysis.pdf) WHERE TO LEARN Blogs, Social, Communities http://stackoverflow.com / gis.stackexchange.com http://www.python.cz http://geospatialpython.com/ - Points, Polylines, Polygons, Pixels, Python! http://jakevdp.github.io/ - Musings and ramblings through the world of Python and beyond http://www.danielforsyth.me/ http://nbviewer.ipython.org/ - A simple way to share Jupyter Notebooks http://www.analyticsvidhya.com/blog/category/python-2/ - Learn everything About Analytics ... WHERE TO LEARN Editors pyzo - http://www.pyzo.org/ komodo IDE - http://komodoide.com/ sublime text - http://www.sublimetext.com/ pywin - http://sourceforge.net/projects/pywin32/files/pywin32/ pycharm - https://www.jetbrains.com/pycharm/ atom - https://atom.io/ learnpython - http://www.learnpython.org/ getdatajoy - www.getdatajoy.com pyfiddle - http://pythonfiddle.com/