AW: Get values from OsmPrimitive
Gerd Petermann
gpetermann_muenchen at hotmail.com
Fri Jul 10 16:11:55 UTC 2020
Hi Oliver,
see also methods hasKey() and hasTag().
Gerd
________________________________________
Von: Oliver Raupach <oliver at raupach.cc>
Gesendet: Freitag, 10. Juli 2020 18:04
An: josm-dev at openstreetmap.org
Betreff: Re: Get values from OsmPrimitive
Ah, okay. That worked. Thanks.
Oliver Raupach
Am 10.07.20 um 17:49 schrieb Kai Michael Poppe - OSM:
> 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