#openstreetmap #osm #area

osm-is-area

Is this OpenStreetMap element an area or not?

6 releases (1 stable)

1.0.0 Apr 8, 2021
0.1.4 Mar 2, 2021
0.1.3 Oct 24, 2020

#148 in Geospatial

Download history 5/week @ 2024-06-15 3/week @ 2024-06-22 2/week @ 2024-06-29 3/week @ 2024-07-06 3/week @ 2024-07-13 14/week @ 2024-07-27 5/week @ 2024-08-03 1/week @ 2024-08-10 5/week @ 2024-08-17 8/week @ 2024-08-24 6/week @ 2024-08-31 8/week @ 2024-09-07 1/week @ 2024-09-14 48/week @ 2024-09-21 7/week @ 2024-09-28

66 downloads per month
Used in 2 crates

MIT/Apache

11KB
169 lines

osm-is-area

An OpenSreetMap area must be a way or a relation. But not just any way or relation.

If you are not so fortunate that all your elements are nodes, look further...

API

osm_is_area::way

According to Overpass turbo, a way is considered an area if

  1. It forms a closed loop
  2. It is not tagged area=no
  3. It conforms to one of the conditions for polygon tags.
use osm_is_area;

let tags = vec![
 (r"waterway", r"riverbank")
];
let refs = vec![1, 3, 2, 1];

let is_area = osm_is_area::way(&tags, &refs);
assert_eq!(true, is_area);

osm_is_area::relation

A relation is an area when it has a tag "type" with value "multipolygon".

use osm_is_area;

let tags = vec![
 (r"type", r"multipolygon")
];
let members = vec![1, 3, 2, 1];

let is_area = osm_is_area::relation(&tags, &members);
assert_eq!(true, is_area);

License

MIT


lib.rs:

Returns true if the given way is an area according to Overpass turbo

Examples

use osm_is_area;

let tags = vec![
 (r"waterway", r"riverbank")
];
let refs = vec![1, 3, 2, 1];

let is_area = osm_is_area::way(&tags, &refs);
assert_eq!(true, is_area);

A relation is an area when it has a tag "type" with value "multipolygon".

use osm_is_area;

let tags = vec![
    (r"type", r"multipolygon")
];
let members = vec![1, 3, 2, 1];

let is_area = osm_is_area::relation(&tags, &members);
assert_eq!(true, is_area);

No runtime deps