JAVA/SWING /jxmapviewer I want to render map without internet ,I use jxmapviewer library but can't read osm file . i see they use OSMTileFactoryInfo to load zip osm but i don't know how or what the type of zip file must i have.
public static void main(String\[\] args) {
TileFactoryInfo info = new OSMTileFactoryInfo("ZIP archive", "jar:file:/C:/Users/HP/Documents/syria-latest-free.shp.zip!");
TileFactory tileFactory = new DefaultTileFactory(info);
// Setup JXMapViewer
final JXMapViewer mapViewer = new JXMapViewer();
mapViewer.setTileFactory(tileFactory);
GeoPosition frankfurt = new GeoPosition(50.11, 8.68);
// Set the focus
mapViewer.setZoom(7);
mapViewer.setAddressLocation(frankfurt);
// Add interactions
MouseInputListener mia = new PanMouseInputListener(mapViewer);
mapViewer.addMouseListener(mia);
mapViewer.addMouseMotionListener(mia);
mapViewer.addMouseWheelListener(new ZoomMouseWheelListenerCursor(mapViewer));
// Display the viewer in a JFrame
final JFrame frame = new JFrame();
frame.setLayout(new BorderLayout());
frame.add(new JLabel("Use left mouse button to pan and mouse wheel to zoom"), BorderLayout.NORTH);
frame.add(mapViewer);
frame.setSize(800, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("JXMapviewer2 Example 9 - Offline maps");
frame.setVisible(true);
}
}