Skip to main content

Results highlighted by default

Comments

30 comments

  • Permanently deleted user

    Zorba - did you ever figure this out?

    I am looking for the same thing...

    0
  • Permanently deleted user

    Nope. I was hoping for some response from the forum. I have not pursued it beyond this post though.

    0
  • Permanently deleted user

    Zorba, Paul

    I have attached a simple workflow (http://data.latitudegeo.com/community/search_highlight.zip) here  to demonstrate how it can be done in the HTML5 viewer. It's quite bare-bones but it will get you started - you might want to customize it with a "capture geometry" activity to let users click on the map and use that location for your spatial searches. Here's how the highlighted results look like:

    /customer/servlet/servlet.FileDownload?file=00P6000000em1aPEAQ

    Hope this helps,

    --Alejandro

    0
  • Permanently deleted user

    Hi Alejandro,

    Thanks for the reply. I dont think this is quite what I'm looking for though. This example shows how to highlight a featureset which has been created via a query task. I'm interested in highlighting features returned via the identify or global search tools. In that case you dont have a query task or a featureset object which you can access, unless I'm missing something. Also, it would have to be event driven, rather than a workflow which the user initiates.

    Any thoughts on that?

    0
  • Permanently deleted user

    what about something like this...just listen to when the collection closes, which I thing means the collection is complete.  I'm pretty sure the collection gets filled from a search, workflow, identify, etc.

    not tested, and you'd need to clear out the hightlights first.  might give you some ideas at least?

     

                    viewer.eventRegistry.event("SiteInitializedEvent").subscribe(this, function (site) {

     

                        this.app.eventRegistry.event("FSMCollectionClosedEvent").subscribe(this, function (args) {

     

                            if (args.featureSetCollection) {

     

                                dojo.forEach(args.featureSetCollection.featureSets.get(), function (featureSet) {

     

                                    this.app.commandRegistry.command("HighlightFeatureSet").execute(featureSet);

     

                                }, this);

     

                            }

     

                        });

     

                    });

     

     

    0
  • Permanently deleted user

    Thanks for the suggestion Colin. I have not delved into the api, but this looks like a useful start. One question: the collection created when you search or identify is called FSMCollection? Is that right?

    0
  • Permanently deleted user

    Zorba,

    Did you ever come up with a solution for highlighting features using the identify tool?  I am also trying to find a solution for this.

    Thanks, Barbara

    0
  • Permanently deleted user

    No, just have not had a chance to pursue this yet. Good luck.

    0
  • Permanently deleted user

    "when you search or identify is called FSMCollection? Is that right?"

    Yeah, that is what is used when trapping the events: they all seem to be FSMCollection then the action

    I just stuck this code in an out of the box viewer in Index.html.  Put it after this chunk:

     

                    var viewer = new geocortex.essentialsHtmlViewer.ViewerApplication(viewerConfig.viewerConfigUri, null, viewerId);

     

                    viewer.shellName = shellName;

     

                    viewer.viewerConfigPath = viewerConfigPath;

     

                    viewer.isOffline.set(isOffline);

     

                    viewer.debugMode = (urlParams["debug"] != null && urlParams["debug"] != "false");

     

                    viewer.urlParameters = urlParams;

     

     

    --> paste this stuff

     

                    viewer.eventRegistry.event("FSMCollectionClosedEvent").subscribe(this, function (args) {

     

                        if (args.featureSetCollection) {

     

                            dojo.forEach(args.featureSetCollection.featureSets.get(), function (featureSet) {

     

                               viewer.commandRegistry.command("HighlightFeatureSet").execute(featureSet);

     

                            }, this);

     

                        }

     

                    });

     

     

    It highlights all the records when I do an identify

    0
  • Permanently deleted user

    sorry, missed a line to clear out highlights from previous highlighting

     

     

                    viewer.eventRegistry.event("FSMCollectionClosedEvent").subscribe(this, function (args) {

     

                        if (args.featureSetCollection) {

     

                            viewer.commandRegistry.command("ClearHighlights").execute();

     

                            dojo.forEach(args.featureSetCollection.featureSets.get(), function (featureSet) {

     

                               viewer.commandRegistry.command("HighlightFeatureSet").execute(featureSet);

     

                            }, this);

     

                        }

     

                    });

     

    anyways, not sure if this helps

    0
  • Permanently deleted user

    Brilliant! Finally had a chance to try this and it works perfect. Any identify or search features are highlighted on map with default highlight symbol.

    Thanks Colin.

    0
  • Permanently deleted user

    This is great!

    Thanks Colin.

    0
  • Permanently deleted user
    Version 2.5.1 of the html5 viewer is organized differently. Most of the javascript is removed from the index.html file into separate js files. I'm looking into how to implement this behavior with this new organization, but its kind of hard to figure out. There is a js file loaded: <script src="Resources/Compiled/loader.js"></script> but the loader.js file is compiled and no easy way to understand what it's doing. Anyone figured this out? Thanks.
    0
  • Permanently deleted user
    I'm having an issue with this solution also highlighting markups from the measure tool.   Is there a way to restrict the highlighting to non-markup layers.  Thanks
    0
  • Permanently deleted user
    We would also like to implement this directly from a Global Search or Identify without having to use a Workflow. Has anyone worked this out using the current viewer version for HTML5?
    0
  • Permanently deleted user
    To add to my comment above, ie., I would like to be able to choose which of my layers is the default layer to highlight on map click using Identify, without having to go to the results list and click on a result to get the highlight. For example, if the Identify on map click produces 14 results, and each time you get a parcel polygon as a result, I automatically want the parcel polygon to highlight, before any clicks in the result list.
    0
  • Permanently deleted user
    Christina,

     

    The javascript code that we used with an older version of the viewer did not meet your requirement. It was all or nothing, meaning all results are highlighted. That said, it could likely be modified to do what you want. Just need some pointers on how to implement this with new version of the viewer.
    0
  • Permanently deleted user
    I would like to implement this as well, but I am not sure where to add the suggested code. I cannot find the block of code that Colin suggest to add his code after. Can someone point me to which file/script to edit? Thanks
    0
  • Permanently deleted user
    Using the Geocortex Essentials 4.4.0 and HTML5 2.5. There are the Workflow and LACounty sample sites in the package. I believe that is the things we are looking for. The active/visible layres are highlighted when mouse click on the map. However, I've no idea how to make it work by comparing the Desktop.Json.js and Manager setting between my site and sample site. 

     

    Any instruction or documentation to enable the action ? It will be a greate help. 
    0
  • Permanently deleted user
    Updated... You need to turn on the MapTip check box on the layers. Then, it's wokring. 
    0
  • Permanently deleted user
    Has anyone figured out how to do this with the Geocortex Essentials 4.4.x and HTML5 2.5? I am specifically looking for a highlight when using the identify tool. It will highlight the selected area when I simply click on the map (without the identify tool selected), but not when I use the identify tool.
    0
  • Frank Martin
    I'd be interested in knowing how this works as well. 
    0
  • Jeff Ashton
    Great answer Colin however I didn't like it highlighting the features when I was measuring. I altered your code slightly to stop this from happening.

     

                    viewer.eventRegistry.event("FSMCollectionClosedEvent").subscribe(this, function (args) {

     

                        if (args.featureSetCollection) {

     

                           if(args.featureSetCollection.id != "Measurement"){

     

                                viewer.commandRegistry.command("ClearHighlights").execute();

     

                                dojo.forEach(args.featureSetCollection.featureSets.get(), function (featureSet) {

     

                                    viewer.commandRegistry.command("HighlightFeatureSet").execute(featureSet);

     

                                 }, this);

     

                             }

     

                         }

     

                    });

     

    Thanks.
    0
  • Allison Charko
    I'm not able to get this code to work. I am on Essentials 4.0.0, HTML Viewer 2.0.

     

    I added the code to the viewer's index.html but nothing happened. 

     

    Any ideas?
    0
  • Permanently deleted user
    Jeff what file did you add this code to?  I'm using Viewer 2.6.1.
    0
  • Lauren MacLean
    Krystal, this code doesn't work in any of the more recent versions. supposedly they are fixing it soon so that you can choose pushpins or highlight by default, but we were told it would be in hte latest release and it is not.
    0
  • Permanently deleted user
    Hi Krystal, Sorry for the late reply but hopefully this can help you and others. Here is how Jeff and I have dealt with the highlighting issue. We have made it so that all the features are highlighted by default and if you click on a feature it shows in a different color. In the script area of index.html under the var viewerConfig add the following:

     

     

     

      function notifyLoaded(){this.onInitialized= function (viewer) {

     

        viewer.eventRegistry.event("FSMCollectionClosedEvent").subscribe(this, function (args) {

     

                        if (args.featureSetCollection) {

     

          console.log(args.featureSetCollection);

     

          if(args.featureSetCollection.id != "Measurement"){

     

           viewer.commandRegistry.command("ClearHighlights").execute();

     

           viewer.commandRegistry.command("RemoveHighlightLayer").execute("CustomHighlight");

     

           dojo.forEach(args.featureSetCollection.featureSets.get(), function (featureSet) {

     

              viewer.commandRegistry.command("HighlightFeatureSet").execute(featureSet);

     

           }, this);

     

          }

     

                        }

     

                    });

     

        

     

        viewer.event("ResultsListFeatureClickedEvent").subscribe(this, function (Feature) {

     

         console.log(Feature);

     

         // This will create a highlight layer and highlight the click feature

     

         viewer.commandRegistry.command("RemoveHighlightLayer").execute("CustomHighlight");

     

         viewer.commandRegistry.command("CreateHighlightLayer").execute("CustomHighlight");

     

         viewer.commandRegistry.command("SetHighlightBorderColor").execute("#FF4286f4");

     

         viewer.commandRegistry.command("SetHighlightFillColor").execute("#994286f4");

     

         viewer.commandRegistry.command("SetActiveHighlightLayer").execute("CustomHighlight");

     

         viewer.commandRegistry.command("HighlightFeature").execute(Feature);

     

         viewer.commandRegistry.command("SetHighlightBorderColor").execute("#FFFF0000");

     

         viewer.commandRegistry.command("SetHighlightFillColor").execute("#33FF0000");

     

         viewer.commandRegistry.command("SetActiveHighlightLayerDefault").execute();

     

        });

     

     

     

        viewer.event("ResultsTableFeatureClickedEvent").subscribe(this, function (Feature) {

     

         console.log(Feature);

     

         // This will create a highlight layer and highlight the click feature

     

         viewer.commandRegistry.command("RemoveHighlightLayer").execute("CustomHighlight");

     

         viewer.commandRegistry.command("CreateHighlightLayer").execute("CustomHighlight");

     

         viewer.commandRegistry.command("SetHighlightBorderColor").execute("#FF4286f4");

     

         viewer.commandRegistry.command("SetHighlightFillColor").execute("#994286f4");

     

         viewer.commandRegistry.command("SetActiveHighlightLayer").execute("CustomHighlight");

     

         viewer.commandRegistry.command("HighlightFeature").execute(Feature);

     

         viewer.commandRegistry.command("SetHighlightBorderColor").execute("#FFFF0000");

     

         viewer.commandRegistry.command("SetHighlightFillColor").execute("#33FF0000");

     

         viewer.commandRegistry.command("SetActiveHighlightLayerDefault").execute();

     

        });

     

       

     

       }

     

      }

     

     

     

      new geocortex.essentialsHtmlViewer.ViewerLoader().loadAndInitialize(new notifyLoaded());

     

    Note: The last line should replace the same line that alreay exists in the index.html. Also, the hightlight colors will need to be set to your default highlight colors. These are found in the Desktop.json.js under you site config. Look for the module name "Highlight". Unfortunately this example is only for the default highlight colour. You could customise it further for individual layers though by adding in a if statement for individual layers eg. if (Feature.layer.name == "Parcels") { //Change collor} else {//Default Color}.  If you want this to work on mobiles just copy the subscribe event for the ResultsListFeatureClickedEvent and the ResultsTableFeatureClickedEvent and change the event to ResultsListFeaturePressedEvent and ResultsTableFeaturePressedEvent.

     

    That should about cover it but if not let me know. Cheers, Bryan
    0
  • Lauren MacLean
    This is absolutely fantastic Brian thank you!!! works like a charm. We like our initial selection to persist while the user looks at individual feature details, was easily able to tweak your code to do that too

     

    Only thing I've got trouble with is getting it to clear when the user closes the results. I tried using the FSMCollectionRemovedEvent but apparently that's only called once the user hits our custom 'clear results, clear selection' tool. It'll do for now but if you have any hints on that I'd be really grateful. Thanks again!
    0
  • Permanently deleted user
    Hi Lauren,

     

    Sorry I forgot about that. There's a ResultsViewClosedEvent and when that is fired you clear the highlights. eg.

     

        viewer.event("ResultsViewClosedEvent").subscribe(this, function (View) {

     

         console.log(View);

     

         viewer.commandRegistry.command("RemoveHighlightLayer").execute("CustomHighlight");

     

         viewer.commandRegistry.command("ClearHighlights").execute();

     

        });
    0
  • Belinda Kerr
    Hi,

     

    I am trying to get the results of my instant search to highlight automatically. I have added the code to my index.html and confirmed it works with the identify and resultsfeatureclicked event but it refuses to work for the instant search results. When I look at the developer tools in google, it finds the 'SearchResultsCollection' but doesnt highlight the results. The only indicator to a possible cause is a warning message saying "Warning: Could not create menu view from DOM element attributes. Menu Id: ResultsListActions not registered with the MenuRegistry." Any ideas on what else to check or what might be stopping it from working? Any help would be greatly appreciated! Thank you

     

    _img_ alt="Warning Message" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=90760000000GrVW&feoid=Body&refid=0EM60000000Ujfh" _/_img_
    0

Please sign in to leave a comment.