# How to get countries through OpenLayers.Protocol.WFS?

Am able to get states information of United States by using OpenLayers Protocol.

new OpenLayers.Protocol.WFS({ version: "1.1.0", srsName: "EPSG:900913", url: "http://demo.opengeo.org/geoserver/wfs", featureType: "states", featureNS: "http://www.openplans.org/topp" })

I need to get Countries information, tried replacing the fetureType: "countries", but this dint work. Can anybody help me.

You need to find the correct name for the layer you are trying to load. Try a getcapabilities request to the service like so:

http://demo.opengeo.org/geoserver/wfs?request=getcapabilities

Then search for 'countr' to find whether there are any layers with country geometries for you to use.

Edit:

I made a little JSFiddle for the layer. Depending on your connection it might take a little to load the whole of the WFS layer. In my case about 5 seconds.

Check the fiddle here:

http://jsfiddle.net/goldrydigital/9e2xj18u/

## Developing a Web Service Compatible Map Server for Geophysical Applications

### ABSTRACT

The Open Geospatial Consortium (OGC) defines a number of standards (both for data models and for online services) that have been widely adopted in the Geographical Information System (GIS) community. In this paper we will describe our group's efforts to implement GIS services according to OGC standard specifications in accordance with the Web Services approach. This paper focuses on the Web Map Service (WMS), which we are coupling to problems in computational geophysics. Through the use of Web Services, we are able to integrate GIS services with other families of services, including information, data management, and remote application execution and management. We also describe WMS client building efforts that are suitable for integration with computational Web portals.

To be able to interact with non-Web Service versions of WMS, we also have built bridging service for our extended WMS. Since Web Service oriented WMS has a different request/response paradigm from non-Web Service versions, we have extended cascading WMS by adding request handler functionality. This kind of WMS behaves like both a cascading WMS and a proxy to handle different types of requests to overcome interoperability problems between different WMS systems.

### Categories and Subject Descriptors

H.5 [Information Interfaces and Presentation]: Miscellaneous J.2 [Physical Sciences and Engineering]: Earth and Atmospheric Sciences.

### General Terms

Design, Human Factors, Standardization.

### Keywords

Geographic Information Services (GIS), Web Map Services (WMS), Web Feature Services (WFS), Geographic Markup Language (GML), Web Services, Open Geospatial Consortium (OGC).

### INTRODUCTION

Geographical Information Systems (GIS) introduce methods and environments to visualize, manipulate, and analyze geospatial data. These methods and environments have some interoperability problems. The nature of the geographical applications requires seamless integration and sharing of spatial data from a variety of providers. Interoperability of services across organizations and providers is a main goal for GIS and also Grid computing [15, 27].

To solve the interoperability problems, the Open Geospatial Consortium (OGC) has introduced standards by publishing specifications for the GIS services. OGC is a non-profit, international standards organization that is leading the development of standards for geographic data related operations and services. OGC has variety of contributors from different areas such as private industry and academia to create open and extensible software application programming interfaces for GIS [1].

implementation of SOA ideals, and Grid computing has converging requirements [15, 27]. By implementing Web Service versions of GIS services, we can integrate them directly with scientific application grids [11].

This document gives the details about the design and architecture of our Web Service refactoring of OGC specifications for the Web Map Service. This is part of a larger effort by our group to investigate translations of GIS services into Web Service standards [2]. Some earlier work in this area is reported in WMS [13]. In these documents they define standard WSDL description of the service interfaces.

In this document we first give a brief explanation of the GIS technology and related terminology. After briefly describing GIS, we give the definitions of some commonly used terms in the GIS. In Section 3, we describe general architecture for developing Web Service-Compatible mapping services. Under this title as subtopics we describe contributions of the Web Services to the GIS services, technical challenges encountered during implementations, integrating Web Services into OGC compatible GIS visualization, creating valid requests to WMS services in case of using Web Services, bridging capability of cascaded WMS, other services involved in proposed visualization system and implementation details of WMS. In Section 4, future work is described. Section 5 is the conclusion.

### TERMINOLOGY

GIS is a collection of methods to visualize, manipulate, and analyze, geographically referenced data or geospatial data. The sources of geospatial data are digitized maps, aerial photographs, satellite images, statistical tables and other related documents. These maps are created in layers collected from distributed data sources (other map servers, feature servers, and so on). When combined with scientific applications, dynamically generated maps provide a powerful technique for conveying information. For example state boundary lines data can be analyzed and produce a map. In the same fashion, earthquake fault data can be analyzed to produce a map. GIS relates these two data sets by overlaying these two maps produced from the corresponding data and reach a conclusion about this relationship.

Below we list and give the definitions of some commonly used terms in the GIS. We will be using these terms often in the following sections [8].

Spatial Data: Spatial data pertains to the space occupied by objects. Example spatial data from the real world are cities, rivers, roads, states, crop coverage, mountain ranges etc. In the implementation these are represented by points, lines, rectangles, surfaces, volumes and etc. Spatial data have some common characteristics. These type of data are geometric data and in high

