gpt4 book ai didi

android - KML 图层与 Android Google Maps API 中的 map 形状不匹配

转载 作者:行者123 更新时间:2023-11-30 00:32:25 25 4
gpt4 key购买 nike

我正在开发一个 Android 应用程序,我正在使用 Google Maps Android API 来显示我在西类牙使用 ArcGIS 制作的 KML 图层。我通过将文件地理数据库栅格数据集导出到 KML,使用 ArcGIS 创建了这个图层。 ArcGIS 中文件的空间引用位于 ED_1950_UTM_Zone_30N(投影坐标系)中,形状为西类牙。

问题:图层在我的应用程序 map 中正确显示,但图层的形状与国家/地区的形状不完全匹配(见附图)但是,当我在 PC Windows 桌面版和 Android 版 Google 地球中打开此 KML 时,KML 层会完美地适应国家/地区 map 边界。

我已经在 GitHub 上报告了这个问题,但没有答案:https://github.com/googlemaps/android-maps-utils/issues/394

这是我添加 KML 图层的代码:

try {
mMap.clear();
KmlLayer layer = new KmlLayer(mMap, R.raw.kriging_sqri, getApplicationContext());
layer.addLayerToMap();
mapModeKML = true;
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

这是我的 kriging_sqri.kml 文件的内容,位于 res/raw:

<?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="Kriging_shp3_Clip">
<name>Kriging_shp3_Clip</name>
<Snippet></Snippet>
<GroundOverlay id="0">
<Snippet></Snippet>
<drawOrder>1000</drawOrder>
<name>Kriging_shp3_Clip</name>
<Icon>
<href>file:///storage/emulated/0/BioApp/Layer0.png</href>
<viewBoundScale>1.0</viewBoundScale>
</Icon>
<LatLonBox>
<north>44.67706278743195</north>
<south>35.085026094869</south>
<east>6.152473147346782</east>
<west>-10.78014121100213</west>
<rotation>0</rotation>
</LatLonBox>
</GroundOverlay>
</Document>
</kml>

这就是我的应用程序显示 KML 图层的方式(请注意它的形状如何与国家/地区边界不匹配,尤其是在其南部和东部海岸)。 This is how my app displays the KML layer (notice how its shape does not match with the country land boundaries, specially remarkable on its south and east coast.

但同样的 KML 可以在 Google 地球应用程序中正确显示(我已经在桌面版和安卓版上试过了)。这是它在 Google 地球的 Android 应用程序中的样子:

enter image description here

如有任何帮助,我们将不胜感激!

最佳答案

导出为 KML 时,您应始终先将数据转换为 WGS84 (EPSG 4326)。尝试重新投影您的数据,然后再次导出到 KML。如果这不起作用,请告诉我们,并请共享新 KML 和图像文件(上面示例中的“Layer0.png”)的副本,以便我们可以查看数据并帮助调试。

关于android - KML 图层与 Android Google Maps API 中的 map 形状不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44046492/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com