Select to view content in your preferred language

Convert Polygon to Extent

758
2
01-22-2023 03:06 AM
Wade
by
Occasional Contributor

Because the range of the extent is 4 points, it is different from the range drawn by the polygon. Is there a way to make them similar, or is there a way to convert a Polygon object to an Extent object?

I use BaseElevationLayer and I need to give it an extent, I want it to be the polygon that draws the blue part.

Wade_0-1674528730425.png

 

 

 const CElevationLayer = BaseElevationLayer.createSubclass({
                load: function () {
                    this._elevation = new ElevationLayer({
                         // ElevationLayer Service
                    });

                    this.addResolvingPromise(
                        this._elevation.load().then(() => {
                            this.tileInfo = this._elevation.tileInfo;
                            this.spatialReference = this._elevation.spatialReference;
                            this.fullExtent = this.fullExtent || this._elevation.fullExtent;
                        })
                    );

                    return this;
                },
                fetchTile: function (level, row, col, options) {
                    return this._elevation.fetchTile(level, row, col, options).then(
                        function (data) {
                            // data
                            return data;
                        }.bind(this)
                    );
                }
            });

 

 

 

0 Kudos
2 Replies
MichaelLev
Frequent Contributor

every polygon has a built-in "extent" property, which is what you need

0 Kudos
Wade
by
Occasional Contributor

Hi @MichaelLev  Sorry,question updated, my question may not have been expressed clearly.

0 Kudos