Skip to content

Commit

Permalink
✨ whosonfirst_countries.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dphiffer committed Sep 28, 2017
1 parent 0070d1b commit 459a40d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion bin/mk_countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@
$fh = fopen('www/include/lib_whosonfirst_countries.php', 'w');
fwrite($fh, $head);

$countries = array();
$rsp = whosonfirst_places_search('', $filters, $args);
foreach ($rsp['rows'] as $place) {
$esc_id = intval($place['wof:id']);
$esc_name = addslashes($place['wof:name']);
$esc_code = addslashes($place['iso:country']);
$countries[$esc_code] = array(
'wof:id' => $esc_id,
'wof:name' => $place['wof:name']
);
$country = <<<END
'{$place['iso:country']}' => array(
'{$esc_code}' => array(
'wof:id' => $esc_id,
'wof:name' => '$esc_name'
),
Expand All @@ -52,3 +58,6 @@

fwrite($fh, $foot);
fclose($fh);

$countries_json = json_encode($countries);
file_put_contents('www/javascript/whosonfirst_countries.js', "var whosonfirst_countries = $countries_json;");
2 changes: 1 addition & 1 deletion www/include/lib_whosonfirst_countries.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

# this file was also generated by robots on 2017-09-27 18:57:05
# this file was also generated by robots on 2017-09-28 15:03:33
# https://github.com/whosonfirst/whosonfirst-www-api/blob/master/bin/mk_countries.php
# https://github.com/whosonfirst/whosonfirst-www-api/blob/master/Makefile

Expand Down
1 change: 1 addition & 0 deletions www/javascript/whosonfirst_countries.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions www/templates/inc_head.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<script src="{$cfg.abs_root_url}javascript/mapzen.whosonfirst.js"></script>
{/if}

<script src="{$cfg.abs_root_url}javascript/whosonfirst_countries.js"></script>

<link rel="stylesheet" href="{$cfg.abs_root_url}css/mapzen.js.css" />
<script src="{$cfg.abs_root_url}javascript/mapzen.js"></script>

Expand Down

0 comments on commit 459a40d

Please sign in to comment.