Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would you go about "selecting/hightlighting a feature" in the map control when a user clicks on a point in the map - all via ADF Javascript. I know it can be done server side with a selection graphics layer etc, just wondering if it can be done client side.


share|improve this question
up vote 2 down vote accepted

Below I have put the code that I have used to display a black crosshair over a point feature in a map. It was quite simple in the end, but the overall implementation is a bit more involved and beyond the scope of this answer - but in essence -

  1. The user clicks on the map and I capture the coordinates.
  2. Coordinates are sent to webservice by XmlHttpRequest and a spatial filter is conducted.
  3. XML recieved from webservice after a successful spatial filter with results is found.
  4. The REAL x and y coordinates are passed back too from the spatial filter.
  5. These real x and y coordinates are used to place the graphic on the map - so it will only show if a successful query has been made - if not the graphic will never show - which is pretty much an emulation of the a select funcitonality.

    //you must use a unique ID each time you create a graphic
    //this is incremented at the end of the drawGraphic function.
    var graphicCount = 0; 
    var newPoint = new ESRI.ADF.Geometries.Point(456465, 354141);

    function drawGraphic(point) {
        //I am using a png graphic file here to mark a point in a kind of crosshair
        //24x24 pixels big and it looks pretty cool - make sure you have the background
        //transparent or else you won't be able to see underneath the graphic.

        var symbol = new ESRI.ADF.Graphics.MarkerSymbol("blacktarget.png", 12, 12, "");
        var coords = point.toString("<br>", ",");
        var attributes = { "ID": graphicCount, "featureCoordinates": coords };

        graphicFeature = $create(ESRI.ADF.Graphics.GraphicFeature, { "id": graphicCount.toString(), "geometry": point, "symbol": symbol, "attributes": attributes});
share|improve this answer

As far as I understand your question, client is not aware of points, so there has to be a server interaction to achieve this.

share|improve this answer
sorry - had to mark this down as it strictly isn't true. Nothing personal of course... – Vidar Aug 11 '10 at 16:31
I must have expressed my self rather poorly as your example above does exactly what I wanted to express. As the client is not aware of points, it has to ask the server whether there is a point where the user clicked (hint: the XmlhttpRequest). This is the server interaction I was referring too. So I don't have any issue marking my answer down for being too high level, inaccurate or such, but my any means it is not wrong. – GuillaumeC Aug 12 '10 at 6:34
I agree - the client is not literally aware of points as it is just an image - so this has to be inferred by the server and passed back to the client. – Vidar Aug 12 '10 at 8:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.