dimensions. These data can be either discrete (vector) or continuous (raster). GIS applications are applied on these types of data.

Geospatial Data: Geospatial data are spatial data associated with a location relative to the Earth.

Feature: A feature is an abstraction of a real world phenomenon. A digital representation of the real world can be thought of as a set of features.

Geographic Feature: A geographic feature is a feature associated with a location relative to the Earth. Geographic features are those that may have at least one property that is geometry-valued [7]. Vector Data: Vector data deals with discrete phenomena, each of which is conceived of as a feature. The spatial characteristics of a discrete real world phenomenon are represented by a set of one or more geometric primitives (points, curves, surfaces, or solids). Other characteristics of the phenomenon are recorded as feature attributes [21]. Usually, a single feature is associated with a single set of attribute values.

Raster Data: Raster data deals with real world phenomena that vary continuously over space. It contains a set of values, each associated with one of the elements in a regular array of points or cells. It is usually associated with a method for interpolating values at spatial positions between the points or within the cells. Coverage – Coverage Data: OGC uses the term “coverage” to refer to any data representation that assigns values directly to spatial position. Coverage is a feature that associates positions within a bounded space (its spatiotemporal domain) to feature attribute values (its range). Examples include a raster image, a polygon overlay, or a digital elevation matrix [21].

The spatio-temporal domain of coverage is a set of geometric objects described in terms of direct positions. Commonly used spatio-temporal domains include point sets, grids, collections of closed rectangles, and other collections of geometric objects. Spatial Reference System: A spatial reference system is a function which associates locations in space to geometries of coordinate tuples in a mathematical space, usually a real valued coordinate vector space, and conversely associates coordinate values and geometries to locations in the real world.

Temporal Reference System: A temporal reference system is a function that associates time to a coordinate (usually one dimensional points and intervals) and conversely associates coordinate geometries to real world time.

Spatial-Temporal Reference System: A spatial temporal reference system is an aggregation of a spatial system and a temporal system that it uses to associate coordinate geometries to locations in space and time. Normally, the aggregation uses orthogonal coordinates to represent space and time, but this is not necessarily the case in more complex, relativistic environments [22].

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee.

### Web Services for GIS

Web Services give us a means of interoperability between different software applications running on a variety of platforms. Web Services support interoperable machine-to-machine interaction over a network. Every Web Service has an interface described in a machine-readable format. Web Service interfaces are described in a standardized way by using Web Service Description Language (WSDL) [19]. WSDL files define input and output properties of any service and services’ protocol bindings. WSDL files are written as XML documents. WSDL is used for describing and locating Web Services. Web Services are defined by the four major elements of WSDL, “portType”, “message”, “types” and “binding”. Element portType defines the operations provided by the Web Services and the messages involved for these operations. Element message defines the data elements of the operations. Element types are data types used by the Web Service. Element binding defines the communication protocols. Other systems interact with the Web Service in a manner as described in WSDL using Simple Object Access Protocol (SOAP) messages.

SOAP [18] is an XML based message protocol for exchanging the information in distributed environment. It provides standard packaging structure for transporting XML documents over a variety of network transport protocols. It is made up of three different parts. These are the envelope, the encoding rules and the Remote Procedure Call (RPC) convention. SOAP can be used in combination with some other protocols such as HTTP. OGC compatible Web Services will be using SOAP over HTTP. We have used Apache Axis for creating and publishing the Web Service. Axis takes care of the SOAP communication between server and the client. Axis 1 has proven itself to be a reliable and stable base on which to implement Java Web Services. Porting OGC services to Web Services will offer several key benefits, including:

Distribution: It will be easier to distribute geospatial data and applications across platforms, operating systems, computer languages, etc. They are platform and language neutral.

Integration: It will be easier for application developers to integrate geospatial functionality and data into their custom applications. It is easy to create client stubs from WSDL files and invoke the services.

Infrastructure: We can take advantage of the huge amount of infrastructure that is being built to enable the Web Services architecture – including development tools, application servers, messaging protocols, security infrastructure, workflow definitions, etc [13]. Some of these features are being developed by using Web Service infrastructure in Naradabrokering [28], message based middleware system, developed in CGL (Community Grids Lab.) at Indiana University. NaradaBrokering aims to provide a unified messaging environment that integrates grid services, web services, peer-to-peer interactions and traditional middleware operations. In the near future we will be utilizing these features in GIS visualization systems.

### Compatible GIS Visualization

The WMS OpenGIS Specification specifies the implementation and use of the WMS operations (GetCapabilities, GetMap and GetFeatureInfo) in the Hypertext Transfer Protocol (HTTP) distributed computing platform. WMS operations can be invoked using a standard web browser by submitting requests in the form of Uniform Resource Locators (URLs). In the specification it is also said that future version may apply to other distributed computing platforms such as Web Services.

