Fill Multiple Polygons???

948
5
04-26-2013 11:48 AM
RussellChiles
New Contributor II
I am using the url to Query multiple parcels from my parcel layer. I can successfully run the code to get the multiple parcels and zoom to their extent, but it will only highlight (esri.symbol.SimpleFillSymbol) one at a time, and I have to use the arrows on the popup to toggle back and forth between the highlighted parcels. How can I get all of the selected parcels to display with the sfs symbol at the same time?

function selectParcel(whereclause) {
        if (whereclause) {
          var query = new esri.tasks.Query();
          query.where = whereclause;
          var deferred = parcels.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function (selection) {
            var center = esri.graphicsExtent(selection).getCenter();
   var finalExtent = esri.graphicsExtent(selection).getExtent();
            var extHandler = dojo.connect(map, 'onExtentChange', function () {
              dojo.disconnect(extHandler);
              //zoom to the center then display the popup
              map.infoWindow.setFeatures(selection);
              map.infoWindow.show(center);
            });
   map.setExtent(finalExtent);
0 Kudos
5 Replies
JohnGravois
Frequent Contributor
welcome to the JavaScript forum!

you're working with a featureLayer, correct?  are you calling setSelectionSymbol() somewhere in your code?  if so, the currently selected features should be redrawn with the new symbology automatically.

check out this sample (and box select multiple features in the map) for a demonstration
0 Kudos
RussellChiles
New Contributor II
I am calling setselectionsymbol() but it will only show one highlighted parcel at a time. I have to use the Dojo popup to toggle between the selections. Here is the snippet that calls the function. sfs is the var for simple fill symbol.

[HTML]
//add the parcels layer to the map as a feature layer in selection mode we'll use this layer to query and display the selected parcels
        parcels = new esri.layers.FeatureLayer("http:// . . . . ./arcgis/rest/services/JCAD/MapServer/24", {
          outFields: ["*"],
          infoTemplate: popupTemplate,
          mode: esri.layers.FeatureLayer.MODE_SELECTION
        });

        parcels.setSelectionSymbol(sfs);
[/HTML]
0 Kudos
RussellChiles
New Contributor II
See an example here....
[ATTACH=CONFIG]23804[/ATTACH]
Here you can see the one of the two selected parcels in the lower left corner.

[ATTACH=CONFIG]23805[/ATTACH]
Once I click the arrow on the dojo popup, it then shows the second parcel in the upper right corner.

Is there a way to have both of these highlighted at the same time???
0 Kudos
JohnGravois
Frequent Contributor
what is it that causes your popup to be drawn halfway between the two parcels?  i tried changing the draw mode in the sample i linked above and it still allows you to select multiple polygons simultaneously.

if necessary, can you please post a complete sample referencing public data?
0 Kudos
LuisEspinosa
New Contributor
Hi, can you post the code when you get all the parcels selected, i need to select multiple parcels by the URL, please.
0 Kudos