Author: Sean Gillies Version: 1.0
This document describes a GeoJSON-like protocol for geo-spatial (GIS) vector data.
# Example of using Fiona, pyproj, and Shapely together in a functional | |
# style. | |
import functools | |
import itertools | |
import logging | |
import sys | |
import fiona | |
from pyproj import Proj, transform |
# Translation of Shapefile record geometries in a functional style. | |
from fiona import collection | |
from functools import partial | |
from itertools import imap | |
import logging | |
log = logging.getLogger() | |
# To begin: a few functions to translate geometry coordinates. They call each |
# Making maps with reduce() | |
from matplotlib import pyplot | |
from descartes import PolygonPatch | |
from fiona import collection | |
BLUE = '#6699cc' | |
def render(axes, rec): | |
"""Given matplotlib axes and a record, adds the record as a patch |
# Swapping x, y coords. | |
from descartes import PolygonPatch | |
from fiona import collection | |
from itertools import imap | |
import logging | |
from matplotlib import pyplot | |
log = logging.getLogger() |
{ | |
"metadata": { | |
"name": "Unary union example" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
from itertools import islice | |
import timeit | |
from shapely.geometry import Point | |
from shapely.ops import unary_union | |
def halton(base): | |
"""Returns an iterator over an infinite Halton sequence""" | |
def value(index): | |
result = 0.0 |
from descartes import PolygonPatch | |
from functools import reduce | |
import json | |
import urllib | |
data = urllib.urlopen("https://raw.github.com/gist/3634233/4de4c6de1cd0edbea410cc32bfcc7cbe90a78b44/tlv.json").read() | |
f = json.loads(data) | |
g = f.copy() | |
g['geometry']['coordinates'] = [f['geometry']['coordinates']] |
from descartes import PolygonPatch | |
import fiona | |
from functools import partial, reduce | |
from math import sqrt | |
from itertools import imap | |
import pylab | |
from pyproj import Proj, transform | |
fiona.open = fiona.collection |
There are at least two different dialects of geospatial JSON data on the internet today and we're doing very little to explain to clients or servers which one is being used in a particular interaction. A web API may return data using the application/json
media type if given a f=json parameter (or not) but a client doesn't necessarily know whether it is getting GeoJSON or ArcGIS JSON, two different ways of structuring information about the same kinds of entities.
Profiles