문제

I'm working with OpenStreet Maps in Java with JMap Viwer http://wiki.openstreetmap.org/wiki/JMapViewer I can load the maps and everything ok but I don't know how to draw a line between two points from a latitude and longitude.

Any body know the function to draw this kind of lines?

Thank you.

도움이 되었습니까?

해결책

The addMapPolygon() method of JMapViewer works for this, but paintPolygon() silently rejects a polygon having fewer than three vertices. For a line between two points, just repeat the last Coordinate.

Coordinate one = new Coordinate(...);
Coordinate two = new Coordinate(...);
List<Coordinate> route = new ArrayList<Coordinate>(Arrays.asList(one, two, two));
map.addMapPolygon(new MapPolygonImpl(route));

다른 팁

I am also working on this software and using the JMapviewer.jar. Yet, I do not seem to have the addMapPolygon nor the MapPolygonImpl ... Is there a specific version I should be working with ? (I downloaded my version here: enter link description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top