Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions cesiumpy/extension/geocode.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@

import cesiumpy.util.common as com

# ToDo: want different geocoders?
_GEOCODER = GoogleV3()
_GEOCODER = None


def _get_geocoder():
global _GEOCODER
if _GEOCODER is None:
# ToDo: want different geocoders?
_GEOCODER = GoogleV3()
return _GEOCODER


def _maybe_geocode(x, height=None):
Expand All @@ -18,7 +25,7 @@ def _maybe_geocode(x, height=None):
height can be used to create base data for Cartesian3
"""
if isinstance(x, six.string_types):
loc = _GEOCODER.geocode(x)
loc = _get_geocoder().geocode(x)
if loc is not None:
if height is None:
# return x, y order
Expand Down