camptocamp / c2cgeoportal

c2cgeoportal application
http://geomapfish.org
Other
64 stars 46 forks source link

Query data [mobile] #1772

Closed sbrunner closed 8 years ago

sbrunner commented 9 years ago

Questions

The querier is almost always active on the map. It is disabled when there is a draw interaction also active (draw, measure etc...). So it has to be managed via the ngeo.ToolActivateMgr.

When you click (press or long press, it is customisable) on the map, it performs a WMS getFeatureInfo query on all layers of the map (even backgroud layers). The requests are spread between WMS servers (one request per server), and a mapping is done between a WMTS layer and its associated WMS (through metadatas & external resources).

A point is drawn where the request if performed.

When all the queries get a response (or sequencially), we display the results (this is part of another issue). You just need to focus here on how to update the result data structure that will feed the UI.

Mockups and description of UI workflows

None. See #1800 for UI

External Resources

Services to be used with description of interfaces

The QueryService will need to be configured with a list of queryable layers, more specifically a list of queryable sources. In GMF, layers are not always created at the initialization of the application. They are when their according theme gets loaded. The theme contains all the information about how to query the layer: if it is queryable, the url(s) to use, etc.

In order to make the QueryService aware of those, we'll have the following: QueryServiceConfigurator - gmf. When the themes are loaded in GMF, the configurator will create one source config for each queryable layer found in the themes and add them to the QueryService.

Source configuration - example

{
    'infoFormat': 'geojson',
    'label': 'Bus Stop',
    'name': 'bus_stop',
    'layerObj': layer, // optional
    'params': {'LAYERS': 'bus_stop'}, // optional
    'serverType': 'mapserver', // optional
    'url': '' // optional
}

ngeo.QueryResult

The result will be added in an Angular value service that will have the following structure:

gmf.QueryResult = {
    'sources': [
      {
        'features': [], // Array.<ol.Feature>
        'label': 'Bus Stop',
        'name': 'bus_stop',
        'pending: false
      }
    ],
    'total': 0
  }

Criterias to launch a request

In order for a request to be launched for a particular layer, it must:

Request sending

When a request is asked to the QueryService, for each layer in the map:

  1. Find the source configuration. If found:
    • the existing features are removed
    • if the criterias are met, a request will be launched
    • sources that share the same url are combined in a single request
    • the pending property is set
  2. If not found, then the layer is not queryable I imagine to have some code in ngeo because a getFeatureInfo querier is often used. The discussion is opened, maybe we could have

    • a ngeo directive on the map that handle a type of event (customizable)
    • on event, parse all layers of the map (can have a filter)
      • build one request per server for all the layers (can create a new service for sharable methods)
      • the behavior on event can be extended (for example for WMTS layer in gmf -> specific things to do)
    • the directive active property is bound with the activateToolManager.

    The total value in gmf.QueryResponse is set to 0 as well.

    NOTE We will ignore minResolutionHint and maxResolutionHint as features should always be returned by the result of a click, even when not visible at any scale level.

Parse Response

We'll create an example with hard-coded layers in which the QueryService configs are manually created for each layer.

Example number 2 - gmf

We'll create an example in which we inject the QueryServiceConfigurator for it to automatically configure the QueryService. It will include a layertree to demonstrate the behaviour with different layers.

Configuration

What is configurable, where and by whom (user, integrator)

TODO

Implementation Examples

Existing code, interesting websites

What must be tested so one can say 'it's done', for example demo example (with checkboxes)

Documents to update: test cases, user doc, dev doc (with checkboxes)

adube commented 8 years ago

@ybolognini The query tool is now integrated in the mobile application. The results are not implemented yet, so clicking on a feature issues request(s) but nothing is shown yet.

I'll let you look at the remaining points mentioned here and determine whether this ticket should be closed or not. As for my part, it is officially all completed.