I try to display a country delimitation in a jupyter notebook using folium.

I try the following code

#load country from LSIB
countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');

#subset the sri-lanka
sri_lanka = ee.Feature(
        ee.Filter.eq('country_co', 'CE'))

# Use folium to visualize the imagery.
mapid = image.getMapId(sri_lanka, {}, 'sri-lanka')

map = folium.Map(location=[80.773137, 7.873592])
    attr='Map Data &copy; <a href="https://earthengine.google.com/">Google Earth Engine</a>',


and I get the following error

TypeError: getMapId() takes from 1 to 2 positional arguments but 4 were given

I don't really get the problem as in the documentation they describe it as:

Get a Map ID for a given asset

Returns the mapId call results, which may be passed to ee.data.getTileUrl or ui.Map.addLayer. Null if a callback is specified.

and this is exactly how I use it in gee.

Any idea ?


Your call to getMapId() is done on the wrong object. Simply call it on your feature, with or without visualization params, like this:

mapid = sri_lanka.getMapId()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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