How to create fishnets or geospatial grids
There are many use cases in GIS world, where the information has to be aggregated, an easy way to achieve this is via gridding or binning, where the area of interest is divided into small sections called grids or bins.
These sections are mostly of rectangular form (which can be easily converted into geotiffs), but in some cases even circles or hexagons are also used.
You can read a good tutorial from mapbox using Qgis with a mmqgis plugin here.
How to transform projections between Spherical Mercator and EPSG 4326
Projections in GIS are commonly referred to by their “EPSG” codes, these are identifiers managed by the European Petroleum Survey Group.
One common identifier is “EPSG:4326”, which describes maps where latitude and longitude are treated as X/Y values.
Spherical Mercator has an official designation of EPSG:3857. However, before this was established, a large amount of software used the identifier EPSG:900913. This is an unofficial code, but is still the commonly usedin many GIS systems.
How to Query a Shape file for Point inside a polygon using ogr python
Recently I was trying to build a quick geo lookup service in python, which could be used like an “info tool” in QGIS. This task is trivial in almost all geospatial databases, however I wasn’t able to find much online around querying a shape file.
In this post I will demonstrate a simple python code to query a shape file which contains world countries. The file can be downloaded from here.
Binary Search Tree in python
BST data structure supports many dynamic-set operations including
Search Minimum Maximum Predecessor Successor Insert Delete These basic operations allow us to treat this data structure both as a dictionary and as a priority queue.
Basic operations on a binary tree takes time proportional to the height of the tree, O(lg n) [worst case] and even O(n) if the tree is a linear chain.
If you want to learn more about practical application of these trees check this post out.
Heap Sort in python
The (binary) heap data structure is an array object that we can view as a nearly complete binary tree. Each node of the tree corresponds to an element of the array. The tree is completely filled on all levels except possibly the lowest, which is filled from the left up to a point. An array A that represents a heap is an object with two attributes:
length, which (as usual) gives the number of elements in the array.