Download presentation
Presentation is loading. Please wait.
Published byLoraine Wheeler Modified over 8 years ago
1
Using Lightweight Libraries To Do Powerful Tasks Geospatial Selection Using Mapx and JAZ JavaScript Libraries Scott Lewis scott.lewis@geospatialmethods.orgwww.geospatialmethods.org/jazjs/index.html Geospatial selection widgets are becoming more widely used in online data search tools. In order to make these selection widgets function, it is important to be able to project coordinates from the screen to the earth, and vice-versa. The Mapx JavaScript library enables these projection algorithms to be embedded into a web page, allowing the page to make use of on-the-fly projections in a client browser without having to make calls to a server. This, in turn, can greatly speed up projection calculations, and allow for more robust and interactive functionality in client web applications. The JAZ JavaScript library harnesses the power of the Mapx JavaScript capabilities by allowing the user to easily embed a selection widget into any tool requiring a visual geospatial selection mechanism. This relatively lightweight tool provides some significant power by allowing geospatial selections to be done on images of a variety of different map projections. These images can be served from a static image library, or a more dynamic Web Map Server (WMS) setup on a host. The flexibility of this widget has made it possible to use in a variety of web search tools. Presented December 15, 2008 JAZ JavaScript Library Try the Demo at: http://www.geospatialmethods.org/jazjs/jaz_demo.html Mapx JavaScript Library The Mapx JavaScript library was primarily written as a refactor of the Java library of the same name (written by Ross Swick). Taking advantage of JavaScript’s object-oriented capabilities it is powerful, yet easy to implement. There are three primary classes which comprise the main Mapx functionality. Mapx The Mapx class is actually an abstract class, and not directly instantiated. Instead, you derive projection-specific subclasses from the Mapx class. Each subclass then only needs to define methods for initialization and conversion between projection and latitude/longitude coordinates. The following projection classes are currently built into the Mapx library: Azimuthal Equal-Area Azimuthal Equal-Area (Ellipsoid) Cylindrical Equal-Area Cylindrical Equal-Area (Ellipsoid) Cylindrical Equidistant Lambert Conic Conformal (Ellipsoid) Polar Stereographic Polar Stereographic (Ellipsoid) Transverse Mercator MapMaker The MapMaker class is a factory class that can simplify the creation of Mapx-derived projection objects. MapMaker can create a projection manually, using a list of parameters to define the projection; it can use an internal pseudo-filename which will build a projection based on pre-defined parameters; or it can take an external server and filename to load projection information externally. Once the projection object has been created, the MapMaker class can be discarded. Grids The Grids object is used to wrap a Mapx object into a grid, which is beneficial when integrating Mapx into image-related code (such as JAZ). Using Grids, an application can convert between row/column coordinates (often corresponding to map coordinates), and latitude/longitude coordinates. Grid objects can be created manually, by specifying grid parameters and supplying a pre-defined Mapx object; or by using an internal pseudo-filename, using pre-defined parameters to create Grids and Mapx objects. Mercator Molleweid Orthographic Sinusoidal MapMaker MapxGrids Mapx Creation Row / Column Coordinates Projection Coordinates Latitude / Longitude Coordinates Selection Options X/Y Rectangle – This selection method would be used when the selection is specific to the projection displayed, such as retrieving MapServer corner points. Also, when using Zoom In capabilities with the WMSMapCanvas, the X/Y Rectangle selection is used when allowing for user-selected zoom areas. Latitude/Longitude Bounds – This selection method is useful for selections which depend only upon a latitude/longitude bounding box; i.e., a selection in which you only need north, south, east, and west boundaries. In some projections, this will look like an arc. The date line can be crossed using this selection if needed. Spherical Rectangle – This selection is useful because it is truly projection-neutral. The corner points match those from the X/Y Rectangle, but the sides of the Spherical Rectangle will be curved, as the corner points are connected by Great Circle arcs. The area represented by a Spherical Rectangle would be the same on any projection. Row/Column Rectangle – This selection is useful when you want a coarse-grained selection method. For example, some of NSIDC's MODIS products are broken into “tiles,” broken into a very coarse grid. The Row / Column rectangle allows you to select the tiles, and to see the discrete (rather than analog) boundaries of a selection. Discovery, Access, and Delivery of Data for IPY (DADDI) http://mercdev3.ornl.gov/daddi3 The DADDI search system uses JAZ as part of its Advanced Search capabilities. Geographic selections are made using the Latitude / Longitude selection on a static image canvas. The Antarctic Cryosphere Access Portal (A-CAP) http://nsidc.org/agdc A-CAP's large map is displayed and manipulated using JAZ and its MapServer functionality. Utilizes X/Y Rectangle selection, as well as the JAZ recentering and zooming capabilities. Search 'N Order Web Interface (SNOWI) http://nsidc.org/data/snowi SNOWI uses a global view to select spatial search boundaries. The ability to do tile-based searches, using the Row/Column Rectangle, is being developed to enhance the tool, as well. What is JAZ? J AZ is a lightweight, flexible and powerful widget designed to facilitate geospatial selection in web tools. Written in JavaScript, it is easily imported and used in web pages, and is designed to function using the most popular modern browsers. The JAZ JavaScript library incorporates the Mapx JavaScript library, enabling the widget to couple map images with projection coordinate conversion. One important thing to note, however, is that JAZ itself does not provide functionality for searching a database or retrieving information from a web server. Instead, JAZ provides the values selected by the user, and it is up to the calling code to use these values to retrieve the desired information. Major Features On the simplest level, JAZ can support the loading of a static image to use as a map. If the correct projection information for this map is provided, the user can draw selections on the map, and the widget can provide selection information to other methods in the code. However, JAZ is capable of more than just using a simple map and selection. Below are some of the major capabilities provided by JAZ. Multiple selection types – Because various tools and applications may require selection data in different formats, JAZ allows four different selection types (see sidebar at right). The code can also allow for switching between these selection types, depending on the context and what is needed. MapServer connection – While static images can be useful in many instances, JAZ also makes it possible to connect the map image to a MapServer, allowing for more dynamic map creation, as well as functionality not available for static images (such as zooming). Event listeners – JAZ is highly event-driven. As such, listeners are used to retrieve information from the widget. Various listener types are supported, including retrieving mouse position, selected area information, single- and double-clicks, and image load completion. The information retrieved from these listeners can be used for a wide variety of tasks, limited only to what the developer wishes to do with it. Multiple projections and views – Sometimes, it may be desirable to easily switch between different projections or views. JAZ makes this simple by allowing setup of multiple projections and MapServer maps; once setup is complete, switching between these views is simple and painless. Zooming, panning, and recentering – When MapServer mode is being used, it becomes simple to dynamically zoom in or out, pan, and recenter the map. When doing these things, JAZ keeps track of the view internally, so that selections can be done at any level of zoom or any map position. The images below demonstrate this functionality. Abstract Implementation Examples 2008 AGU Fall Meeting - Paper Number IN11A-1018 NSIDC/CIRES, University of Colorado, Boulder
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.