Select to view content in your preferred language

Let a user draw a polygon from a custom widget for Web AppBuilder

425
0
05-11-2022 04:57 AM
JonasNeubürger
Occasional Contributor

Hello,

I am currently developing a custom widget with various things a user can do, such as adding isochrones/distances from an external source and querying those for underlying data, saving those to a hosted feature layer etc..


Now I don't always want to query an isochrone/distance, but let the user draw a polygon themselves.

Since the documentation for the draw toolbox and the first example for using it seemed promising, I am running into issues when trying to initialize a new Draw object.

When trying to initialize the object like this:

 

let tb = new Draw(map);

 

I am getting this error in my browsers console:

 

TypeError: can't access property "getAttribute", this.domNode is null

 

Other operations on the map are working perfectly, like clicking to add a marker at the clicked location, adding layers on a layer the map has or `map.getLayer('XYZ')`.

So, what am I missing here?

Any help is appreciated!

Thanks,

Jonas

0 Kudos
0 Replies