Skip to content

Commit e2cea91

Browse files
authored
Merge pull request #16 from eyeseast/mapbox
Add mapbox geocoder
2 parents 155d5aa + a972790 commit e2cea91

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Diff for: Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ bing: tests/bing.db
3434
--delay 1 \
3535
--api-key "$(BING_API_KEY)"
3636

37+
.PHONY: mapbox
38+
mapbox: tests/mapbox.db
39+
geocode-sqlite mapbox $^ innout_test \
40+
--location "{full}, {city}, {state} {postcode}" \
41+
--delay 1 \
42+
--api-key "$(MAPBOX_API_KEY)"
43+
44+
45+
.PHONY: run
46+
run:
47+
datasette serve tests/*.db
3748

3849
.PHONY: clean
3950
clean:

Diff for: geocode_sqlite/cli.py

+12
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,15 @@ def open_mapquest(ctx, database, table, location, delay, latitude, longitude, ap
190190
click.echo("Using MapQuest geocoder")
191191
fill_context(ctx, database, table, location, delay, latitude, longitude)
192192
return geocoders.MapQuest(api_key=api_key)
193+
194+
195+
@cli.command("mapbox")
196+
@common_options
197+
@click.option(
198+
"-k", "--api-key", type=click.STRING, required=True, envvar="MAPBOX_API_KEY"
199+
)
200+
def mapbox(ctx, database, table, location, delay, latitude, longitude, api_key):
201+
"Mapbox"
202+
click.echo("Using Mapbox geocoder")
203+
fill_context(ctx, database, table, location, delay, latitude, longitude)
204+
return geocoders.MapBox(api_key=api_key)

0 commit comments

Comments
 (0)