1. Preface
In the seventh chapter we know that the essence of the elements in Webgis is uicomponent, and the vector layer is essentially a canvas containing n (n>=0) uicomponent. In UIComponent's graphics, we draw a vector shape (shape) from the vector data and assign the vector Data's properties (attributes) to the uicomponent.
Before we proceed with the design of feature and vector layers, it is necessary to understand these four questions
(1) What is vector data?
(2) Where does the vector data come from?
(3) How are vector data organized?
(4) How does the vector data be used?
In this chapter, I will focus on questions 1th, 2 and 3, and the fourth question involves some algorithmic knowledge, which we will cover in the next chapter.
2. The nature of vector data
The biggest difference between vector data and general data is that vector data contains spatial (geometry) information. We know that the element is composed of an ordered spatial coordinate, and this spatial information contains the sequence coordinates. If geometry is empty, it means that this feature does not exist. At the same time, vector data contains all the information of general data, i.e. attribute data. However, the attribute data is not necessary, as long as the geometry information exists, the attributes information is not, the elements also exist.
3. Source of vector data
I have divided the source of the vector data into two types:
(1) Not back to the table request obtained.
This data is already present in the foreground code, or passed in through parameters by a third-party caller when invoking our system in the foreground via parameters.
(2) Request in the background.
There are two types of back-to-table requests:
A. Request access to the Business Server.
B. Request access to the map server.
Requests to the Business Server to obtain the vector data is not different from the general request, the Business Server as long as a certain specification, organize the vector data, return. The focus of this chapter is to introduce the latter and how to request vector data from the map server.
3.1 Getting vector data through ArcGIS Server Introduction to several services in 3.1.1 AGS
When we publish a map service, if mapping is checked (must be checked), we will be able to publish a mapserver service. Of course, our AGS can also release a number of other types of services, such as Naserver, Geometryserver, Featureserver, Gpserver. Where naserver can be used for path analysis, the Geometryserver service includes a series of topological operations services, Featureserver can be used for feature editing, and Gpserver can use the published model for complex spatial operations. The following two images are several services published in 10.0, and some of the features available in the Geometry service (the default address for geometry services in 10.1 and 10.2 varies).
In this chapter, I mainly talk about the query service in MapServer. Other services in our future functional design module, if involved, will be discussed with you.
3.1.2MapServer explanation
First, MapServer supports two request modes and supports some query operations. Specific as follows:
On the MapServer page, we can also see specific information about the layers contained in the service:
Click on a specific layer, go to the Layer page, you can see the details of the layer, as well as this page also described in detail the actions you can support. As shown in the following:
Click Query to go to the specific page of the Layer space query:
On this page, we can get the desired query results by setting the individual query parameters.
3.1.3 Query queries for specific URLs
The query service provided by layers in MapServer is only supported for restful styles. From the above query we can know that the parameters of query queries are: ObjectIds, where, Geometry, Geometrytype, Spatialrel, Outfields, Returngeometry, Returnidsonly, F, time.
The actual meanings that these parameters represent are as follows:
ObjectIds: The Objectid number of the feature. For example: objectids=37, 462.
Where: A query condition that supports the where notation in standard SQL. For example: where=pop2000 > 350000.
The range to query for in Geometry:geometry. It should be consistent with the geometrytype. Geometry, a bit, line, face three kinds of wording. The description in the interface API is given here:
Geometrytype: its content is corresponding to the content in the geometry, it can choose the values are: Esrigeometrypoint, Esrigeometrymultipoint, Esrigeometrypolyline, Esrigeometrypolygon, Esrigeometryenvelope.
Spatialrel: Is the spatial reference parameter.
Outfields: The property field to return for.
Returngeometry: Whether the range geometry information. The default is ture.
Returnidsonly: Whether only the range is objectid. The default is False.
F: Returns the format of the data. There are HTML, JSON, KMZ, AMF. For our developers, returning JSON is the best fit.
Time: Assigned to a random value, set this parameter to avoid querying the read cache.
Here is a URL example:
Note: Here I set the Where to 1=1, which means that we can return the maximum number of data that we have set when we publish the service. The default is to return 1000 data. Outfields is set to * is the information that returns all key fields in the data. In addition, for readers who want to know more about URLs, you can refer to API Reference in ArcGIS Server.
In our program, we send requests to the AGS server, and when we query a key field, we can follow the style of the URL to make the request. The AGS Query service supports both get and post two request modes.
3.2 Introduction to vector data 3.2.1Geoserver via GeoServer
As an open source Map service tool, GeoServer is used by more and more practical projects because of its advantages of extensibility, open source, functional integrity and so on. GeoServer supports the WMS, WFS, and other standards in OGC, and GeoServer's request method also supports rest and soap two protocols. GeoServer itself is organized by MAVEN, internal use struts and spring framework, here I show you geoserver the source of the internal structure, so that we have a slightly clear understanding of the nature of GeoServer:
How to develop geoserver is not the focus of our series, we are working with you to explore some of Webgis's principles, design and implement some model and function based on principle knowledge. If you are interested in geoserver, I will work with you in the rest of the series.
After the successful release of GeoServer, you can login and enter the following pages:
Back to the point, how to use geoserver to achieve such as the AGS query?
3.1.2 Detailed query queries
The query layer information is the Getfeature service in the WFS service, and is requested in the same way as a standard WFS request. However, compared with AGS, geoserver query condition writing is relatively complex, and generally there are two ways.
3.1.2.1 first Way, url method
Http://www.someserver.com/wfs? service=wfs& version=1.1.0& request=getfeature& Propertyname=inwatera_1m/wkbgeom,inwatera_1m/tileid & typename=inwatera_1m& filter=<filter><within><propertyname>inwatera_1m/wkbgeom< Propertyname> <gml:Envelope><gml:lowerCorner>10,10</gml:lowerCorner> <gml:uppercorner >20 20</gml:uppercorner></gml:envelope></within></filter>
3.1.2.2 The second type: send GML mode after connection
After you connect to HTTP://WWW.SOMESERVER.COM/WFS, send the following XML to it:
3.1.2.3 summary of two kinds of request methods
In both of these ways, filter is the focus of writing. The filter itself is an XML-based language that conforms to the OGC specification. The WFS uses filter in all locations where the action object needs to be located. The function of filter is to construct an expression, the return value is a collection of feature, in other words, the filter as its name generally for us to filter out from a set to meet our requirements of a subset. The filter method is the operator defined by the filter. The filter defines three operators: the geographic operator (Spatial operators), the comparison operator (Comparison operators), and the logical operator (Logical operators).
Spatial operators defines how geographic attributes work: Equals, disjoint, touches, within, overlaps, crosses, intersects, Contains, Dwithin, Beyond, BBOX.
Comparison operators defines how scalar attributes are manipulated, they are: Propertyisequalto, Propertyisnotequalto, Propertyislessthan, Propertyisgreaterthan, Propertyislessthanoreq, Propertyislike, Propertyisnull, Propertyisbetween.
The Logical operators logical operators define the ways in which these operations are combined: and, or, not.
In query writing, the geometry parameter writing is also very important, but also a certain degree of difficulty, he needs us to have a certain understanding of the GML language. Here are three examples of GML, corresponding to point, box, and Polygon:
If we want the foreground to send a request directly to GeoServer, you can choose the first URL method. If we are forwarding requests to geoserver through our Business Server, we recommend the second way. The second can send a larger amount of data and is easy to form standard requests.
4. Organization of Vector data
The vector data itself is organized in a way that does not have a prescribed format, depending on the specific project. However, there is a fixed format for the data returned by AGS and GeoServer. Here we give an example respectively.
4.1AGS Vector Data Organization format
is an AGS-standard vector data format:
It consists of attributes and geometry. The attributes contains the results of the properties of the query, and the geometry contains the spatial information of the features queried. For different elements, the geometry of the returned organization are not the same. Geometry to line and polygon respectively have paths and rings two kinds of data organization format.
4.2Geoserver Vector Data Organization format
The vector data organization format returned in GeoServer is similar to that of AGS, with two points to note:
(1) indicates that the field names of points, lines, and polygons are different. The field names in GeoServer midline and Polygon are: line, polygon| Multipolygon.
(2) The coordinates returned, as opposed to the coordinates in the AGS (x, y), are the opposite in GeoServer, i.e. (y,x).
5. Summary
In this chapter, we explain in detail the WFS services in AGS and GeoServer. In a real project, the data for the vector layer is mostly derived from the data returned by the service. Let's go back to the fourth question I raised at the beginning of this chapter: how does a vector data get used?
The geometry data in the vector data is the geo-coordinate data, when we represent the vector layer in the front-end, we draw the shape of the geometry in the feature (UIComponent), so here is how to convert the resulting geographic coordinates to the corresponding screen coordinates, Lets you draw the feature shape on the front-end uicomponent.
In the next chapter, I will discuss this issue with you, next chapter: the geographical coordinates and screen coordinates conversion, please pay attention.
--Welcome reprint, but retain the copyright, please indicate the source in obvious place: Http://www.cnblogs.com/naaoveGIS
Friends like to read history, but I personally think that his hobby is a bit of reading deliberate come as a matter of suspicion. The main reasons are as follows:
1. The reading of history books are Sihuo too many, through the other layers of filtering books, not to do the study of the history of the book more read.
2. Whenever asked about what has been done in the past, a friend will say what history books I have read, but cop to avoid more and more practical things to do.
3. If you really want to study history, friends should not only stay on the book. There should be more questions, more listening, more writing about these three aspects.
Look forward to friends in the history of more gains, small harvest is to enrich life, increase the conversation, the medium harvest is to edify sentiment, learn to be a man, higher harvest is into opinion, the study of hundred generations.
Have a medium harvest, it is already a great reading history of people. Friend, hope you can achieve.