jsn

Map: Geometry (wkid: 102658) cannot be converted to spatial reference of the map (wki

Discussion created by jsn on May 13, 2014
Latest reply on May 13, 2014 by jsn
Hi all

when I try to add a grpahic to my map I get the following error message:

function showResults(results) {
    //symbology for graphics
    var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color([0, 255, 0, 0.25]));
    var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 1);
    var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NONE, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.25]));

    //find results return an array of findResult.

    if (map.graphics) {
        map.graphics.clear();
    }
//    var dataForGrid = [];
    var g;
    //Build an array of attribute information and add each found graphic to the map
    dojo.forEach(results, function (result) {
        var graphic = result.feature;
        // dataForGrid.push([result.layerName, result.foundFieldName, result.value]);
        switch (graphic.geometry.type) {
            case "point":
                graphic.setSymbol(markerSymbol);
                break;
            case "polyline":
                graphic.setSymbol(lineSymbol);
                break;
            case "polygon":
                graphic.setSymbol(polygonSymbol);
                break;
        }

        g = graphic;

       

        var zoom2 = 0.08;
        map.centerAndZoom(g.geometry, zoom2);


        map.graphics.add(g);

    });


}

Outcomes