[GraphHopper] get tags using OSMWay
Vadim Chelyshov
qtankle at gmail.com
Thu Jul 9 12:35:54 UTC 2015
You can work with tags only with OSMReader or FlagEncoder.
It depends of what do you want. If you want handle OSMObject you need
implement something like OSMReader.
On 09.07.2015 15:28, Fred Laurent wrote:
> Can you explain me how get tags of way eg: name,highway.. using OSMWay?
>
> 2015-07-09 14:23 GMT+02:00 Vadim Chelyshov <qtankle at gmail.com
> <mailto:qtankle at gmail.com>>:
>
> No, it's absolutely incorrect.
>
> OSMWay osm = new OSMWay(wayID);
> System.out.printl("name of way = "+osm.getTag("name"));
>
> What you expect there? You just create new object and it is empty.
>
>
>
> On 09.07.2015 15:03, Fred Laurent wrote:
>> Is it the correct code ? using OSMWay?
>>
>> 2015-07-09 11:09 GMT+02:00 Fred Laurent <fredlaurent31 at gmail.com
>> <mailto:fredlaurent31 at gmail.com>>:
>>
>> hello , I have a problem ..
>> My code :
>> GraphHopper tmpHopp = new GraphHopper().forMobile();
>> tmpHopp.load(new File(mapsFolder,
>> currentArea).getAbsolutePath());
>> GraphStorage Sgrpah = tmpHopp.getGraph();
>> LocationIndex locationIndex =
>> tmpHopp.getLocationIndex();
>> AllEdgesIterator edges = Sgrpah.getAllEdges();
>> ArrayList<Integer> id = new ArrayList<Integer>();
>> while(edges.next())
>> id.add(edges.getEdge());
>>
>> EdgeIteratorState edge
>> =locationIndex.findClosest(-18.8918640,47.5355036,
>> EdgeFilter.ALL_EDGES).getClosestEdge();
>> tailleEdge =
>> locationIndex.findClosest(-18.8918640,47.5355036,
>> EdgeFilter.ALL_EDGES).getQueryDistance();
>>
>> IDEdge = edge.getEdge();
>>
>> OSMReader osmR = new OSMReader(Sgrpah);
>> long wayID = osmR.getOsmIdOfInternalEdge(IDEdge);
>>
>> OSMWay osm = new OSMWay(wayID);
>> System.out.printl("name of way = "+osm.getTag("name"));
>>
>> I run My app : I have name of way = NULL
>> Why I have NULL but in OSM this not null ?
>> Thank you
>> Laurent
>>
>>
>>
>>
>> _______________________________________________
>> GraphHopper mailing list
>> GraphHopper at openstreetmap.org <mailto:GraphHopper at openstreetmap.org>
>> https://lists.openstreetmap.org/listinfo/graphhopper
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org <mailto:GraphHopper at openstreetmap.org>
> https://lists.openstreetmap.org/listinfo/graphhopper
>
>
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20150709/01795df4/attachment.html>
More information about the GraphHopper
mailing list