0

I'm coming from R and new to Python, so I assume this is a novice question, but any help would be appreciated. I'm following along with this example to add elevation data to Open Streets Map data using the OSMnx package: https://github.com/gboeing/osmnx-examples/blob/master/notebooks/12-node-elevations-edge-grades.ipynb

When I type the first block of code

from keys import my_google_elevation_api_key 

I get this error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-50-384032deeff7> in <module>()
----> 1 from keys import my_google_elevation_api_key #replace this with your own API key

ModuleNotFoundError: No module named 'keys'

-----------

(Note - I am using an API key from Google as instructed in the example. The code above is intentionally generic.) I'm using jupyter to type the Python code.

shad0w_wa1k3r
  • 12,955
  • 8
  • 67
  • 90

1 Answers1

1

The author probably has a keys.py in which he defines the variable google_elevation_api_key and assigns it a key that he later uses to access the elevation API.

You could simply replace the import line

from keys import my_google_elevation_api_key

with this

my_google_elevation_api_key = '<your_api_key>'
shad0w_wa1k3r
  • 12,955
  • 8
  • 67
  • 90
  • For anyone else who may be similarly new, to make this work in the context of the example, I substituted the object name 'my_google_elevation_api_key' defined as suggested by @shad0w_wa1lk3r for the actual alphanumeric key in the 3rd code block, i.e. G = ox.add_node_elevations(G, api_key=google_elevation_api_key). – Michael Garber Sep 24 '18 at 16:40