[][src]Module wof::utils

Utilities for the WOF ecosystem.

A WOF repository looks like this:

|-- data
|   |-- 101
|   |   |-- 748
|   |   |   |-- 927
|   |   |   |   |-- 101748927-alt-quattroshapes_pg.geojson
|   |   |   |   `-- 101748927.geojson
|   |   |   |-- 929
|   |   |   |   `-- 101748929.geojson
...

The document with the id 101748927 will be in the folder data/101/748/927, here are some functions to work with this tree.

 use wof::utils::*;
 use std::path::Path;
 assert_eq!(id_to_path_folder(890442055).as_path(), Path::new("890/442/055"));
 assert_eq!(id_to_path_geojson(890442055).as_path(), Path::new("890/442/055/890442055.geojson"));
 assert_eq!(id_to_data_path_folder(890442055).as_path(), Path::new("data/890/442/055"));
 assert_eq!(id_to_data_path_geojson(890442055).as_path(), Path::new("data/890/442/055/890442055.geojson"));

Traits

GeoJsonUtils

Trait for JsonValue, it adds some useful features when the JsonValue contains GeoJSON coordinates.

JsonUtils

Trait for JsonValue, it adds some useful features.

Functions

get_available_country_codes

List of all available country codes for WOF repositories.

get_available_us_venues_codes

List of all US codes for WOF venues repositories.

id_to_data_path_folder

Returns the WOF data path folder from an id.

id_to_data_path_geojson

Returns the WOF data path geojson from an id.

id_to_path_folder

Returns the WOF path folder from an id.

id_to_path_geojson

Returns the WOF path geojson from an id.