[josm-dev] get OsmPrimitive just by ID not knowing type
marko.makela at iki.fi
Tue Dec 21 09:07:37 GMT 2010
On Tue, Dec 21, 2010 at 09:54:00AM +0100, Frederik Ramm wrote:
>>Is that a missing feature in JOSM or is it not possible to find an osm
>>object at the server just knowing the id?
>There can be a way with ID 1, a node with ID 1, and a relation with ID 1.
In other words, the ID consists of two components: the object type and
the type-specific ID. If you want to convert it to a single number, you
could (for now, until a new object type is introduced) use something
id=type + osm_id*3
where type=0 for node, 1 for way, 2 for relation
id=type | osm_id << 3
if you want some room for future expansion (3 bits = type codes 0..7)
More information about the josm-dev