I am trying to modify the ESRI Parks Finder application to include a tooltip that shows the name of a park when you mouse hover over the icon. It is a map service. Most of the documentation I have seen shows doing this with either a feature service or graphic. In fact, there are other areas in the application that utilize tooltips but they are based on graphics not the actual symbology of the data.

Any ideas or help on how I can go about this?


Short Answer You can't do this with out of the box API/Classes.

Long Answer: A Map service, be it dynamic or tiled, is fundamentally, just an Image for your JavaScript client App in the browser. How will it know where a feature starts and ends?

The Human eye sees patterns, and can make out where a feature starts and ends. You need to program, so that JavaScript can figure out where a feature exists, so that it can show the Tooltip at the appropriate location.

This is usually done using a Feature Services, and placing the features in a graphic Layer. There are also some advances done in decreasing the overheads of Vectors in web Mapping by using UTF grid. However, I haven't seen the implementation of UTFgrid with the ArcGIS JSAPI.

So now you need to enable the recognition of features from images (i.e. from your Map Service). It is definitely possible, but not easy. I have explained how this can be done in this Answer. But making it so that you can recognize additional Attributes like Park Name, is not going to be easy, since there are potentially thousands of park names.

To Summarize, it is possible, but not trivial.


Using the map's onMouseMove event and a delay, you could query the Park REST Service with the point over which you're hovering on the map. If you get a result, you could either populate an infoWindow with the data, or roll out your own tooltip functionality.


I'm pretty sure you just need to turn your Map Service layer into a Feature Layer:

How do you create a feature layer?

Feature layers can be created by referencing a layer from either a map service or a feature service or by specifying a feature collection object.

Use a map service if you just want to retrieve geometries and attributes from the server and symbolize them yourself. (In the final release, the map service will be able to return its symbols.)

The Feature Layer should give you access to the attributes.

Here's an example, not exactly what you want, but it should put you on the right track.

featureLayer = new FeatureLayer("http://server.com/ArcGIS/rest/services/MapServer/1",
            mode: FeatureLayer.MODE_ONDEMAND,
            infoTemplate: infoTemplate,
            outFields: ["*"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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