All Projects → datadesk → latimes-mappingla-api

datadesk / latimes-mappingla-api

Licence: other
A Python wrapper for accessing the Mapping L.A. Boundaries API.

Programming Languages

python
139335 projects - #7 most used programming language

 /'\_/`\                            __                    /\ \     /\  _  \    
/\      \     __     _____   _____ /\_\    ___      __    \ \ \    \ \ \L\ \   
\ \ \__\ \  /'__`\  /\ '__`\/\ '__`\/\ \ /' _ `\  /'_ `\   \ \ \  __\ \  __ \  
 \ \ \_/\ \/\ \L\.\_\ \ \L\ \ \ \L\ \ \ \/\ \/\ \/\ \L\ \   \ \ \L\ \\ \ \/\ \ 
  \ \_\\ \_\ \__/.\_\\ \ ,__/\ \ ,__/\ \_\ \_\ \_\ \____ \   \ \____/ \ \_\ \_\
   \/_/ \/_/\/__/\/_/ \ \ \/  \ \ \/  \/_/\/_/\/_/\/___L\ \   \/___/   \/_/\/_/
                       \ \_\   \ \_\                /\____/                    
                        \/_/    \/_/                \_/__/                     

A python wrapper for accessing the Mapping L.A. API.

Mapping L.A. is the Los Angeles Times’ resource for boundaries, demographics, schools, and news in Los Angeles County. With this API, you can quickly retrieve the boundaries of neighborhoods and regions in KML, KMZ or GeoJSON format.

The code owes a lot to the fine work on python-sunlightapi and python-nytcongressapi.

A demonstration of the API in action can be found in latimes-mappingla-redirect.

Usage

Get it going

>> from mappingla import mappingla

Retrieve all neighborhoods or regions

>> hood_list = mappingla.neighborhoods.all()
>> print hood_list[0].name
Acton
>> region_list = mappingla.regions.all()

Retrieve a neighborhood or region using its slug

>> dtla = mappingla.neighborhoods.get(slug='downtown')
>> westside = mappingla.regions.get(slug='westside')

Find the neighborhood or region that contains a pair of coordinates

>> mappingla.neighborhoods.get(lat=34.053, lng=-118.245)
<Neighborhood: Downtown>
>> mappingla.regions.get(lat=34.053, lng=-118.245)
<Region: Central L.A.>

Retrieve the boundaries of a neighborhood or region in KML, GeoJSON or KMZ format

>> dtla.kml
...
>> dtla.json
...
>> dtla.kmz
...
>> westside.kml
...
>> westside.json
...
>> westside.kmz
...

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].