For whatever reason, with most basemaps the imagery from the attached KML file is vertically-- but not horizontally-- squished.
ArcGIS.Enums.BasemapTopographicVector
However, at least with `BasemapStyleArcGISImageryStandard` it works.
ArcGIS.Enums.BasemapStyleArcGISImageryStandard
Using some debug statements to look at the spatial references, I'm not seeing a difference between the two basemaps. AFAICT so far, the KML should be projected the same in both cases but very visibly is not.
Thoughts on how this can be fixed?
The basemaps look different to me. What was their coordinate systems
Could you check if you can alternatively use
Enums.BasemapStyleArcGISTopographic
More options in Enums.BasemapStyle enumeration | ArcGIS Runtime API for Qt | ArcGIS Developer
It seems like I can use all the BasemapStyleArcGISXXX maps listed at https://developers.arcgis.com/qt/qml/api-reference/enums-basemapstyle.html. Whereas everything listed in the "Inherited by" box at https://developers.arcgis.com/qt/qml/api-reference/qml-esri-arcgisruntime-basemap.html results in the wrong projection.
ArcGIS.Enums.BasemapTopographicVector
This is invalid and should be
Enums.BasemapStyleArcGISTopographic
What is happening is the basemap style enum was invalid so the basemap fails to load, so the map takes on the first layer's spatial reference, which is the KML in WGS84. The basemap styles are all in web mercator, so we are comparing two different spatial references, hence the different shape.
I use
import Esri.ArcGISRuntime 100.11 as ArcGIS
so the `ArcGIS` component is correct. The BasemapTopographicVector is documented at https://developers.arcgis.com/qt/qml/api-reference/qml-esri-arcgisruntime-basemaptopographicvector.h... so I will assume that that is correct as well.
How would I align the spatial reference, either by setting the basemap's or the KML's? I've tried with something like
spatialReference: Factory.SpatialReference.createWgs84() // I've also tried Factory.SpatialReference.createWebMercator()
initBasemapStyle: Enums.BasemapStyleNone
but that doesn't seem to work. It seems like KMLLayer documentation does not mention supporting reprojection, so maybe the only way to do this is to project everything into WGS84.
Using the SetMapSpatialReference sample app, and adding the KML layer, it looks like it clobbers the map's spatial reference.
import QtQuick 2.6
import Esri.ArcGISRuntime 100.11
Rectangle {
width: 800
height: 600
MapView {
anchors.fill: parent
wrapAroundMode: Enums.WrapAroundModeDisabled
Map {
id: map
// Specify the SpatialReference
spatialReference: SpatialReference { wkid:54024 }
KmlLayer {
dataset: KmlDataset {
url: "http://www.chartbundle.com/charts/kml/sec.kml"
}
}
}
}
Basemap {
id: basemap
ArcGISMapImageLayer {
url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer"
}
}
Component.onCompleted: {
map.basemap = basemap;
}
}
Without KMLLayer:
With KMLLayer: