BrianBunker / cmv-widgets

Widgets based on the Esri jsapi, configured for the Configurable Map Viewer. Widgets include Drag and Drop, Goto, Map Navigation Hash, and Nearby.
https://brianbunker.github.com/cmv-widgets
MIT License
18 stars 24 forks source link

Map: Geometry (wkid: 4326) cannot be converted to spatial reference of the map (wkid: 2932) #51

Open mayur9785 opened 5 years ago

mayur9785 commented 5 years ago

Hi @BrianBunker @tmcgee @roemhildtg,

I am getting the Spatial reference error in Goto Coordinate widget.

Map: Geometry (wkid: 4326) cannot be converted to spatial reference of the map (wkid: 2932)

below is my map options in viewer.js file

mapOptions: {
            navigationMode: 'classic',
            zoom: 10,
            sliderStyle: 'small',
            showLabels: true,
            extent: new Extent({
                xmax: 230766.87022996417,
                xmin: 230423.22107394566,
                ymax: 392078.99689069286,
                ymin: 391844.8197423016,
                spatialReference: {
                        wkid: 2932
                }
            })
        }

goto

The error in Goto.js file at gotoCoordinate function this.map.centerAt(latlongCoord); The map is not Zoomin to the location and no marker pin added on map.

This is what I tried to do in _setGraphicCoordinateAttr method but it did not work :

if (coordinate) {
                var point = new Point(coordinate, new SpatialReference({
                    wkid: 4326
                }));
                debugger;
                // start project parameters
                var projectParams = new ProjectParameters();
                projectParams.geometries = [point];
                projectParams.outSR = new SpatialReference(2932); //{ wkid: 3857 }; //4326;//this.map.spatialReference;
                //projectParams.transformation = {
                //    wkid: 2932
                //};
                //projectParams.transformationForward = true;
                var defer = esri.config.defaults.geometryService.project(projectParams).then(lang.hitch(this, function (projectedGeometry) {
                    debugger;
                    if (projectedGeometry.length > 0) {
                        this.graphic.setGeometry(projectedGeometry[0]);
                        this.graphic.show();
                    }
                }));
                this.graphic.setGeometry(point);
                this.graphic.show();
            }

Thanks,