Download
spatial databases lecture 9 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Spatial Databases: Lecture 9 PowerPoint Presentation
Download Presentation
Spatial Databases: Lecture 9

Spatial Databases: Lecture 9

184 Views Download Presentation
Download Presentation

Spatial Databases: Lecture 9

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Spatial Databases: Lecture 9 DT211-4 DT228-4 Semester 2 2011 Pat Browne Web Mapping http://www.archaeology.ie/smrmapviewer/mapviewer.aspx http://spatial.dcenr.gov.ie/imf/imf.jsp?site=GeoUrban

  2. W3C and location • Location and geographical properties of resources has always been something of a dilemma for the World Wide Web, which has served so well to unlink the global identity of a resource from its physical location on the globe. One of the Web's greatest values is its capacity for enabling the growth of communities which are not constrained by distance and geography. Nonetheless, physical location is at least an essential property if not a part of the identity of any real entity. When appropriate, the Local Web of resources identified by location and geography is an essential aspect of Web discovery and communication. • Joshua Lieberman, Geospatial Incubator Group Chair, 2007/10/3, http://www.w3.org/2005/Incubator/geo/

  3. Custom Applications Spatial Databases must integrate with other applications and data. HTML Viewer Java Viewer GIS Desktop Applications (Internet) Wireless Mobile Devices Network Map Renderer Server Side Applications Spatial DB

  4. Outline • Question: What need to be done to allow geographic data to be available on the Web? • Answer: A lot! • The a typical Open Geo-Stack: • PostGIS for persistence: We need some structured way to hold spatial & non-spatial data. • Geoserver for server side map specific function WMS,WFS. • OpenLayers for client side programming to handle user interaction. • A web service (WS) is a software system designed to support interoperable machine-to-machine interaction over a network (W3C). A WS is any service that is available over the Internet, uses a standardized XML messaging system, and isn't tied to any one operating system or programming language.

  5. Typical web mapping configuration

  6. Web Services • The W3C defines a Web service as a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.

  7. Web services for mapping • The principle OGC web services are; • WMS; standardizes the display of map images. WMS can register and overlay maps from multiple remote sources. • WFS-T: standardizes the retrieval and update of features. • WPS: can describe calculations or processes (inputs and outputs, triggers, execution) as a Web Service. The processes can be supplied by a GIS (e.g. GRASS or special API) • WCS: standardizes access to spatially extended coverages, usually encoded in a binary format and offered by a server (typically remotely sensed data).

  8. Web services for mapping • Web services have reached a level of sophistication that facilitates the delivery and use of spatial information. Web services for mapping enable sharing information. • Web services for mapping allow consumers and providers of information to integrate diverse data sets.

  9. Web services for mapping • To access remote data we need specific knowledge about that data source: server address, data layers available, meta-data, required and available data format. • Once the system knows the details, application can request exactly maps and other information • We will GeoServer as our map server. • Another popular open source map server is simply called MapServer (http://mapserver.org/)

  10. Web services for mapping • The course web site list many examples of data sharing. Many of the links show how government departments share data with the public and other departments. Which means data users don't need to store their data locally. In many cases centralizing data storage can lead to cost savings and avoid redundancy. Web services for mapping can facilitate integration, centralization and sharing.

  11. OGC Web Map Service (WMS) • The OpenGIS® Web Map Service Interface Standard (WMS) provides a simple HTTP interface for requesting geo-registered map images from one or more distributed geospatial databases. A WMS request defines the geographic layer(s) and area of interest to be processed. The response to the request is one or more geo-registered map images (returned as JPEG, PNG, etc) that can be displayed in a browser application. The interface also supports the ability to specify whether the returned images should be transparent which allows layers from multiple servers can be combined.

  12. OGS’s features • Feature associated with a location relative to the Earth. The starting point for modeling of geographic information. A feature is an abstraction of a real world phenomenon. A geographic feature is a feature associated with a location relative to the Earth. A digital representation of the real world can be thought of as a set of features. • Geographic features occur at two levels: feature instances and feature types. At the instance level, a geographic feature is represented as a discrete phenomenon that is associated with its geographic and temporal coordinates. These individual feature instances are grouped into classes with common characteristics - feature types.

  13. OGC WFS • The OGS Web Feature Service Interface Standard (WFS) defines an interface for specifying requests for retrieving geographic features across the Web using platform-independent calls. The WFS standard defines interfaces and operations for data access and manipulation on a set of geographic features, including: • Get or Query features based on spatial and non-spatial constraints • Create a new feature instance • Get a description of the properties of features • Delete a feature instance (WFS-T) • Update a feature instance (WFS-T) • Lock a feature instance (WFS-T) • By default, the specified feature encoding for input and output is the Geography Markup Language (GML) which in turn is written in XML.

  14. OGC WFS • Via the WFS interfaces, a web user or service can combine, use and manage features from different sources by invoking the following WFS operations on geographic features and elements: • Create a new feature instance • Delete a feature instance • Update a feature instance • Lock a feature instance • Get or query features based on spatial and non-spatial constraints

  15. OGC WFS Web Services Description Language is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. WFS follows the web services model

  16. OGC WFS Basic sequence of events

  17. Web services for mapping • Data can be shared in a number of ways. A complete copy can be given to the remote user allowing them to use the data for any purpose. Alternatively, a more limited form of access can be granted. For example, users of Google Map do not get the actual spatial data although they are granted a high degree of usage through the Google Map API. OGC WMS (see later) provide to bitmap image rather than the vector map itself, whereas WFS provides vectors.

  18. Web services for mapping • Some spatial data, such as hurricane locations, is constantly changing (streamed). It does not make sense to download such data. It would be better to integrate the weather layer in your map that accesses a web service in realtime. • Web services can make very large data sets available to users, reducing the need for continual data storage upgrades.

  19. Requesting a Map GeoServer can request map data from a remote web server

  20. Typical web map services software environment OpenLayers is a JavaScript library for displaying map data in a web browser. We will look at OpenLayers later ModJK is the connector used to connect Tomcat servlet container with web servers such as Apache. We use GeoServers servlet container called Jetty and do not need to connect to Apache. GEOS (Geometry Engine, Open Source) is a library used by PostGIS to perform all the operations in the OpenGIS Simple Features for SQL Specification. PROJ.4 is an open source library used by PostgIS to convert between geographic coordinate systems

  21. The OGC Web Service package

  22. Client and WFS messages

  23. A Typical Web Page Layout

  24. GeoServer’s architecture MapInfo Interchange Format (MIF) is a map and database exporting file format of MapInfo software product. ArcSDE technology manages spatial data in a relational database management system (RDBMS) and enables it to be accessed by ArcGIS clients. It is the technology that provides the framework to support long transactions, which facilitates the versioned editing environment in multiuser geodatabases. The JTS Topology Suite is an API of 2D spatial predicates and functions.

  25. GeoServer • GeoServer can access and provide data using a web services framework. • The Open Geospatial Consortium (OGC) has developed specifications for web services for mapping. The OGC aim to increase interoperability between applications by creating common interchange languages through common standards. GeoServer implements OGC’s web mapping services.

  26. GeoServer & OGC specifications • Web Map Service (WMS) Share and request vector and raster map data in plain image format • Web Feature Service (WFS) Share and request vector map data and attributes in GML format • Web Feature Service –Transactional (WFS-T ) is a WFS that supports transactions - add, delete, or update features. • Web Coverage Service (WCS) Share image/raster data with original data value • Web Map Context (WMC) Save and load views of a WMS application as XML • Styled Layer Descriptors (SLD) Request particular symbolization and styling from a WMS • Geography Markup Language (GML) XML-based format for spatial and tabular data interchange • Filter: Encoding XML-based format for defining queries on spatial data

  27. GeoServer & OGC specifications • GeoServer 1.6.0 and above supports WFS 1.1 • WFS 1.1 supports on the fly re-projection of data, which means data can be returned in a SRS other than the native one. We can check the WFS version as follows: • http://localhost:8080/geoserver/wfs?request=GetCapabilities&service=WFS&version=1.0.0 • Here is the XML for the reference system • <SRS>EPSG:4326</SRS>

  28. Required WMS parameters for a GetMap request

  29. Serving static files within Geoserver • On Geoserve static web files are stored in the www subfolder of the GeoServer data directory, and they are served at http:/myhost:8080/geoserver/www. • In the www folder you can store html, images and Javascript and have Geoserver provide them on the web with AJAX callbacks.

  30. Using Servlets with GeoServer • Geoserver uses Jetty as a servlet container. • Jetty is an open-source embeddable web server and servlet container, written in Java. • http://www.mortbay.org/jetty/ • Jetty can handle Java servlets and JavaServerPages (JSP) technologies and traditional static web pages. • There is a Jetty Servlet tutorial at: • http://www.seas.upenn.edu/~cis550/jetty.html

  31. Using Servlets with GeoServer • Each GeoServer service is provided by a specific Servlet that intercepts the client requests and builds up the response in accordance to the GeoServer configuration. • Geoserver can be deployed as a standard WAR package inside Java Servlet containers.

  32. Configuration Interface

  33. Managing a Geographic Database From Mobile Devices Through OGC Web Services

  34. The OGS’s Spatial Web Universal Description, Discovery and Integration (UDDI) is a platform-independent, XML-based registry for businesses worldwide to list themselves on the Internet.

  35. The OGS’s Spatial Web

  36. Web Feature Service • A WFS must implement the following operations: • GetCapabilities - queries the WFS service to determine available options. • DescribeFeatureType - retrieves the XML schema to allow the WFS client to parse the result sets. • GetFeature - performs the actual query - parameters such as bounding box and any other filters should be passed in, as appropriate, and the WFS service then returns a GML result set containing full geometry and feature attributes.

  37. OpenLayers

  38. OpenLayers

  39. OpenLayers • OpenLayers (OL) is an open source JavaScript library for displaying map data in web browsers. OL provides an API for building complex web-based geographic applications. Data can be combined from a number of sources without requiring any server side processing as layers can be assembled and rendered on the client. Client side programming includes panning and zooming of maps, client-side tiling, markers, popup windows, various adjustable navigation components, keyboard commands, an event handling mechanism and client server communications. Each part of OL is configurable. OL can act as a Web Client for Geoserver. • See; http://www.bostongis.com/?content_name=openlayers_tut_01

  40. OpenLayers <html> <head> <script type='text/javascript'> function drawOnCanvas() { var canvas = document.getElementById('example'); var context = canvas.getContext('2d'); context.fillStyle = 'red'; context.fillRect(10, 10, 50, 50); } </script> </head> <body onload='drawOnCanvas()'> <canvas id='example' width='512' height='256'> </canvas> </body> </html> See : http://localhost:8080/geoserver/www/box/html http://147.252.234.32:8080/geoserver/www/box.html

  41. SQL OpenLayers get: function(key) { var name = this.name; this.db.transaction( function(tx) {           console.log("Select value from OLTable where key=?"); tx.executeSql("Select value from OLTable where key=?",  [key],               function(tx, result) {   if(result.rows.length) { return result.rows.item(0).data;1  } }, function(tx, error) { console.debug(error);  }); });   }

  42. OpenLayers • OL can act as a Web Client for: • OGC web services (WFS-T,WMS, and WCS (XML.GML)), • Commercial services such as Google Maps(KML), MSN Virtual Earth, ESRI products • Cpen source initiatives or defacto standards such as Geographically Encoded Objects for RSS feeds (GeoRSS). The OL GeoRSS parser will automatically connect an information bubble to the map markers, similar to Google maps.

  43. OpenLayers • OL helps integrates a diverse set of heterogeneous data sources (e.g. shape file and database). A variation on OL is Mapbulider built into GeoServer which supports OGC WFS and WMS. • OL facilitates a client-side JavaScript "map -mash-up” style application; A mash-up is a Web application that combines data from one or more sources into a single integrated tool. The term Mashup implies easy, fast integration, frequently done by access to open APIs and data sources to produce results that were not the original reason for producing the raw source data. An example of a mashup is the use of cartographic data from Google Maps to add location information to real estate data, thereby creating a new and distinct Web service that was not originally provided by either source.

  44. OpenLayers • OL can return projection information. A projection is a way of converting geographic coordinates (latitude and longitude) into a plane (Irish National Grid). • OL supports any projection, but needs PROJ4 for OL for projections on the fly. OL can request form map servers data in a particular projection. Strong support for the Spherical Mercator projection used by Google Map, Open Street Map, and Virtual Earth.

  45. OpenLayers • Two ways of getting data. • In one mode OL can request new data without refreshing an entire document, requests can be made to any origin. Another way to retrieve data from a server is to update the location of a document in a frame. These types of requests can also be made to any origin. However, the code running in the original document is restricted to reading data in documents that come from the same origin.

  46. OpenLayers uses AJAX • Underlying technology • The basic technology is Asynchronous JavaScript and XML • (AJAX) which includes of JavaScript and XML. XML is the W3C recommended standard for creating formats and sharing data on the Web • OL normally uses XML for data interchange (though JavaScript Object Notation (JSON) can be used as an alternative). Ajax is a way of developing Web applications that combines: • XHTML and CSS standards based presentation • Interaction with the page through the DOM • Data interchange with XML and XSLT • Asynchronous data retrieval with a XMLHttpRequest object which is used to read or send data on the server asynchronously. • JavaScript to tie it all together