Select to view content in your preferred language

Flex maptips

3044
17
06-25-2010 11:16 AM
NeoGeo
by
Frequent Contributor
My question is what are other people doing for maptips in Flex?  I ask because it seems crazy to have to compile in support for maptips for a specific layer when the layers are constantly going to be changing (at least for us).  There is the livelayerwidget but it does not support multiple symbols or polylines/polygon as far as I can tell.  So what are you guys using?

Thanks!
Tags (2)
0 Kudos
17 Replies
JacksonTrappett
Frequent Contributor
We decided to go with the InfoPopup from the flex sample viewer.  The user must click to get the maptip, so it's kind of like a cross between an identify tool and a maptip.
0 Kudos
NeoGeo
by
Frequent Contributor
We decided to go with the InfoPopup from the flex sample viewer.  The user must click to get the maptip, so it's kind of like a cross between an identify tool and a maptip.


So, correct me if I am wrong, but wouldn't that mean I have to recompile the application every time we have to add or remove maptips for a layer, and then replace the application while hundreds of people are using it?  You are talking about infopopup.mxml right?

thanks for the reply!!
0 Kudos
ZahidChaudhry
Deactivated User
So, correct me if I am wrong, but wouldn't that mean I have to recompile the application every time we have to add or remove maptips for a layer, and then replace the application while hundreds of people are using it?  You are talking about infopopup.mxml right?

thanks for the reply!!

If i understood your question right, you want to show tool tips like things...tool tips are dynamic, if you change the data, they will change too or you can make them static.
If you want mean more like Infowindow, you can set them up to and you DO NOT need to recompile everything as data is dynamic, your changes will be visible from your application.
I hope it will help

Zahid
0 Kudos
JacksonTrappett
Frequent Contributor
So, correct me if I am wrong, but wouldn't that mean I have to recompile the application every time we have to add or remove maptips for a layer, and then replace the application while hundreds of people are using it?  You are talking about infopopup.mxml right?

thanks for the reply!!


Yes, I'm talking about infopopup.mxml.  I did modify it a bit for our application, but it is an easy place to start from.
As far as recompiling to add or remove maptips, I'm not quite sure what you mean but I don't think that would be necessary.  The way we have it set up there is no need to recompile.  The map tip returns the attributes for the top layer that is turned on in the map, and shows only the fields that are turned on in the map service.  This way you can control what is in the map tip without having to make any changes in the code.  If the field names in a layer in your map service aren't friendly, you can just use aliases in ArcMap.

The way I look at it there are three parts:
1. Set up your map service so that the layers only have the fields that you want in your map tip turned on.  You can also add code to filter out fields that need to be on for the service to work but you don't want in your map tip, like OBJECTID and Shape.
2. In your flex app, when the user clicks on the map (MapMouseEvent.MAP_CLICK) add the code to do an identify.  You can write the identify code for different behaviors but we chose to return the top layer that is turned on.
3. Pass the results of the identify to the infoPopup.  You can see examples of how to do this in the search widget or any other widget that uses the infoPopup to display a tooltip.

The result looks like the attached image.
0 Kudos
CarmenDurham
Frequent Contributor
We discovered that map tips were one of those things that is an easy concept to those of use that have used ArcGIS, but not so easy in the flex world (at least for us beginners with Flex).

Here is an app we have that makes use of something like map tips.  It is a Cemetery Viewer where a person can search by name, date or plot numbers.  Once a search is made, records are returned.  Click on a record and it will zoom to where the maptips are visible.

The searched records are binoculars.  The other symbols are headstones (orange dots), family markers (headstone symbol) and unmarked graves (green).  You can hover over the symbols and the name, date of death and photo link pops up.  These are the "map tips" that are governed by the widget that is minimized (called Map Popups).  Open the widget and you can turn the maptips off for any of the layers.  The layers are in separate feature classes and one of them is an old shapefile.

(Search for last name "Furman" for example)
http://www.greenvillesc.gov/Culture/History/cemeteries/CemeteryViewer.aspx

I can't remember how our CemeteryMapTips.mxml started - either from the Search.mxml, Live Layer Widget.mxml or something else.  But it does utilize the InfoPopup.mxml (changes made in it also).  And a configurable CemeteryMapTips.xml that allows different fields to be displayed.  We had to keep the maptip simple b/c of so many points.

The code isn't pretty - it isn't cleaned up and you would have to search for the changes we made in all of the scripts and alter it to adapt to your situation. Lots of stuff hardcoded.  But I will send it if you think it will help and you provide your email address.

Carmen
0 Kudos
NeoGeo
by
Frequent Contributor
Thanks to you guys who have answered.  It sounds like Flex really doesn't have an existing solution for something as basic as maptips or tooltips or whatever they are called.  In the .NET apps I can just add a few lines of code to have a maptip for a layer and it does not require a recompile. 

I do currently have a widget similar to the cemetery one posted, which is a modified search widget.  I also have  a couple layers that don't require symbology and are small datasets where I was able to use the live layer widget. 

I guess for small datasets that are points I could add some filter and multiple symbol functionality to the livelayer widget.  I don't think I could use the top layer as a maptip strategy because we have so many layers in multiple services that I don't think I could ever guarantee that the layer needed was the top layer.  Thanks for giving me something to think about though 🙂
0 Kudos
ZahidChaudhry
Deactivated User
Thanks to you guys who have answered.  It sounds like Flex really doesn't have an existing solution for something as basic as maptips or tooltips or whatever they are called.  In the .NET apps I can just add a few lines of code to have a maptip for a layer and it does not require a recompile. 

I do currently have a widget similar to the cemetery one posted, which is a modified search widget.  I also have  a couple layers that don't require symbology and are small datasets where I was able to use the live layer widget. 

I guess for small datasets that are points I could add some filter and multiple symbol functionality to the livelayer widget.  I don't think I could use the top layer as a maptip strategy because we have so many layers in multiple services that I don't think I could ever guarantee that the layer needed was the top layer.  Thanks for giving me something to think about though 🙂

It is very simple to add tooltip to anything in FLEX. For example you have a several points in graphicsLayer and you want to add tooltop to each point, let call myPoint, all you need to do this.
[HTML]myPoint.toolTip="this is my point";[/HTML]or lets say you have a layer and you want to add tooltip to layer, youcan simply say
[HTML]myLayer.toolTip ="this is my Layer"[/HTML]

Here is very interesting blogpost:
http://blog.flexexamples.com/category/tooltip/
0 Kudos
DasaPaddock
Esri Regular Contributor
You may also be interested in this sample that uses a custom tooltip as a kind of map tip:
http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=MapTips
0 Kudos
NeoGeo
by
Frequent Contributor
Thanks guys.  Those links both look like they will be very helpful!
0 Kudos