How do you add a basemap for ArcGIS Pro using ArcPy?

For example the Esri World Topographic Map

With this URL: https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer

import arcpy
aprx = arcpy.mp.ArcGISProject('CURRENT')
m = aprx.listMaps("Map")[0]


--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) In [6]: Line 5:

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy_mp.py, in addBasemap: Line 2374: return convertArcObjectToPythonObject(self._arc_object.addBasemap(*gp_fixargs((basemap_name,), True)))

RuntimeError: Cannot find Basemap : https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer

1 Answer 1


You pass a name, not a URL. From the documentation:

addBasemap (basemap_name)
Parameter Explanation Data Type
basemap_name The name of the basemap as it appears in the basemap gallery. String

If you want to add a custom basemap, use addDataFromPath.

  • 2
    Thanks. So, this works m.addDataFromPath("https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer") Commented Jul 14, 2023 at 4:15
  • By the way, the basemap from the url looks a bit different (when loaded) to the default ones of ["World Topographic Map", "World Hillshade"]. Do you know how I would add those using ArcPy? Commented Jul 14, 2023 at 4:23
  • I've worked out how to not remove them in the first place by using the dataType in arcpy.Describe(). Commented Jul 14, 2023 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.