如何解决未使用KML文件在地图上加载GroundOverLayImage
我想从kml文件在Google地图上添加地面叠加层。为此,我正在使用google map utils依赖关系,从中我们可以访问 KMLLayer 属性并使用它来访问数据。
对于地面覆盖层,我正在这样做。
Iterable<KmlGroundOverlay> kmlGroundOverlay = kmlLayer.getGroundOverlays();
if(kmlGroundOverlay.iterator().hasNext()){
LatLngBounds latLngBounds = kmlGroundOverlay.iterator().next().getLatLngBox();
Log.v("AYAYYAAA",kmlGroundOverlay.iterator().next().getImageUrl());
int width = getResources().getDisplayMetrics().widthPixels;
int height = getResources().getDisplayMetrics().heightPixels;
googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds,width,height,1));
}
但这不起作用。
这是我的kml文件的外观:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd http://www.google.com/kml/ext/2.2 http://code.google.com/apis/kml/schema/kml22gx.xsd">
<Document id="Layers">
<name>Layers</name>
<Snippet></Snippet>
<GroundOverlay id="ID_0">
<name>tif</name>
<Snippet></Snippet>
<drawOrder>1000</drawOrder>
<Icon>
<href>Layer0.png</href>
<viewBoundScale>1.0</viewBoundScale>
</Icon>
<LatLonBox>
<north>0.0</north>
<south>0.0</south>
<east>0.0</east>
<west>0.0</west>
<rotation>0</rotation>
</LatLonBox>
</GroundOverlay>
</Document>
</kml>
感谢您的高级帮助!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。