Category: Spatial stuff

  • How to display a Choropleth map in Jupyter Notebook

    Here is the code: %matplotlib inline import geopandas as gpd import matplotlib as mpl # make rcParams available (optional) mpl.rcParams[‘figure.dpi’]= 144 # increase dpi (optional) world = gpd.read_file(gpd.datasets.get_path(“naturalearth_lowres”)) world = world[ != ‘Antarctica’] # remove Antarctica (optional) world[‘gdp_per_person’] = world.gdp_md_est / world.pop_est g = world.plot(column=’gdp_per_person’, cmap=’OrRd’, scheme=’quantiles’) g.set_facecolor(‘#A8C5DD’) # make the ocean blue (optional) Here […]

  • Python script for geocoding a text file

    Assume that you have a file with some locations as text with one location per line. For example, here are some school names in Copenhagen, Denmark, stored in schools.csv: Hyltebjerg Skole Heibergskolen Ellebjerg Skole Katrinedals Skole Peder Lykke Skolen Amager Fælled Skole Tingbjerg Heldagsskole Øster Farimagsgades Skole Sankt Annæ Gymnasiums Grundskole Lykkebo Skole Randersgades Skole […]

  • How to work with spatial data in Amazon Redshift

    While Redshift does not offer native support for spatial data, indexes and functions, there exists a partial workaround. Redshift supports Python UDFs and can also load custom Python libraries. Out of the box, Redshift has numpy, scipy, pandas and many other useful Python libraries. For spatial functionality, one saving grace is the high quality spatial […]

  • Geocoding Python function for PostgreSQL

    Gratefully making use of what others have provided, i.e. geopy, Google and plpythonu. Type to hold result of geocoding: CREATE TYPE geocoding AS ( place text, latitude double precision, longitude double precision ); Function that does the actual geocoding (to be extended with more vendors. Hint: look at geopy wiki). Takes an (arbitrary) input string […]

  • The new Google Maps: Explorers delight!

    Being interested in maps in general, and specifically vector data, of course I had to take the new Google Maps for a spin. Vector data aside, what fascinated me most was the option to display photos of the current location in the bottom of the screen. Seeing actual photos is incredibly more useful than being […]

  • List of cloud GIS platforms

    This is work in progress… Home

  • Downloading environment data for Denmark

    This post is very Denmark-specific. I was annoyed that downloading environmental data from the ministry of the environment was so cumbersome. Long story made short, here are download URLs for environmental data: Dataset URL Kirkebyggelinjer Skovbyggelinjer Åbeskyttelseslinjer Søbeskyttelseslinjer EF Fuglebeskyttelsesområder EF Habitatområder RAMSAR-områder Naturvildtreservat There are more. […]

  • Trying a Python R-tree implementation

    Rtree is a ctypes Python wrapper of libspatialindex that provides a number of advanced spatial indexing features for the spatially curious Python user.

  • A presentation on spatial indexing

    A friend of mine, who is the CEO of a company that develops an embedded database, asked me to do a presentation on spatial indexing. This was an opportunity for me to brush up on R-trees and similar datastructures. Download the slides The presentation introduces R-trees and spatial indexing to a technical audience, who are […]

  • Having a look at Spacebase

    Spacebase is a spatial datastore that began life as military-grade software, which at least sounds kind of cool. It’s an in-memory database, really, so switch off the cluster and the data is gone. Apparently the same thing was (unknown to the SpaceBase people?) invented in the 90’s by some americans also having the military as […]