Get values from OsmPrimitive
Kai Michael Poppe - OSM
osm at poppe.dev
Fri Jul 10 15:49:44 UTC 2020
Hi Oliver,
when
OsmPrimitive p;
then
p.getId() gives you the LONG Id that corresponds to
p.getType() that could be
OsmPrimitiveType.NODE,
OsmPrimitiveType.WAY or
OsmPrimitiveType.RELATION
p.getKeys() gives you a TagMap of all Keys in p where
p.getKeys().containsKeys(String s) will return true
if s is in the list of keys.
p.get(String s) returns the value of the Key s as a String
If you're expecting a String Id then Long.toString(p.getId()) is your
friend, Integer.parseInt() or Long.parseLong() if you're expecting a
typed number from a String you got by using p.get().
HTH.
Kai (kmpoppe)
On 10.07.2020 17:29, Oliver Raupach wrote:
> Hi,
>
> I am the developer of the HouseNumberTaggingTool. I haven't done
> anything to the plugin for a very very long time and now I want to
> rework some things. So I'm not so familiar with JOSM at the moment. So
> here's a question: I get an OsmPrimitive from the user's selection when
> the plugin is called. How do I get the values for e.g. addr:city or
> addr:street from this OsmPrimitive ?
>
> Oliver Raupach
>
>
More information about the josm-dev
mailing list