{"id":4935,"date":"2020-03-10T12:58:36","date_gmt":"2020-03-10T04:58:36","guid":{"rendered":"https:\/\/people.utm.my\/shahabuddin\/?p=4935"},"modified":"2020-03-10T13:00:05","modified_gmt":"2020-03-10T05:00:05","slug":"10-python-libraries-for-gis-and-mapping","status":"publish","type":"post","link":"https:\/\/people.utm.my\/shahabuddin\/?p=4935","title":{"rendered":"10 Python Libraries for GIS and Mapping"},"content":{"rendered":"<h1>Python Libraries for GIS and Mapping<\/h1>\n<p>Python libraries are the ultimate extension in GIS because it allows you to boost its core functionality.<\/p>\n<p>By using Python libraries, you can break out of the mould that is GIS and dive into some serious data science.<\/p>\n<p>There are <a href=\"https:\/\/docs.python.org\/3\/library\/\">200+ standard libraries in Python<\/a>. But there are thousands of third-party libraries too. So, it\u2019s endless how far you can take it.<\/p>\n<p>Today, it\u2019s all about Python libraries in GIS. Specifically, what are the most popular Python packages that GIS professionals use today? Let\u2019s get started.<\/p>\n<h1>First, why even use Python libraries for GIS?<\/h1>\n<p>Have you ever noticed how GIS is missing that one capability you need it to do? Because no <a href=\"https:\/\/gisgeography.com\/mapping-out-gis-software-landscape\/\">GIS software<\/a> can do it all, Python libraries can add that extra functionality you need.<\/p>\n<p>Put simply, a Python library is code someone else has written to make life easier for the rest of us. Developers have written open libraries for machine learning, reporting, graphing and almost everything in Python.<\/p>\n<p>If you want this extra functionality, you can leverage those libraries by importing them in your Python script. From here, you can call functions that aren\u2019t natively part of your core GIS software.<\/p>\n<p><strong>PRO TIP:<\/strong> Use <a href=\"https:\/\/www.w3schools.com\/python\/python_pip.asp\" target=\"_blank\" rel=\"noopener noreferrer\">pip<\/a> to install and manage your packages in Python<\/p>\n<div class=\"code-block code-block-3\">\n<h1>Python Libraries for GIS<\/h1>\n<p>If you\u2019re going to build an all-star team for GIS Python libraries, this would be it. They all help you go beyond the typical managing, analyzing and visualizing of spatial data. That is the true <a href=\"https:\/\/gisgeography.com\/what-gis-geographic-information-systems\/\">definition of a geographic information system<\/a>.<\/p>\n<h5><span class=\"listnum\">1<\/span> Arcpy<\/h5>\n<p>If you use Esri ArcGIS, then you\u2019re probably familiar with the <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/arcpy\/get-started\/what-is-arcpy-.htm\" target=\"_blank\" rel=\"noopener noreferrer\">ArcPy library<\/a>. ArcPy is meant for geoprocessing operations. But it\u2019s not only for spatial analysis, but it\u2019s also for data conversion, management and map production with Esri ArcGIS.<\/p>\n<h5><span class=\"listnum\">2<\/span> Geopandas<\/h5>\n<p>Geopandas is like pandas meet GIS. But instead of straight-forward tabular analysis, the <a href=\"http:\/\/geopandas.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">geopandas library<\/a> adds a geographic component. For overlay operations, geopandas uses Fiona and Shapely, which are Python libraries of their own.<\/p>\n<h5><span class=\"listnum\">3<\/span> GDAL\/OGR<\/h5>\n<p>The <a href=\"https:\/\/gdal.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">GDAL\/OGR library<\/a> is used for translating between GIS formats and extensions. QGIS, ArcGIS, ERDAS, ENVI and GRASS GIS and almost all GIS software use it for translation in some way. At this time, GDAL\/OGR supports 97 vector and 162 raster drivers.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium-large wp-image-20301\" src=\"https:\/\/gisgeography.com\/wp-content\/uploads\/2019\/11\/GIS-Formats-Conversions-425x258.png\" alt=\"GIS Formats Conversions\" width=\"425\" height=\"258\" \/><\/p>\n<h5><span class=\"listnum\">4<\/span> RSGISLib<\/h5>\n<p>The <a href=\"https:\/\/www.rsgislib.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">RSGISLib library<\/a> is a set of remote sensing tools for raster processing and analysis. To name a few, it classifies, filters and performs statistics on imagery. My personal favourite is the module for object-based segmentation and classification (GEOBIA).<\/p>\n<h5><span class=\"listnum\">5<\/span> PyProj<\/h5>\n<p>The main purpose of the <a href=\"https:\/\/pypi.org\/project\/pyproj\/\" target=\"_blank\" rel=\"noopener noreferrer\">PyProj library<\/a> is how it works with spatial referencing systems. It can project and transform coordinates with a range of geographic reference systems. PyProj can also perform geodetic calculations and distances for any given datum.<\/p>\n<h1>Python Libraries for Data Science<\/h1>\n<p>Data science extracts insights from data. It takes data and tries to make sense of it, such as by plotting it graphically or using machine learning. This list of Python libraries can do exactly this for you.<\/p>\n<h5><span class=\"listnum\">6<\/span> NumPy<\/h5>\n<p>Numerical Python (<a href=\"https:\/\/numpy.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">NumPy library<\/a>) takes your attribute table and puts it in a structured array. Once it\u2019s in a structured array, it\u2019s much faster for any scientific computing. One of the best things about it is how you can work with other Python libraries like SciPy for heavy statistical operations.<\/p>\n<h5><span class=\"listnum\">7<\/span> Pandas<\/h5>\n<p>The <a href=\"https:\/\/pandas.pydata.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Pandas library<\/a> is immensely popular for data wrangling. It\u2019s not only for statisticians. But it\u2019s incredibly useful in GIS too. Computational performance is key for pandas. The success of Pandas lies in its data frame. Data frames are optimized to work with big data. They\u2019re optimized to such a point that it\u2019s something that Microsoft Excel wouldn\u2019t even be able to handle.<\/p>\n<h5><span class=\"listnum\">8<\/span> Matplotlib<\/h5>\n<p>When you\u2019re working with thousands of data points, sometimes the best thing to do is plot it all out. Enter matplotlib. Statisticians use the <a href=\"https:\/\/matplotlib.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">matplotlib library<\/a> for visual display. Matplotlib does it all. It plots graphs, charts and maps. Even with big data, it\u2019s decent at crunching numbers.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium-plus wp-image-20308\" src=\"https:\/\/gisgeography.com\/wp-content\/uploads\/2019\/12\/matplotlib-550x290.png\" alt=\"matplotlib\" width=\"550\" height=\"290\" \/><\/p>\n<h5><span class=\"listnum\">9<\/span> Scikit<\/h5>\n<p>Lately, machine learning has been all the buzz. And with good reason. Scikit is a Python library that enables machine learning. It\u2019s built in NumPy, SciPy and matplotlib. So, if you want to do any data mining, classification or ML prediction, the <a href=\"https:\/\/scikit-learn.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Scikit library<\/a> is a decent choice.<\/p>\n<h5><span class=\"listnum\">10<\/span> Re (regular expressions)<\/h5>\n<p><a href=\"https:\/\/docs.python.org\/3\/library\/re.html\" target=\"_blank\" rel=\"noopener noreferrer\">Regular expressions (Re)<\/a> are the ultimate filtering tool. When there\u2019s a specific string you want to hunt down in a table, this is your go-to library. But you can take it a bit further like detecting, extracting and replacing with pattern matching.<\/p>\n<h5><span class=\"listnum\">11<\/span> ReportLab<\/h5>\n<p>ReportLab is one of the most satisfying libraries in this list. I say this because GIS often lacks sufficient reporting capabilities. Especially, if you want to create a report template, this is a fabulous option. I don\u2019t know why the <a href=\"https:\/\/www.reportlab.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">ReportLab library<\/a> falls a bit off the radar because it shouldn\u2019t.<\/p>\n<p><strong>PRO TIP:<\/strong> If you need a quick and dirty list of functions for Python libraries, check out <a href=\"https:\/\/www.datacamp.com\/community\/data-science-cheatsheets\" target=\"_blank\" rel=\"noopener noreferrer\">DataCamp\u2019s Cheat Sheets<\/a>.<\/p>\n<p>Source: https:\/\/gisgeography.com\/python-libraries-gis-mapping\/<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Python Libraries for GIS and Mapping Python libraries are the ultimate extension in GIS because it allows you to boost its core functionality. By using Python libraries, you can break out of the mould that is GIS and dive into some serious data science. There are 200+ standard libraries in Python. But there are thousands [&hellip;]<\/p>\n","protected":false},"author":6946,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[24,25,110,5],"tags":[31,36,349,350,348,204],"class_list":["post-4935","post","type-post","status-publish","format-standard","hentry","category-knowledge","category-public","category-research","category-teaching","tag-data","tag-gis","tag-library","tag-mapping","tag-python","tag-science"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"slider-thumb":false,"pop-thumb":false},"uagb_author_info":{"display_name":"Dr. Shah","author_link":"https:\/\/people.utm.my\/shahabuddin\/?author=6946"},"uagb_comment_info":0,"uagb_excerpt":"Python Libraries for GIS and Mapping Python libraries are the ultimate extension in GIS because it allows you to boost its core functionality. By using Python libraries, you can break out of the mould that is GIS and dive into some serious data science. There are 200+ standard libraries in Python. But there are thousands&hellip;","_links":{"self":[{"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/posts\/4935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/users\/6946"}],"replies":[{"embeddable":true,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4935"}],"version-history":[{"count":3,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/posts\/4935\/revisions"}],"predecessor-version":[{"id":4938,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/posts\/4935\/revisions\/4938"}],"wp:attachment":[{"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}