Arcade Expression in the new map viewer generate this error “ Execution Error:Cannot create Geometry in this SpatialReference. Engine is using a diffe

1046
4
04-29-2021 11:46 PM
by Anonymous User
Not applicable

Hi,

 

I have an Arcade expression to pass Lat & Long into my survey 123 fields and it’s working fine when I setup this in the classic map viewer.

However, when I tried to do the same thing in the new map viewer I got the following error “Execution Error:Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.” 

 

Does anyone know what is the problem here?

 

Thanks,

Rawan

Tags (1)
0 Kudos
4 Replies
DavidColey
Frequent Contributor

Hi - no I don't know what is going on with your expression but I can tell you that I am getting a similar error with an Arcade expression that works fine in MapViewer Beta 5 (enterprise 10.8.1) and in the classic map viewer Online, or the Enterprise map viewer.  This expression:

var FutureRd = $feature["future_rd"];
var NumberLanes = $feature["num_lanes"];
var FutureLanes = $feature["fut_lanes"];
var typing = When(FutureRd == 'NO' && NumberLanes == FutureLanes,'Complete, No Widening',
FutureRd == 'NO' && NumberLanes != FutureLanes,
'Complete, Widening Required', 'Future / Unbuilt');
return typing;

fails with a return 'Warning, return type must be a number'.  So even if I cast the NumberLanes and FutureLanes vars as text, still doesn't work in New MapViewer.   If I build the expression in Classic, and then open the map in New, the New Map Viewer does honor the expression.  For now that's my workaround

 

XanderBakker
Esri Esteemed Contributor

Hi @DavidColey ,

The error "Warning, return type must be a number" occurs when you already have a category field selected and you are defining an expression. This expression will be used as the second field and must be numeric. I have had the same error and when I removed the field of the symbology with the cross "x" just above the "+ expression" it worked as expected. 

XanderBakker_0-1620769827278.png

Sorry for the screenshot in Spanish...

DavidColey
Frequent Contributor

Hi @XanderBakker  - yes thank you that was it.  Sorry to have hi-jacked your post @Anonymous User.  The only behavior that was similar - maybe - to what you are experiencing was this: 

At the last beta release in Online of the MapViewer, I noticed that my custom Image basemap was behaving oddly.  The basemap included the world image service, a tile cache, local image service in wkid 3857, and a vector tile cache (streets and labels) in the same web mercator spatial reference. 

For whatever reason, my local tile cache image service was 'shifted' - as if the final Map Viewer beta was not picking up a transformation.  I should tell you that the local tile cache service is created from a mosiac dataset in Pro that contains a re-project function (so I would not have to re-project all of the source tiffs).  However, this seems to have been resolved as I am not seeing the same behavior in the New Map Viewer . . . 

by Anonymous User
Not applicable

yeah I did the same as workaround! but the behavior it self is weird