Skip to content

Commit 096a0de

Browse files
Merge pull request #48 from azavea/feature/kak/rename-mapzen-to-pelias#42
Rename Mapzen service to Pelias
2 parents 4a379d3 + 028c481 commit 096a0de

File tree

10 files changed

+30
-27
lines changed

10 files changed

+30
-27
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,7 @@ v4.0.0, 2017-08-15
192192
v4.1.0, 2018-03-19
193193
------------------
194194
* Add support for Python 3
195+
196+
v5.0.0, 2018-03-29
197+
------------------
198+
* Rename Mapzen geocoder to Pelias

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ supported geocoders:
88
* `ESRI World Geocoding Service <http://resources.arcgis.com/en/help/arcgis-online-geocoding-rest-api/>`_
99
* `MapQuest Licensed Data API <http://developer.mapquest.com/web/products/dev-services/geocoding-ws>`_
1010
* `MapQuest-hosted Nominatim Open Data API <http://developer.mapquest.com/web/products/open/geocoding-service>`_
11-
* `Mapzen Search API <https://mapzen.com/projects/search/>`_
11+
* `Pelias geocoder <https://pelias.io/>`_. Defaults to use `geocode.earth <https://geocode.earth/>`_
1212
* `Google geocoder <https://developers.google.com/maps/documentation/geocoding/intro>`_
1313

1414
.. NOTE::

omgeo/places.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def to_bing_str(self):
3434
vb = self.convert_srs(4326)
3535
return '%s,%s,%s,%s' % (vb.bottom, vb.left, vb.top, vb.right)
3636

37-
def to_mapzen_dict(self):
37+
def to_pelias_dict(self):
3838
"""
39-
Convert Viewbox object to a string that can be used by Mapzen
39+
Convert Viewbox object to a string that can be used by Pelias
4040
as a query parameter.
4141
"""
4242
vb = self.convert_srs(4326)

omgeo/services/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
from .us_census import USCensus
44
from .mapquest import MapQuest, MapQuestSSL
55
from .nominatim import Nominatim
6-
from .mapzen import Mapzen
6+
from .pelias import Pelias
77
from .google import Google
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
logger = logging.getLogger(__name__)
1515

1616

17-
class Mapzen(GeocodeService):
17+
class Pelias(GeocodeService):
1818
"""
19-
Class to geocode using `Mapzen search service
20-
<https://mapzen.com/projects/search>`_.
19+
Class to geocode using `Pelias search service
20+
<https://pelias.io/>`_.
2121
22-
Settings used by the Mapzen GeocodeService object include:
22+
Settings used by the Pelias GeocodeService object include:
2323
* api_key -- The API key used to access search service.
2424
2525
"""
@@ -38,16 +38,16 @@ def __init__(self, preprocessors=None, postprocessors=None, settings=None):
3838
if 'instance_url' in settings:
3939
self._base_url = settings['instance_url']
4040
else:
41-
self._base_url = 'https://search.mapzen.com'
41+
self._base_url = 'https://api.geocode.earth/'
4242

4343
self._default_endpoint = urljoin(self._base_url,
4444
posixjoin(self._api_version, 'search'))
4545
self._key_endpoint = urljoin(self._base_url,
4646
posixjoin(self._api_version, 'place'))
4747
self._endpoint = self._default_endpoint
4848

49-
preprocessors = Mapzen.DEFAULT_PREPROCESSORS if preprocessors is None else preprocessors
50-
postprocessors = Mapzen.DEFAULT_POSTPROCESSORS if postprocessors is None else postprocessors
49+
preprocessors = Pelias.DEFAULT_PREPROCESSORS if preprocessors is None else preprocessors
50+
postprocessors = Pelias.DEFAULT_POSTPROCESSORS if postprocessors is None else postprocessors
5151
GeocodeService.__init__(self, preprocessors, postprocessors, settings)
5252

5353
def _geocode(self, pq):
@@ -57,7 +57,7 @@ def _geocode(self, pq):
5757
query = dict(query, **{'boundary.country': pq.country})
5858

5959
if pq.viewbox is not None:
60-
box = pq.viewbox.to_mapzen_dict()
60+
box = pq.viewbox.to_pelias_dict()
6161
query = dict(query, **box)
6262

6363
if hasattr(pq, 'key'):

