Draw Line between two Geo Points in JMapViewer

前端 未结 2 1996
青春惊慌失措
青春惊慌失措 2020-11-29 12:52

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

2条回答
  •  爱一瞬间的悲伤
    2020-11-29 13:26

    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 route = new ArrayList(Arrays.asList(one, two, two));
    map.addMapPolygon(new MapPolygonImpl(route));
    

提交回复
热议问题