cannot construct a PeUnit, no constructor in IDL

1000
2
Jump to solution
08-18-2020 08:10 PM
DavidWilton
Occasional Contributor

When using client side projection utility I was getting this error "cannot construct a PeUnit, no constructor in IDL". Google gave no results so I thought I'd log the solution here:

This causes the issue

var extprj = projection.project(new Extent(ext), this.map.spatialReference); // project ext
this.map.setExtent(extprj);

The solution is to create a new extent/clone it to pass into the projection

var extprj = projection.project(new Extent(ext),  new SpatialReference(this.map.spatialReference.wkid)); // project ext
this.map.setExtent(extprj);
If you don't any time attempts are made to clone the map spatial reference it causes errors. 
I was using an older version of the API (3.24) so may have been resolved
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DavidWilton
Occasional Contributor

Solution is to clone the map spatial reference:

var extprj = projection.project(new Extent(ext),  new SpatialReference(this.map.spatialReference.wkid)); // project ext
this.map.setExtent(extprj);

View solution in original post

2 Replies
DavidWilton
Occasional Contributor

Solution is to clone the map spatial reference:

var extprj = projection.project(new Extent(ext),  new SpatialReference(this.map.spatialReference.wkid)); // project ext
this.map.setExtent(extprj);
HaraldLund
New Contributor II

You also have to clone the spatial reference for the geometry object you want to project. Referencing to the map's spatial reference for the geometry object will cause the same error.  

0 Kudos