A collection of computer systems and programming tips that you may find useful.
 
Brought to you by Craic Computing LLC, a bioinformatics consulting company.

Friday, April 12, 2013

Zillow Neighborhood Boundaries in GeoJSON and KML for Seattle


The good people at Zillow have invested a lot of time defining the boundaries of around 7,000 neighborhoods in cities around the USA.
These are in the form of ESRI ARC Shapefiles that can be used as overlays on maps.
You can find these at Zillow Neighborhood Boundaries.
Zillow have kindly made these available to the rest of us under a Creative Commons license. This allows you to share and modify the data but you need to attribute Zillow and must distribute any derivative forms of the data under the same or similar licenses. Attribution should take the form of including their logo with a link back to their site.
ESRI shapefiles can be read by many types of mapping software, but one big exception to this is Google Maps. Overlays in Google Maps are loaded from KML format files. In addition GeoJSON is a JSON-based format that is gaining in popularity.
I needed neighborhood boundaries for the City of Seattle in KML format so I can use them in Google Maps. I couldn't find a convenient way to convert from Shapefile directly to KML (although these do exist in some GIS packages) and the solution I came up with involved converting first from Shapefile to GeoJSON and them from GeoJSON to KML. I'll make that software available elsewhere.
My Github Project zillow_seattle_neighborhoods contains the GeoJSON and KML files for the 78 Seattle neighborhoods defined in Zillow's dataset.
The same approach could be applied to derive GeoJSON and KML files for the entire Zillow US city dataset. I'll see if I can do that in the future... for now it just covers Seattle.

Using the Files
You can use either format of file in many GIS packages and mapping programs. Here are a few ideas for people who are new to this area of coding.
You can load KML files into your own maps using Google Maps directly. Look under 'My Places' -> 'Create Map' -> 'Import'. See Google Maps documentation for details.
You can load the KML files into Google Earth for a different experience. The command 'open .kml' on a Mac with Google Earth installed should be enough.
To use these overlays in custom Google Maps you want to use the Google Maps JavaScript API.
I'll add an example HTML page that shows how to do this in due course...
Two important things to note about testing KML overlays in Google Maps in your own HTML pages
1: Your KML files MUST be hosted on a remote server. They will be ignored if you give try and host them from a server on localhost !
2: KML files are CACHED in web pages, just like images. So if you are changing the files, such as changing the colors, these will not be visible unless you work around the caching issue. The easiest way to do this is to add a question mark followed by a random string at the end of the url for the KML file, and change this on every page reload.


1 comment:

jowdjbrown said...

The same approach could be applied to derive GeoJSON and KML files for the entire Zillow US city dataset. I'll see if I can do that in the future... for now it just covers Seattle.speech recognition program

Archive of Tips