Skip to content

Commit

Permalink
Merge pull request #116 from pbugnion/geojson-geometries-api-docs
Browse files Browse the repository at this point in the history
GeoJSON geometries api docs
  • Loading branch information
pbugnion committed Mar 12, 2017
2 parents 1fbdd3e + 6dd285b commit 1176c8f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/source/api.rst
Expand Up @@ -47,8 +47,13 @@ Datasets
--------

.. automodule:: gmaps.datasets
:members: list_datasets, load_dataset, dataset_metadata, load_dataset_as_df
:members: list_datasets, dataset_metadata, load_dataset, load_dataset_as_df

GeoJSON geometries
------------------

.. automodule:: gmaps.geojson_geometries
:members: list_geometries, geometry_metadata, load_geometry

Traitlets
---------
Expand Down
18 changes: 18 additions & 0 deletions gmaps/geojson_geometries/geojson_geometries.py
Expand Up @@ -84,6 +84,24 @@ def geometry_metadata(geometry_name):


def load_geometry(geometry_name):
"""
Fetch a geometry.
:returns:
A python dictionary containing the geometry.
:Examples:
>>> import gmaps
>>> import gmaps.geojson_geometries
>>> gmaps.configure(api_key="AIza...")
>>> countries_geojson = gmaps.geojson_geometries.load_geometry('countries')
>>> m = gmaps.Map()
>>> gini_layer = gmaps.geojson_layer(countries_geojson)
>>> m.add_layer(gini_layer)
>>> m
"""
url = METADATA[geometry_name]["url"]
reader = codecs.getreader("utf-8")
f = urlopen(url)
Expand Down

0 comments on commit 1176c8f

Please sign in to comment.