Hello,
Since ArcGIS JS SDK 4.31 (probably even since 4.30) I am getting an error "only 'control-points' georeference with 4 control points may be persisted." when I try to upload a Web Map to portal. The Web Map has a Media Layer, which has the "control-points" georeference type. The Media Layer is controlled with two control-points, and it's crucial to have two instead of four to maintain the aspect ratio of the image. Everything seemed to be working fine in 4.29 version of the SDK. Is there a workaround for this issue, except using four control points for the Media Layer?
Thank you!
Solved! Go to Solution.
Hi @JustinasLekavicius , we require 4 control points when saving a media layer item in part so we can calculate to coefficients property. The coefficients property allows us to do things like wrap the image correctly around the date line.
If you only have two control points available, perhaps it would be possible to programmatically create the other two control points? In this codepen I originally define a media layer with two control points. Before saving I use the height and width of the image to create four source points on each of the corners of the image. I use the .toMap() function to get the map coordinates for each of the new source points based off the original georeference. Then you can create a brand new control points georeference with the four new control points and use that to save the media layer. I set the invert blend mode and add the newly saved media layer to the map and it seems to line up really well with the original. Not exactly sure this will work for your use case, but I hope something similar will.
Hi @JustinasLekavicius , we require 4 control points when saving a media layer item in part so we can calculate to coefficients property. The coefficients property allows us to do things like wrap the image correctly around the date line.
If you only have two control points available, perhaps it would be possible to programmatically create the other two control points? In this codepen I originally define a media layer with two control points. Before saving I use the height and width of the image to create four source points on each of the corners of the image. I use the .toMap() function to get the map coordinates for each of the new source points based off the original georeference. Then you can create a brand new control points georeference with the four new control points and use that to save the media layer. I set the invert blend mode and add the newly saved media layer to the map and it seems to line up really well with the original. Not exactly sure this will work for your use case, but I hope something similar will.
I was stuck on this issue for days, and this worked perfectly. Thank you very much!