Map Related
// Map Related Demo mapFun: function () { // Get Map center point of the let Center = the this .mapView.center; // map center coordinates (the same coordinate system map) the let X = center.x; the let Y = Center. the y-; // map center coordinates (latitude and longitude coordinates) // PS: this map latitude and longitude coordinates are automatically converted from projection, because not necessarily accurate (projection transformation not necessarily accurate) the let longitude = center.longitude; the let Latitude = Center .latitude; // set the map center point of the this .mapView.center = [113.5411, 22.2399 ]; // obtain the map zoom level Zoom = the let the this .mapView.zoom; // set the map zoom level of the this .mapView.zoom = 12 ; // obtain the map scale the let Scale = the this .mapView.scale; // set the map scale the this .mapView.scale = 5000 ; // get map scope of the let = extent the this .mapView.extent; @ map coordinates of the range of the let Xmax = extent.xmax; the let Xmin = extent.xmin; the let Ymax = extent.ymax; the let Ymin =extent.ymin; // Map Width High range (Note that this is the width and height map units, rather than the screen pixels) the let width = extent.width; the let height = extent.height; // set the map range the this .mapView.extent = new new the this .apiInstance.Extent ({ Xmin: -9,177,882 , Ymin: 4,246,761 , Xmax: -9.17672 million , Ymax: 4,247,967 , spatialReference: { WKID: 102100 } }); //Screen coordinate to a coordinate map // the PS: Type 1 is a parameter screenPoint the let mapPoint1 = the this .mapView.toMap ( new new the this .apiInstance.ScreenPoint (10, 10 )); // map coordinates turn the screen coordinate the let screenPoint1 = the this .mapView. toScreen (mapPoint1); },
Map Click event, and graphics (graphic) Click here to realize
// mapView bind click event the this .mapView.on ( "the Click", function (Event) { the this .mapView.hitTest (Event) .then ( function (the Response) { // implement graphics (graphic) click event IF ( response.results [0 ]) { // get the click graphical var graphic = response.results [0 ] .graphic; // Because of all the graphics in this event, the actual demand may need to determine which graphics graphics or graphics where which layer, can be determined by uid layers and ID the let uid = graphic.uid; // layer does not necessarily have, for example, in the graphics mapView is no IF (graphic.layer) { let layerId = graphic.layer.id; } } }.bind(this)) }.bind(this));