mliebster

Adding a point & change extent = "Arg: Illegal input string in Vector2D"

Discussion created by mliebster on Jan 17, 2011
Latest reply on Jun 5, 2012 by jan86
I have map displayed on my page. I have js function that adds another point and moves the extent.

If I do either action independently, it works just fine. But if I add a point and change the extent in the same method:
- the point doesn't show
- when I drag the mouse, I get the "Arg: Illegal input string in Vector2D" error.

I've made sure to use the same spatialReference throughout, as that's the only thing researching the error yields (projection issues).

The code (1) clears existing points, (2) adds the new point (using the map's spatialReference), (3) adds to the existing graphics layer, (4) and then centers the map around the new point.

function moveHomePoint(lon, lat) {
    homeLayer.clear();
    homePT = new esri.geometry.Point(lon, lat, homeMap.spatialReference);
    var homeG = new esri.Graphic(homePT, hSms, attr, infoTemplate);
    homeLayer.add(homeG);

    var homeExtent = new esri.geometry.Extent(
    {
        "ymin": lat - 0.0025,
        "xmin": lon - 0.0025,
        "ymax": lat + 0.0025,
        "xmax": lon + 0.0025,
        "spatialReference": { "wkid": 4326 }
    });
    homeMap.setExtent(homeExtent);
}


Again if I comment out the layer.add line, the extent is set fine. If I comment out the setExtent line, the point shows up - though I have to zoom/pan to get to it if it's not in the current extent.

I've tried to add the point with a JSON type spatialReference as well, with the same result.



Thanks in advance for any help!

Outcomes