Zum Hauptinhalt gehen

Only Searching in the Map extent

Kommentare

16 Kommentare

  • Phil MacIntyre

    Hi Bonson,

    Thank you for your question. This is Phil MacIntyre from the Mobile team. What you're seeing is the expected behaviour. The out of the box search tool is designed to do what you're seeing in order to provide a smaller subset of data to the user, and to make searches more performant (given that they may be performed on a less powerful mobile device rather than say a beefy desktop/laptop computer). There are technically 3 different search behaviours you can expect:

    - for web map-only apps, while online, we search the visible extent. If you pan the map, you should see a button at the top of the screen saying 'Search this area' which will re-execute the search using the updated map extent

    - for map areas, we search the entire map area. As such we hide the 'Search this area' option.

    - for MMPK-backed apps, we search the defined-extent of the MMPK. We also hide the 'Search this area' option

    It is not currently possible to modify the existing default search tool to use global extent. What you could do instead however would be to either

    a. Create a Workflow making use of one or more 'Query' activities for the layers you want to search, and then pipe those results into a 'Show Results' activity, which will put the query results into the default results panel.

    b. Create a custom command using the tasks.search command, but input different arguments into it to better match your preferred search method. It would then also put the results into the default results panel.

    All of our commands and operations, and the appropriate arguments for them may be found in our Developer docs here:

    https://developers.vertigisstudio.com/docs/mobile/api-commands-operations-events/

    I hope that helps,

    Phil

    1
  • Bonson Pang

    Hi Phil,

    Thank you so much for the quick response. I'm looking into option B that you mentioned. However, I'm not too familiar with the arguments in the Developer Doc. Am I able to use them in Geocortex Workflow? I noticed that tasks.search is using =$getWorkflowInputs.inputs.context as the parameter (see below image). I'm wondering if it is possible for me to change the extent values in =$getWorkflowInputs.inputs.context (=$getWorkflowInputs.inputs.context.SearchArea.Extent.XMin, =$getWorkflowInputs.inputs.context.SearchArea.Extent.YMin, =$getWorkflowInputs.inputs.context.SearchArea.Extent.XMax, =$getWorkflowInputs.inputs.context.SearchArea.Extent.YMax), so that tasks.search will perform the search using the extent I set? If so, which tool can I use the change the value?

     

    Thank you,

    Bonson

     

    0
  • Phil MacIntyre

    Hi Bonson,

    You're right on the money. Mobile commands and operations can either be invoked via the Create Custom Command tool in Mobile App Designer, or, if you'd like to integrate other Workflow tools, then you can execute them via the Run Command or Run Operation activities and pass in arguments as you've shown in your screenshot. In the Workflow case, you'd want to run that operation to get your search as desired, as well as a 'Run Command' activity which uses the 'results.display' command. This will take the results from your search operation and pipe them into the Results List component in your app. Like this:


    For the tasks.search operation, you need to supply a few arguments for it to work, like this:

    The maps property will let the operation know to target your current map (you can get this value with a Get Map activity). The maxResults property will let you specify how many results you'd like. The outSpatialReference property should match your web map unless you want to reproject (you can define this yourself or harvest it from a Get Map or Set Map Extent activity). searchArea is the property that will specify the area you want to search (you could define this yourself via say a 'Get Geometry from JSON' activity', or use a display form with a geometry picker). searchText will be the search term you want to look for (this could be easily supplied by the user via a Display Form).

    For the results.display activity, you can simply pass the results from the tasks.search as it's command parameter:

     

    There are endless different ways to configure your Workflows, but with those basic building blocks you should be able to design a search tool replacement that's more suitable for your needs. It might not be a true "global" search, but by redefining the geometry you pass through, you can cover the area/s containing all your data.

    Hope that helps!

    Phil

    0
  • Bonson Pang

    Hi Phil,

    Thank you for your reply, it really helps. However, I'm still not able to get the search tool to search in a global extent. Here are the arguments I have used for tasks.search and their results:

    1.  

    ={
    Maps:$map1.map.mapExt,
    MaxResults:50,
    outSpatialReference:$setMapExtent1.oldExtent.spatialReference,
    SearchArea:$geometry1.geometry,
    SearchText:$form1.state.textBox1.value,
    }

    In the 'Get Geometry From JSON' activity, I copied the JSON from a REST endpoint of a basemap that covers all the features I have on the map. However, it seems like this is not the proper way to get the JSON as it gave me an error about the geometry.

    1.  

    ={
    Maps:$map1.map.mapExt,
    MaxResults:50,
    outSpatialReference:$setMapExtent1.oldExtent.spatialReference,
    SearchArea:$geometryExtent1.extent,
    SearchText:$form1.state.textBox1.value,
    }

    Instead of using JSON, I used the REST endpoint of a boundary and ran the 'Query Layer' activity to get the feature, then used 'Get Feature Geometry' -> 'Get Geometry Extent' to get $geometryExtent1.extent. However, the extent cannot be used as it didn't return any search results.

    1.  

    ={
    Maps:$map1.map.mapExt,
    MaxResults:50,
    outSpatialReference:$setMapExtent1.oldExtent.spatialReference,
    SearchArea:$projectGeometry1.geometry,
    SearchText:$form1.state.textBox1.value,
    }

    I created an input argument called 'layername' at the MobileViewer level. The 'layername' is a boundary that should cover all the features. Then, I used 'Get Layer' -> 'Project Geometry' to get the layer's geometry as $projectGeometry1.geometry. It did give me search results. However, it is still only searching for features within the map extent instead of the extent of the boundary I provided.

    Wondering how I should have done the testings differently or if there are any methods that I havent tried yet to get the map extent that would work with task.search to search within the "global" extent.

    Thank you,

    Bonson

    0
  • Phil MacIntyre

    Hi Bonson,

    Workflow can certainly be a little daunting, and making use of commands can be doubly tricky. I've generally found that I just kind of muddle through until I find a way, and then slowly but steadily build up a library of existing Workflows that I can borrow from for future efforts. A really helpful technique to save some trial and error is to make use of the Workflow debugger/inspector that we've built into the Mobile log viewer. Simply:

    1. Use the Settings panel to increase the log level to debug

    2. Run your Workflow

    3. Open the log viewer (can be found at the bottom of the Settings tab, or by pressing F12 on Windows)

    4. Look for the activity that you're struggling with. You'll always see 2 copies of each activity in the Workflow: the first is for the activity being called (so it'll just have inputs), and the second when the activity runs to completion (which will have inputs and outputs).

    The great thing about the Workflow inspector is that it shows all of the inputs and outputs, along with what type of object they are, in a collapsible viewer. So for example, I've got a simple Get Layer activity that I'm running against a test polygon layer I have, and by inspecting the second copy in the debugger, I can see:

    So that could be a helpful tool for you down the road as you continue to hone your Workflow skills.

    That said, it can be tricky to know exactly type of object you need to feed into a particular activity. The Workflow docs are helpful, though do keep in mind that they're referencing the Javascript/Typescript API, whereas Mobile uses the .NET API, so things will be different, but it can be helpful to start. For example, with the Get Map Extent activity when I look at its outputs, I can click the Esri link to see what sort of object it is. This also shows up in the tool tips in Workflow Designer itself. From there, you can do some trial and error to suss out what sort of object you need to feed in.

    For that 'Get Geometry from JSON' approach that I mentioned, you could simply define the geometry itself as a polygon, and that should specify the search area directly. Something like this for example

    In this case, we're defining some UTM coordinates near our Victoria, Canada office, and confirming the spatial reference. You could try that out with your target zone and see if that's what you're looking for.

    Hope that helps,

    Phil

    2
  • Bonson Pang

    Hi Phil,

     

    Thank you so much for the tips and your feedback on 'Get Geometry from JSON' activity. Its working now.

     

    Thanks,

     

    Bonson

    1
  • Phil MacIntyre

    Hi Bonson,

    That's great! I'm glad to hear we were able to get you unstuck.

    All the best,

    Phil

    0
  • Max Molello

    Just wanted to add my 2 cents to this. Having a global, or even better a per layer, toggle for search outside extent would be a great addition. There are many many reasons people are searching for something outside the current extent, and since they don't know where that thing is they have to zoom all the way out and search everything anyways. So, there is no performance improvment and just an extra step to search. My users would gladly take the extra search time in order to be able to skip the step of zooming to the full extent each time. 

    0
  • Max Molello

    Already have, like most things in the ideas thread there is minimal votes or responses. https://support.vertigis.com/hc/en-us/community/posts/11497804675986-Search-entire-datasets-not-just-what-is-on-screen

    0
  • Phil MacIntyre

    Thanks Max and Nico. We appreciate hearing feedback from our users on how we can improve our product. This seems like a logical way to expand on the existing functionality, so I've created a story in our backlog that would make this an option. App authors who like the current map extent search model can continue to use it, but those who want a global extent will be able to enable that instead. We'll look to get this into an upcoming release, and will be sure to post here to let you know it's coming.

    Thanks again, and have a great day,

    Phil

    0
  • Max Molello

    Thanks Phil, that would be a great improvement. A full global search would make people happy, but if you wanted to still try and keep it performant maybe global search options per layer, or allowing a custom extent to be set to search in, or base that extent on the default extent of the webmap the app uses? That way at least you are searching the map area and not all data in a layer that may span outside the map area. 

    0
  • Phil MacIntyre

    Those are also great ideas for future improvements, a bit more selectivity in the configuration. I'll be sure to include these in our discussions around this work. Thanks again!

    0
  • Bonson Pang

    Hi Phil,

    I'm not sure if this should be included in the same post, but we have encountered an issue related to only searching in the map extent. We have noticed that the search tool and search suggestions only work for addresses within the map extent. When we try to search for addresses outside of the map extent, no search suggestions or search results are provided.

     

    I have examined the Workflow inspector, but it doesn't show me the inputs and outputs. Based on what I see in the inspector, I assume the relevant activities would be 'geocode.suggest', 'offline.check-for-active-area', or 'geocode.geocode'.

    Is there any way to modify these activities to enable searching for addresses outside of the map extent?

    Thank you,

    Bonson

    0
  • Phil MacIntyre

    Hi Bonson,

    Both feature and address search are subject to the same limitations with the out of the box tool that I described before in this post. You should be able to create your own customized alternative by making use of the 'geocode.geocode' operation. It, along with the corresponding arguments, can be found in the Developer Center docs. The property to control what area the address search is performed against is nested under 'options':

    There is also the 'Geocode' activity in Workflow itself that you could work with. The Workflow inspector tool only really works for Workflows, not so much for commands and operations, though if you feed a command or operation into a 'Run Command' or 'Run Operation' activity, you'll be able to use the inspector on those which may provide some guidance.

    Hope that helps,

    Phil

    0
  • Mike Diss-Torrance

    Is it possible to exclude the map extent from the search, and just base it on where-clause?

    Compare the performance of these 2 queries:

    1. Query: Wells (ID: 0) (wi.gov) - Just the ‘where clause’.
    2. Query: Wells (ID: 0) (wi.gov) - ‘Where clause’ and map extent

    The performance is horrible because while it is only returning 2 records, it's running a geometry intersection operation of all 900,000 wells across the entire state of Wisconsin. 

    I tried to alter the SearchArgs by setting the searchArea to undefined, but that didn't make any difference. 

    Commands, Operations and Events Reference | VertiGIS Studio Developer Center

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.