Drawing a line between two geometry points in JMapViewer

I work with OpenStreet Maps in Java with JMap Viwer http://wiki.openstreetmap.org/wiki/JMapViewer I can load maps and everything is fine, but I can’t draw a line between two points from latitude and longitude.

Does any body know the function for drawing such lines?

Thanks.

+4
source share
2 answers

The addMapPolygon() method of the JMapViewer works for JMapViewer , but paintPolygon() silently rejects a polygon with less than three vertices. For a line between two points, simply 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)); 
+9
source

I also work on this software and use JMapviewer.jar. However, I don't seem to have addMapPolygon and MapPolygonImpl ... Is there a specific version that I have to work on? (I downloaded my version here: enter the link here

0
source

Source: https://habr.com/ru/post/1414245/


All Articles