Giter VIP home page Giter VIP logo

Comments (6)

mhdostal avatar mhdostal commented on July 18, 2024 1

@mmoosbac94 I was able to reproduce the behavior you're seeing. A Basemap object can only be set on one map, it can't be set on a map, then set on another map. That is why it's working great with the first map, but as soon as you switch maps it doesn't work. The solution is to recreate the array of basemaps you're using whenever you switch maps.

There's one other solution that @rolson mentioned: if you set the basemap of the existing map to nil prior to setting the same basemap on a second map, that will work also. Essentially, a basemap cannot be set on two maps at the same time. As long as you avoid that scenario, everything will work fine.

Let us know if you have any more issues!

from arcgis-maps-sdk-swift.

yo1995 avatar yo1995 commented on July 18, 2024

Thanks for reaching out. Since this is more of a UI/View model issue, would you mind moving this issue to toolkit repo or asking on Esri Community?

Also, please clarify

doesn't work properly anymore (so one basemap can be selected, the other cannot)

  • It seems you are using webmaps from ArcGIS Online given the Map(item:) initializer. Are you trying to switch between maps (i.e., Map instances), or basemaps (Basemap)?
  • Can you further explain "cannot be selected"? i.e., is it an UI issue or a data issue?
  • Do you see any error message logged in the console?
  • It would be great if you can provide a repro code snippet using the BasemapGallery that shows the problem.

Thank you

from arcgis-maps-sdk-swift.

mmoosbac94 avatar mmoosbac94 commented on July 18, 2024

Thank you for the quick response. We decided to ask here because we aren't sure if it is an sdk issue related to different/multiple map initializations. So everything is working fine when using one webmap, but if we initialize another one, it's not working properly anymore.

  • We are trying to switch basemaps on different webmaps. So switching webmaps is working fine, but the basemaps on the displayed webmap cannot be switched after choosing another webmap (so creating a new map instance with fetched portalItems from ArcGIS Online). The weird thing is, that when we first fetch all portalItems and then switch between basemaps everything is working fine. But as soon as we use portalItem with portal argument and specific ID for a default webmap, the switch between basemaps is not working correctly anymore.
  • "Cannot be selected" in this context means to display specific basemap on webmap. We know that the basemaps exist but it's not gonna be updated on webmap.
  • There are not error messages related to this issue.

from arcgis-maps-sdk-swift.

rolson avatar rolson commented on July 18, 2024

cc @mhdostal

from arcgis-maps-sdk-swift.

mmoosbac94 avatar mmoosbac94 commented on July 18, 2024

Oh yes! Very nice. It's working now if we set basemap to nil prior creating a new map with same basemap. But it only seems to work when we use a custom solution for displaying the selection of basemaps. So when we use the BasemapGallery from ArcGIS Toolkit for a second map it is not working. Maybe the BasemapGallery is only meant to cover one map with basemaps.

Thank you very much for your quick help and reply!

from arcgis-maps-sdk-swift.

mhdostal avatar mhdostal commented on July 18, 2024

@mmoosbac94 I just merged a PR into the Toolkit's v.next branch which should fix your issue, without changes on your side (when using the BasemapGallery). This fix was to clone the basemap prior to setting it on the map. This would only apply when the BasemapGallery was initialized with an array of basemap items. When passing in a Portal, the basemap list is refreshed when the gallery is displayed, so there is not the "Object already owned" error in that case.

You could employ the same solution when using your custom method for selecting basemaps. Just call .clone() on your basemap, prior to setting it on the existing map.

Hope that helps.

from arcgis-maps-sdk-swift.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.