I am trying to add a new map to my Pro project (Pro 2.4.1) via c# and it is not working. My code looks like this:
var map = MapFactory.Instance.CreateMap("New Map", basemap: Basemap.None);
It creates the map object fine (I can access it via c# and add layers to it and save it as a map file), but it does not add the map to the project to be used there.
In the documentation here
Methods such as
MapFactory.Instance.CreateMap() add the newly created map into the current project. You do not need to write additional code for adding a map to a project.
Is there anything else I can try to get this map addes to my project?
To clarify, can you please confirm if you are not able to see the new map in your Project Catalog Pane within the Maps collection like this screenshot below?
The code should add the new map to the Maps collection as you see below. You will have to actually open the new Map to see it in a Map View (Code here does that). CreateMap method will not open the map.
That is correct, Uma. After further research yesterday, the map showed up a couple of times when I ran that line of code. It seems to maybe be more related to the map than the line of code I pointed out, since sometimes it does show up...or maybe something else. I am not seeing consistent behavior with it.