Skip to content

Commit

Permalink
Add OSM id and type to JSON output. So the elements can be identified…
Browse files Browse the repository at this point in the history
… in OSM
  • Loading branch information
iorala committed Jan 17, 2018
1 parent de309dd commit 7a22955
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions docs/DataRequirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
|wikipedia | wikipedia page of the library (optional) | string | "fr:Bibliothèque de Genève"|
|wikidata | wikidata object of the library (optional) | string | "Q670848" |
|website | other important website related to the library: eg. repository, social media, blog ... (optional)| string | "http://biblio.arc.usi.ch" |
| lat | latitude of the library (only of nodes) | float | 46.5206483|
| lon | longitude of the library (only of nodes) | float | 6.5770502|
| lat | latitude of the library | float | 46.5206483|
| lon | longitude of the library | float | 6.5770502|
| id | OSM ID of the library | int | 695849800 |
| type | OSM Type of the library: node, way, relation (necessary for looking up the id on OSM) | int | way |
6 changes: 6 additions & 0 deletions functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function transform_data($libraries, $tags, $empty_elements) {
$output_tags = select_tags($content["tags"],$tags);
$output_tags["lat"] = $content["lat"];
$output_tags["lon"] = $content["lon"];
$output_tags["id"] = $content["id"];
$output_tags["type"] = $content["type"];
$output[] = $output_tags;
break;

Expand All @@ -81,6 +83,8 @@ function transform_data($libraries, $tags, $empty_elements) {
$output_coordinates = resolve_way($content["nodes"],$empty_elements);
$output_tags["lat"] = $output_coordinates["lat"];
$output_tags["lon"] = $output_coordinates["lon"];
$output_tags["id"] = $content["id"];
$output_tags["type"] = $content["type"];
$output[] = $output_tags;
break;

Expand All @@ -89,6 +93,8 @@ function transform_data($libraries, $tags, $empty_elements) {
$output_coordinates = resolve_rel($content["members"],$empty_elements);
$output_tags["lat"] = $output_coordinates["lat"];
$output_tags["lon"] = $output_coordinates["lon"];
$output_tags["id"] = $content["id"];
$output_tags["type"] = $content["type"];
$output[] = $output_tags;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion osm-libch.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

// Count the libraries
$libcount = count($transformed_data);
$total_count += $libcount;
@$total_count += $libcount;


// Output, separated for each library
Expand Down

0 comments on commit 7a22955

Please sign in to comment.