How do I set the id for a MarkerLayer?


#1

I must be missing something, but I can’t find anything in the documentation or code that hints at how I would set the id of a MarkerLayer so another package can find it. (Assuming that is the purpose of the MarkerLayer id.) But maybe there’s a better way to retrieve a specific MarkerLayer.


#2

You’re not intended to set the ID of a marker layer. If you want to make your marker layer available to other packages, you should create a service interface to pass it across. You can find an example for this in the find-and-replace package.


#3

Thanks, that makes sense to me. I had initially made a service api but my package creates the marker layer after a buffered process, so it was undefined when the service was consumed. I’ll just need to create the marker layer immediately on package activation. Thanks again!


#4

What you can do instead is to make the service return an object that will allow the consumer to ask for the MarkerLayer when they’re ready for it. This is what the package service is doing in the find-and-replace package here: