Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using an ArcGIS.com Webmap in an ESRI Javascript API application I am developing. One of the layers in my Webmap is rather large and cannot be rendered all at once when zoomed out, however I would like to avoid showing holes in the data on screen when data does actually exist there.

I have seen samples and demos before where it is possible to use a tiled map service to cover the entire large area without rendering all the individual features, but still be able to show an InfoWindow when the map is clicked. I am assuming this would be done using a FeatureLayer with its mode set to SELECTION and the onClick handler for the map would query the FeatureLayer based on where the map was clicked, then the selected features would appear on the map and the InfoWindow could be visible.

I have not seen where it is possible to set the mode of a FeatureLayer that is provided via an ArcGIS.com Webmap. If I simply create a new FeatureLayer in my application that points to the Hosted Feature Service on ArcGIS.com, then I lose all of the configuration (symbology, popup, etc.) that I have done when publishing the Webmap.

Is what I have described above possible? If not, is there another way to render a large number of features on the map and still have access to attribute information?

share|improve this question
    
I am not sure regarding first part of your question but yes if you want to display large number of features with an attribute information. You can try mouse hover option please check following link ( I have tried and its working fine for me) resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/… –  Sunil Apr 22 '13 at 17:12
    
@Sunil - this is similar to what I am trying to accomplish however this example uses a regular FeatureLayer and not a FeatureLayer provided by an ArcGIS.com Webmap. The Webmap doesn't seem to provide all the options that a FeatureLayer constructor does. –  Brian Apr 22 '13 at 17:19

1 Answer 1

The webmap returns a featureLayer already instantiated. I haven't tried changing the mode to instantiate a featureLayer with mode selection, but it makes sense that you lose symbology and popups because you set those when instantiating.

Solution: I have queried (queryTask) against the featureLayer url based on user drawn polygon (or user click, hover, etc), and then set the features (polygons) returned from the query to an outline of aqua blue, and then added them to the graphic layer -- so it looks like they are selected.

Meanwhile, I'm displaying the featureLayer from the web map underneath that shows the symbology, popups, etc that were configured in the webmap. Of course, you could achieve the same effect with a tile cache and you wouldn't be limited by the 1000 record max limit -- that may be better for you. I turned the visible scale to only show close in for the webmap.

Here's a sample -- (adapted and untested)

//goes inside your your onclick function here
if (geom !== null) {
    var query = new esri.tasks.Query(),
        queryTask = new esri.tasks.QueryTask(params.parcelServiceName); //featureLayer url
    query.geometry = geom;
    query.returnGeometry = true;
    query.outFields = ["*"];
    queryTask.execute(query, function (results) {
        highlightPolygons(results);
    }, function (error) {
        //vgis.app.jQueryUIAlert(vgis.config.APP_STRINGS.ERROR_CONDITION);
    });
}
else {
    //vgis.app.jQueryUIAlert(vgis.config.CUSTOM_STRINGS.PARCEL_NO_RESULTS);
}

//function to add aqua highlighting outline
function highlightPolygons(results) {
    var geom,
        graphic,
        symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
            new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 255, 255, 1.0]), 2),
            new dojo.Color([255, 255, 25, 0.0]));
    map.graphics.clear();
    dojo.forEach(results.features, function (key, value) {
        geom = value.geometry;
        graphic = new esri.Graphic(geom, symbol);
        map.add(graphic);
    });
}
share|improve this answer

Your Answer

 
discard

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.