Web Services use SOAP for messaging. SOAP is an XML protocol. SOAP provides an envelope that encapsulates XML data for transfer through the web infrastructure (e.g. over HTTP, through caches and proxies). Most services (including our own) use the Remote Procedural Call (RPCs) encoding convention, but we expect more message-centric applications in the future with the release of Axis 2 and other implementations of SOAP Version 1.2. Serialization mechanisms are based on XML Schema data types [15].

### In Case of Using Web Services

In developing Web Service versions of the WMS, we have converted existing HTTP GET/P0ST conventions [4] into WSDL interfaces. We have encountered some minor technical problems in this conversion. Data binding frameworks such as Castor [16] or XMLBeans [17] take XML Schemas as input and produce java sources, greatly simplifying the coding work needed to process requests and responses. But one major problem with these frameworks is that sometimes it is not easy to find an object oriented correspondence of the XML Schema constructs. In such cases either the source codes can not be generated or generated source codes may not produce correct XML instances.

We chose the Castor data binding framework for our initial implementation. Unfortunately, some of the XML Schema types, such as substitutions and abstract types, used in OGC Schemas are currently not supported by Castor. We had to make several changes to make these schemas compatible with Castor Source Generator. Modifications are done just for the latest versions of the schema files of the GIS services. These modified schemas are

available at http://complexity.ucs.indiana.edu/

currently investigating the use of XMLBeans as an alternative data binding framework.

Internal implementations of the WMS services are compatible with the current WMS specifications but service interfaces and the way to invoke services are different a bit different. Services are invoked through the SOAP over HTTP. Requests are created as XML documents and wrapped into body part of the SOAP request message. These requests are shown in Figure 1-3.

These schema files are created to be used during the invocation of operations implemented as Web Services at the WMS side [13]. Requests are created at the WMS Client side. Clients create these requests after getting required parameter from the user. When request is ready, client sends this request to WMS as a SOAP message. WMS has deployed Web Services for each service, getMap, getCapabilities and getFeatureInfo. Clients use client stubs created before to invoke these specific Web Services. All these services in WMS take one String parameter. This String parameter is request itself. These requests are actually xml documents in String format.

Below schema files displayed in Figure 1-3 are created with the help of Altova XmlSpy. They include all the elements and attributes of corresponding requests defined in OGC WMS specifications [4].

Figure 1 : GetCapabilities Request Schema.

Figure 2 : GetMap Request Schema.

GetMap request is created for our WMS implementation. We have not implemented Styling capability yet. Styling capability will be added soon, for the current status and the future works please see the Section 4. WMS supporting styling are called SLD-enabled WMS. The Open GIS Consortium (OGC) Styled Layer Descriptor (SLD) specification [6] defines a mechanism for user-defined symbolization of feature. An SLD-enabled WMS retrieves feature data from a Web Feature Service [7] and applies explicit styling information provided by the user in order to render a map.

In our project since we have just implemented Basic WMS, we have not used elements related to styling in the WMS getMap requests. For defining styling in the getMap request we use StyledLayerDescriptor element. StyledLayerDescriptor has other sub elements and attributes.

### Proposed Visualization System

Our Web Service-compatible WMS depends upon Web Feature Service [32] and Information Services [33] to accomplish its required tasks. They are ongoing projects in CGL (Community Grids Lab.). This section briefly describes the WMS interactions with these other services.

A general picture of interactions between these three services is displayed in Figure 4. Initial invocations are displayed as black arrows

Figure 4 : Basic GIS Components involved in Visualization System. Abbreviations are expanded in the text.

### Web Feature Service (WFS)

WFS instances store geospatial data and serve them upon request from clients. WFS clients include Web Map Servers and other WFS instances (in case of cascading WFS). WFS provide vector data, described in Section 2. Vector data are encoded in GML (Geographic Markup Language) [9], an XML encoding for the transport and storage of geographic information, including both the geometry and properties of geographic features.

According to OpenGIS WFS specification, basic Web Feature Services are getCapabilities, describeFeatureType and getFeature. If WFS is transactional than this WFS provides two more services. These are “transaction” and “lockFeature” services. Since we have implemented basic WFS, WMS uses basic WFS services: getCapabilities, describeFeatureType, and getFeature. WMS sends a getCapabilities requests to WFS to learn which feature types WFS can service and what operations are supported on each feature type. The getCapabilities request can also be mediated by the aggregating Information Services (IS). WMS makes its request to IS to get a specific WFS address that provides needed feature. Please see Section 3.4.2 for the details about the interconnection between WMS and IS.

## 2010年3月12日金曜日

### OpenLayers 55 Feature Info in Popup - WMSGetFeatureInfo コントロールでレイヤ情報をポップアップ表示

Feature Info Example（getfeatureinfo-popup.html）を参考に WMS レイヤからの位置情報と属性をポップアップ表示することを試してみます。

### OpenLayers 54 Feature Info - WMSGetFeatureInfo コントロールでレイヤ情報を表示

Feature Info Example（getfeatureinfo-control.html）を参考に WMS レイヤからの位置情報と属性を表示することを試してみます。