current position:Home>19. Html2canvas implements ArcGIS API for JavaScript 4 X screenshot function

19. Html2canvas implements ArcGIS API for JavaScript 4 X screenshot function

2022-04-29 16:10:53X Beichen North

Requirements describe

In the course of our project development , Sometimes you need to save or display screenshots of elements drawn on the map or small elements such as icons added , At this time, we need to realize the screenshot function of the map . Currently in ArcGIS API for JavaScript In fact, a screenshot of the map has been provided in API, But it's time to API Support for map basemaps and some customized requirements is not high , Therefore, we usually recommend using the third-party screenshot module during project development , Today, I'll introduce you to two ways of map screenshots , The end result is as follows :

Implementation method

One 、ArcGIS API for JavaScript Built in screenshot mode

The first way to introduce is ArcGIS API for JavaScript Self contained “esri/widgets/Print” Screenshot widget to do , The specific code is as follows :

const print = new Print({
  view: view,
  printServiceUrl:
     "https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"
});

view.ui.add(print, {
  p

copyright notice
author[X Beichen North],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/119/202204291427263995.html

Random recommended