我用这个密码
final JXMapKit jXMapKit1 = new JXMapKit();
jXMapKit1.setDefaultProvider(DefaultProviders.OpenStreetMaps);
jXMapKit1.setCenterPosition(new GeoPosition(45.41984, -3.33924));
jXMapKit1.setZoom(3);
final List<GeoPosition> region = new ArrayList<GeoPosition>();
region.add(new GeoPosition(5.42031, 100.34389));
region.add(new GeoPosition(5.41984, 100.33924));
region.add(new GeoPosition(5.42300, 100.33456));
TileFactoryInfo info = new TileFactoryInfo(
0, //min level
8, //max allowed level
10, // max level
256, //tile size
true, true, // x/y orientation is normal
"file://D:/Tiles", // base url
"x","y","z" // url args for x, y & z
) {
public String getTileUrl(int x, int y, int zoom) {
return this.baseURL +"/"+zoom+"/"+x+"/"+y+".png";
}
};
jXMapKit1.setTileFactory(new DefaultTileFactory(info));
我的瓷砖是用maperitive创建的。但是当我运行appli时,我有一个错误
2013年6月6日上午8:10:05 org.jdesktop.swingx.mapviewer.defaulttilefactory$tilerunner run severe:未能在url加载磁贴:file://d:/tiles/1/255/256.png,重试java.net.unknownhostexception:d
我不明白为什么我有“d:/tiles/1/255/256.png”
1条答案
按热度按时间yws3nbqq1#
尝试
其中数字10是你的最高水平
资料来源:https://today.java.net/pub/a/today/2007/11/13/mapping-mashups-with-jxmapviewer.html#using-自定义Map服务器