I am trying to extract random points from a layer in a collection. It is showing this error "FeatureCollection (Error) A mapped function's arguments cannot be used in client-side operations" The code link is pasted below https://code.earthengine.google.com/541bc1a6d056fa291a3f74851ea981b3
1 Answer
I’m not familiar with Google Earth Engine but will try to help by sharing public docs and proper channels to report this kind of issue.
This error means it detects illegal use of mapped function parameters. To avoid this error, avoid the use of client-side functions in mapped functions.
Looking at your code, I don’t see any part where you use FeatureCollection (or maybe I lack permission to view it) and the error on the console doesn’t specify which code line is problematic but it displays “sm_1km” so maybe focus on those.
You can start with checking the debugging guide and the coding best practices to see if there's any code that can be improved – especially those related to map() or FeatureCollection(). A sample code to get a collection of random points is also shared.
A quick search does not show any result with the exact error you’re encountering. However, I’ve read somewhere that “A mapped function's arguments cannot be used in client-side operations” is a bad error message. ‘The detection for "mapped function's arguments" is really just an "unbound internal variable", which shouldn't happen for other reasons but can anyway sometimes.’
If still no luck, I would recommend visiting the Google Earth Engine’s Help Center for tips and proper channels/forums you can reach out to.
-
Let me know if this has resolved your issue. If it did, an upvote or marking it as accepted would be appreciated as this helps the community.– J_DubuCommented Apr 18 at 14:38