find: Find element for a given condition

Description Usage Arguments Details Value See Also Examples

View source: R/osmar-finding.R

Description

Find element for a given condition

Usage

1
  find(object, condition)

Arguments

object

An osmar object

condition

A condition for the element to find; see details section.

Details

The basis of an osmar object are data.frames; therefore the condition principally follows the rules for subset: logical expression indicating elements or rows to keep.

Furthermore, one has to define on which element and which data of the osmar object the condition applies: element(data(condition)), see osm_descriptors.

Value

The ID of the the element

See Also

binary_grep

Other finding: find_down, find_nearest_node, find_up

Examples

1
2
3
4
5
data("muc", package = "osmar")
  find(muc, node(tags(v == "Marienplatz")))
  find(muc, node(tags(v %agrep% "marienplatz")))
  find(muc, node(attrs(id == 19475890)))
  find(muc, way(tags(k == "highway" & v == "pedestrian")))

Example output

Loading required package: XML
Loading required package: RCurl
Loading required package: bitops
Loading required package: geosphere
Loading required package: sp

Attaching package: 'osmar'

The following object is masked from 'package:utils':

    find

 [1]   19475890   60013073  254057401  332792583  332792584  339957726
 [7]  339957783  339957784  339957785  340082061  393490778  447786250
[13]  447786251  478521714  635847293  699722109  703294147  921892747
[19] 1132414558
 [1]   19475890   19475890   60013073  254057401  254277590  332792583
 [7]  332792583  332792584  339957726  339957782  339957783  339957784
[13]  339957785  340003272  340081204  340082061  341303651  341306421
[19]  393490778  447786250  447786251  478521714  478521714  635847293
[25]  699722109  699722109  703294147  921892747  921892747 1132414558
[1] 19475890
 [1]  96619179  46506591  47430746   4016226   3810397 142980388  96619174
 [8] 105070991  46515625  96619169  35829389  35829386   3810479  96619175
[15]  35829390  35829384  46517477  35829383  35829387  46515632  96619172
[22]  96619173

osmar documentation built on May 1, 2019, 7:33 p.m.

Related to find in osmar...