Coordinate Issues with clicking on Map

682
0
05-08-2014 12:53 PM
ErnestoCarreras3
Occasional Contributor
I am using the JS API and binding a function to the map???s ???click??? event. The coordinates generated by the mapPoint which is part of the event arguments that is then passed to the function is not the exact point that was clicked but is off by a fixed amount and seems to change based on zoom level.
More detail on this issue: A user geocodes and address. The geocoder returns the location. I allow the user to modify the graphic point (location) obtained by the geocode output. Example, the geocode output was in the street but the user wants to place the point in its rooftop. After placing the point in the desired location, the point shifts from the original location the user used.
Below in an example of the click method:
tcfMap.on("click", function(evt) {
            var point = webMercatorUtils.webMercatorToGeographic(evt.mapPoint);
            drawPointOnMap(tcfMap, point);
            locator.locationToAddress(point, 100);
        });


The drawPointOnMap we are using:

function drawPointOnMap(map, point) {
            map.graphics.clear();

            var symbol = new SimpleMarkerSymbol()
                .setStyle("circle")
                .setColor(new Color([255, 0, 0, 0.5]));

            var graphic = new Graphic(point, symbol);
            map.graphics.add(graphic);
        }
0 Kudos
0 Replies