Select to view content in your preferred language

cannot construct a PeUnit, no constructor in IDL

1193
2
Jump to solution
08-18-2020 08:10 PM
DavidWilton
Frequent 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
Frequent 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
Frequent 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
Emerging Contributor

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