1. Background
When we use ArcMap, we often use tools called I queries. The specific function is that when the I query function is activated, the mouse click on a feature, the interface will pop up a dialog box to display the features of each property information. The function is as follows:
2. Principle
Before we design and implement this function in Webgis, it is necessary to understand the principle of this function.
An interface is defined in the OGC WMS Standard: Getfeatureinfo. The function of the interface is to obtain information about the features in the screen coordinates according to the screen coordinates, the current view extent, and other parameters.
An interface is also specified in the OGC WFS standard: Getfeature. The interface also provides the ability to obtain a data document that conforms to the GML specification.
For different geographic servers, we chose the above two different interfaces to implement.
Here I briefly describe how to use WMS's Getfeatureinfo interface for I queries in AGS, GeoServer, and Supermap.
I query in 2.1AGS
In AGS we chose WMS's Getfeatureinfo interface to implement. It itself provides an I query interface, as follows:
The specific rest request format is as follows:
I query in 2.2GeoServer
In GeoServer we chose to use the getfeatrue in the WFS.
In the query, it is important to note that the filter is written. Here is a sample example:
I query in 2.3Supermap
The feature's scope query interface is available in the Hyper-map WFS service, as follows:
The specific Rest service request format is:
3. Design Ideas
Here I give a direct flow chart:
4. Optimized design 4.1 display results configurable
When we query all the results through a geographic server, there may be some results that we don't want. Like what:
A. A layer contains many fields, and we want to show just a few of them.
B. The layer fields are English or professional terms, and we want to change the name.
Here we need to design a table in our database that relates to the query presentation, which contains information such as the layer number, the Layer field original name, the Layer field display alias, the field presentation order, the field type, and so on.
In this way, our process can be adjusted slightly to change to:
4.2 Optimization of attribute data and spatial data presentation
The attribute data and spatial data are logically correlated in the returned result set. When clicking on the relevant attribute data, the feature corresponding to the attribute data is displayed on the map.
Effects such as I query in ArcMap.
5. Effect display
6. Summary
I query is a very important function in Webgis, how to make it have a better display effect and extensibility is also the benevolent see of the beholder. In the next chapter, I'll talk to you about the design and implementation of the layer tree in Webgis, and you are welcome to continue.
--Welcome reprint, but retain the copyright, please indicate the source in obvious place: http://www.cnblogs.com/naaoveGIS/
(18) The principle and design of I query in Webgis (including AGS, GeoServer, Supermap)