[英]android - How to add satellte image in osmdroid
I get a .png from my server that represents a satellite image and I would put this image like a layer over the OpenStreetMap so I can see the street (under the satellite image) and the aerial photo on the same map. 我从服务器上获得了代表卫星图像的.png,然后将其像OpenStreetMap上的图层一样放置,以便可以在同一张地图上看到街道(在卫星图像下)和航拍照片。
I use this method 我用这种方法
Drawable d = new BitmapDrawable(getResources(), bitmap);
bb = map.getBoundingBox();
Location SO = new Location(LocationManager.GPS_PROVIDER);
SO.setLatitude(bb.getLonWest());
SO.setLongitude(bb.getLatSouth());
Location NO = new Location(LocationManager.GPS_PROVIDER);
NO.setLatitude( bb.getLonWest());
NO.setLongitude(bb.getLatNorth());
Location NE = new Location(LocationManager.GPS_PROVIDER);
NE.setLatitude(bb.getLonEast());
NE.setLongitude(bb.getLatNorth());
float height = SO.distanceTo(NO);
float width = NE.distanceTo(NO);
Projection projection = map.getProjection();
int y = map.getHeight() / 2;
int x = map.getWidth() / 2;
GeoPoint geoPoint = (GeoPoint) projection.fromPixels(x, y);
deleteLayers(GroundOverlay.class);
GroundOverlay myGroundOverlay = new GroundOverlay();
myGroundOverlay.setImage(d);
myGroundOverlay.setPosition(geoPoint);
myGroundOverlay.setDimensions(width*0.94f, height*1.06f);
map.getOverlays().add(myGroundOverlay);
map.invalidate();
the problem is that the image always is stretch. 问题在于图像始终处于拉伸状态。 my png cover only a part of my map (and it's ok beacuse our png is this way).
我的png只覆盖了我的地图的一部分(没关系,因为我们的png是这种方式)。 When i move in the map the image stretching in all map but and it cover a part of map that it not rappresent.
当我在地图中移动时,图像会在所有地图中拉伸,但会覆盖一部分未出现的地图。 Also, the image is not in the right place (look the red arrow).
另外,图像不在正确的位置(请看红色箭头)。
How can i fix it? 我该如何解决?
假设您的卫星图像仅限于地图的一部分,则可以使用osmbonuspack GroundOverlay。
可能是这个问题: https : //github.com/MKergall/osmbonuspack/issues/273查看有关校正系数的提示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.