AnsweredAssumed Answered

Base map spatial reference

Question asked by farschr_L3 on Sep 28, 2017
Latest reply on Oct 2, 2017 by farschr_L3

I'm running v100.1 and I'm trying to get the spatial reference for a base map from a tile package I've loaded. This worked in 10.2.6 where I loaded this same tile package in QML and could print out latestWkid (3857) and wkid (102100). Now I am reading the same tile package in my v100.1-based C++/Qt Quick application and always get -1 as wkid. So I went to the basic MyFirstMap - you know the starter code from the wizard - and tried to get wkid from it. I added the last four lines of code in the snippet below. I'm getting -1 for both m_map's and m_mapView's spatial reference. Shouldn't I be getting something valid? There must be something fundamental that I'm missing. 




void MyFirstMapV100::componentComplete()
   // find QML MapView component
   m_mapView = findChild<MapQuickView*>("mapView");
   // Create a map using the imageryWithLabels BaseMap
   m_map = new Map(Basemap::imageryWithLabels(this), this);
   // Set map to map view
   SpatialReference sr = m_map->spatialReference();
   qDebug() << sr.wkid();   // returns -1
   sr = m_mapView->spatialReference();
   qDebug() << sr.wkid();   // returns -1



Also, here's an excerpt showing how I'm loading my tile package base map from my application. Again, I'm getting -1 for the spatial references.

   TileCache* tileCache = new TileCache(m_dataPath + "XXXXXXXXXX.tpk");
   ArcGISTiledLayer* tiledLayer = new ArcGISTiledLayer(tileCache, this);
   // What is the spatial reference?
   SpatialReference sr = tiledLayer->spatialReference();
   qDebug() << sr.wkid();   // returns -1
   Basemap* basemap = new Basemap(tiledLayer, this);
   m_map = new Map(basemap, this);
   // What is the spatial reference?
   sr = m_map->spatialReference();
   qDebug() << sr.wkid();   // returns -1