omgeo/tests/tests.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
BING_MAPS_API_KEY = os.getenv("BING_MAPS_API_KEY")
1616
MAPQUEST_API_KEY = os.getenv("MAPQUEST_API_KEY")
17-
MAPZEN_API_KEY = os.getenv("MAPZEN_API_KEY")
17+
PELIAS_API_KEY = os.getenv("PELIAS_API_KEY")
1818
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
1919
ESRI_CLIENT_ID = os.getenv("ESRI_CLIENT_ID")
2020
ESRI_CLIENT_SECRET = os.getenv("ESRI_CLIENT_SECRET")
@@ -44,9 +44,8 @@ class GeocoderTest(OmgeoTestCase):
4444
BING_KEY_REQUIRED_MSG = 'Enter a Bing Maps API key to run the Bing tests.'
4545
MAPQUEST_KEY_REQUIRED_MSG = 'Enter a MapQuest API key to run the MapQuest tests. '\
4646
'Keys can be obtained at http://developer.mapquest.com/.'
47-
MAPZEN_KEY_REQUIRED_MSG = 'Enter a Mapzen Search API key to run Mapzen ' \
48-
'tests. Keys can be obtained at ' \
49-
'https://mapzen.com/developers/sign_in.'
47+
PELIAS_KEY_REQUIRED_MSG = 'Enter a Pelias service search API key to run Pelias tests. '\
48+
'Keys can be obtained at https://geocode.earth/.'
5049
GOOGLE_KEY_REQUIRED_MSG = 'Enter a Google API key to run Google tests.'
5150
ESRI_KEY_REQUIRED_MSG = 'Enter a Esri Client ID & Secret to run authenticated Esri tests.'
5251

@@ -100,9 +99,9 @@ def setUp(self):
10099
self.g_mapquest_ssl = Geocoder([['omgeo.services.MapQuestSSL',
101100
{'settings': mapquest_settings}]])
102101

103-
if MAPZEN_API_KEY is not None:
104-
mapzen_settings = dict(api_key=MAPZEN_API_KEY)
105-
self.g_mapzen = Geocoder([['omgeo.services.Mapzen', {'settings': mapzen_settings}]])
102+
if PELIAS_API_KEY is not None:
103+
pelias_settings = dict(api_key=PELIAS_API_KEY)
104+
self.g_pelias = Geocoder([['omgeo.services.Pelias', {'settings': pelias_settings}]])
106105

107106
if GOOGLE_API_KEY is not None:
108107
self.g_google = Geocoder([['omgeo.services.Google',
@@ -237,10 +236,10 @@ def test_geocode_mapquest_ssl(self):
237236
candidates = self.g_mapquest_ssl.get_candidates(self.pq['azavea'])
238237
self.assertEqual(len(candidates) > 0, True, 'No candidates returned.')
239238

240-
@unittest.skipIf(MAPZEN_API_KEY is None, MAPZEN_KEY_REQUIRED_MSG)
241-
def test_geocode_mapzen(self):
242-
"""Test Azavea's address using Mapzen geocoder"""
243-
candidates = self.g_mapzen.get_candidates(self.pq['azavea'])
239+
@unittest.skipIf(PELIAS_API_KEY is None, PELIAS_KEY_REQUIRED_MSG)
240+
def test_geocode_pelias(self):
241+
"""Test Azavea's address using Pelias geocoder"""
242+
candidates = self.g_pelias.get_candidates(self.pq['azavea'])
244243
self.assertEqual(len(candidates) > 0, True, 'No candidates returned.')
245244

246245
@unittest.skip("FIXME")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def read(fname):
1010

1111
setup(
1212
name="python-omgeo",
13-
version="4.1.0",
13+
version="5.0.0",
1414
description="Geocoding Library using ESRI, Bing Maps, and MapQuest geocoders",
1515
author="Azavea, Inc.",
1616
author_email="info@azavea.com",

sphinx/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# built documents.
4949
#
5050
# The short X.Y version.
51-
version = '4.1.0'
51+
version = '5.0.0'
5252
# The full version, including alpha/beta/rc tags.
5353
release = version
5454

sphinx/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ services
4747
:members:
4848
:inherited-members:
4949

50-
.. automodule:: omgeo.services.mapzen
50+
.. automodule:: omgeo.services.pelias
5151
:members:
5252
:inherited-members:
5353

test.dummy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# RUN AS ROOT
22
export BING_MAPS_API_KEY=YOUR_BING_KEY_HERE
33
export MAPQUEST_API_KEY=YOUR_MAPQUEST_KEY_HERE
4-
export MAPZEN_API_KEY=YOUR_MAPZEN_KEY_HERE
4+
export PELIAS_API_KEY=YOUR_PELIAS_KEY_HERE
55
export GOOGLE_API_KEY=YOUR_GOOGLE_KEY_HERE
66
export ESRI_CLIENT_ID=YOUR_ESRI_CLIENT_ID_HERE
77
export ESRI_CLIENT_SECRET=YOUR_ESRI_CLIENT_SECRET_HERE

0 commit comments

Comments
 (0)