Télécharger la présentation
1
<Insert Picture Here>
6 Mapviewer
2
Points couverts Architecture Installation et configuration
Définition de cartes MapBuilder La console Mapviewer Exemple d’utilisation Oracle Maps
3
Oracle 10g: MapViewer Serveur d’application
Fourni avec toutes les versions du serveur d’application Oracle Interfaces XML, Java et Javascript (Ajax) Outil de définition de cartes Cartes décrites dans la base (symbologie, visibilité, etc.) Cartes thématiques Formats PNG, GIF, JPEG, SVG Compatibilité OGC WMS Serveur et client
4
MapViewer Architecture
Client (browser, servlet, JSP, PL/SQL) Application Java API XML/HTTP Oracle Application Server Map Rendering Engine JDBC MapViewer Architecture Client applications connect to MapViewer and send XML mapping requests via the HTTP communications protocol. Requests include information about which database to query, and also information about the map to be drawn. MapViewer connects to the database using JDBC, fetches information about the map to be drawn from the map metadata tables, then selects the spatial data to be mapped by performing spatial queries. MapViewer then renders the map, and the response to the map request sent back to the client for display is a streamed map or a pointer to the map along with the bounds of the map. Database Spatial Tables Map Definitions Mapbuilder
5
Requêtes et réponses Une requête spécifie: Le contenu de la carte
Carte de base Thèmes Statiques Thèmes Dynamiques Formes Dynamiques La position de la carte Centre et taille Le format du résultat Type d'image Dimensions en pixels Mapping Client La réponse contient: L'image proprement dite Ou L' URL vers l'image ainsi que le MBR de la carte Formats: GIF, PNG, SVG, JPEG MapViewer MapViewer Query A client sends an XML request to MapViewer that includes the base map name as stored in the map metadata, the center and size of the map to be displayed, and any optional tags to be displayed in the map (such as a map title, jdbc_query elements, legends, and others). <jdbc_query> elements enable you to submit any SQL statement in Oracle that returns SDO_GEOMETRY objects, and display the results on a base map generated by MapViewer. The base map generated by MapViewer is composed of rectangular viewport queries against a predefined set of SDO_GEOMETRY columns. <jdbc_query> elements will be discussed more towards the end of this lesson. MapViewer queries map metadata views via JDBC to determine which layers are associated with the map its about to generate. MapViewer queries the spatial data layers, renders the data, performs the JDBC element queries, and then either returns a streamed map or a pointer to the map, along with the minimum bounding rectangle associated with the map. Oracle Spatial
6
Contenu d'une installation MapViewer
La servlet Mapviewer L'outil de définition de cartes Des styles de base Des exemples d'applications (JSP) Une IHM d’administration (HTML) Mapbuilder Sample Java Server Page HTTP/XML Application Server JDBC MapViewer Installation and Configuration MapViewer requires setting up Oracle9iAS Containers for J2EE (also known as OC4J). An admin JSP ships with MapViewer to help register connection information with OC4J. A MapViewer installation includes the following components: The MapViewer .ear (enterprise archive) file Scripts to create map metadata views and populate default styles A Beta version of the Map Definition Tool which is used to manage the map metadata. An admin java server page (JSP) to configure connection information with OC4J The MapViewer metadata views are created automatically in an Oracle9i, Release 2 database install. Since MapViewer can generate maps from Oracle version databases and beyond, any database prior to Oracle9i, Release 2 must have the MapViewer metadata views manually installed in the Oracle MDSYS schema (the script is provided with the MapViewer kit). This is discussed in more detail in an upcoming slide. All database versions, Oracle9i, Release 2 included, must have the default styles populated manually (the script is provided with the MapViewer kit). This is also discussed in an upcoming slide. Oracle Spatial Mapping Metadata MapViewer
7
Installation de MapViewer
MapViewer n'est pas déployé automatiquement avec le serveur d'application Le kit est fourni sous forme d'un fichier "EAR" (J2EE Enterprise Archive) standard: mapviewer.ear de 2.3 MB Installation au moyen des outils de déploiement standard du serveur d'application. Peut s'installer dans le moteur J2EE du serveur d'application (Oracle Components for J2EE - OC4J) Standalone OC4J Installation A minimum MapViewer configuration requires OC4J, Release 2 (which is shipped with Oracle9iAS, Release 2). OC4J, Release 2 (~20 Mb zipped) can be downloaded at: Select Oracle9iAS J2EE Downloads To install OC4J: Unzip the zip file, and the J2EE\home directory will get created Initialize OC4J cd J2EE\home type: java –jar oc4j.jar -install Note: You should install OC4J outside of the ORACLE_HOME directory for the system.
8
Déploiement de Mapviewer Console d'administration OC4J
9
Démarrage de Mapviewer
Automatiquement lors du démarrage du serveur d'application. java -jar oc4j.jar … 05/03/06 18:56:59 Oracle Containers for J2EE 10g ( ) - Developer Preview 3 initialized 05/03/06 18:56:55 Sun Mar 06 18:56:55 CET 2005 INFO [oracle.lbs.mapserver.oms, ,#Thread-9] *** Oracle MapViewer started. *** Standalone OC4J Installation – Standalone MapViewer Installation (continued) Starting OC4J: From the command line, cd J2EE\home Type: java –jar oc4j.jar The first time OC4J is started after a new MapViewer install, the ORACLE_HOME\lbs\mapviewer.ear file will be expanded into a directory structure. Any time OC4J is started, you should see the following message: [oracle.spatial.mapserver.oms, INFO] *** Oracle Map Viewer is successfully started. ***
10
Configuration de Mapviewer MapViewerConfig.xml
Niveau de trace et destination Gestion des images <logging log_level="finest" log_thread_name="true" log_time="true"> <log_output name="System.err"/> <log_output name="../log/mapviewer.log"/> </logging> <save_images_at file_prefix="omsmap" path="../../../web/images" life= "5" recycle_interval="10" />
11
Configuration de Mapviewer MapViewerConfig.xml
Informations globales sur les cartes Cache de données <global_map_config> <title text="MapViewer Demo" font="Courrier" position="NORTH"/> <note text="Oracle (C) copyright 2004" font="Bookman Old Style Bold Italic" position="SOUTH_EAST"/> <logo image_path="../../../web/myicons/orcl_logo.gif" position="SOUTH_WEST"/> </global_map_config> <spatial_data_cache max_cache_size="64" />
12
Configuration de Mapviewer MapViewerConfig.xml
Sources de données permanentes Mot de passe crypté automatiquement <map_data_source name="elocation" jdbc_mode="thin" jdbc_host="localhost" jdbc_port="1521" jdbc_sid="orcl101" jdbc_user="elocation_map" jdbc_password="!elocation_map" number_of_mappers="5" /> jdbc_password="DdhrdKHeq1xR/ign0PUcL54OJh5rTw/X0mVALwrWYqE="
13
Définition des Cartes Les définitions sont dans la base
USER_SDO_MAPS USER_SDO_THEMES USER_SDO_STYLES Définition au moyen de l'outil fourni (Mapbuilder) Map Metadata The Map Definition Tool The Map Definition Tool is one of the most helpful MapViewer tools. It helps build and manage information associated with styles, themes and maps. The Map Definition Tool is currently in Beta, and it can be downloaded from the following location on Oracle TechNet: Click on “software” under “Spatial” on left side The Beta version of the Map Definition Tool is not shipped with the Oracle9iAS, Release 2 CD. A production version of the Map Definition Tool is planned for Oracle9iAS, Release 4. The Map Definition Tool is written in Java.
14
Définition des Cartes STYLE THEME MAP
Couleurs, styles de lignes, symboles, textes Style avancés pour thématiques THEME Associe un ou plusieurs styles avec une table spatiale Style graphique, et style des étiquettes Correspond à une couche dans la carte MAP Groupement de thèmes Spécifie l'ordre des thèmes et leur visibilité selon l'échelle Les cartes peuvent partager les thèmes Oracle9iAS MapViewer Concepts Styles, themes and maps are all very important concepts to understand when generating maps with MapViewer. Styles: Styles determine how geometries are rendered. Styles can include properties like fill color, border color, line thickness, line style and more. Advanced styles are styles that render a geometry differently based on another column’s value. This is commonly known as thematic mapping. For example, imagine a table with county polygons, and the polygons need to be rendered differently depending on a county’s population. Thematic mapping of the counties based on population can be accomplished with an advanced style. Advanced styles will be discussed more in an upcoming slide. Themes: A theme is analogous to a geometry column. A theme must have an associated style which determines how geometries for that theme are rendered. Optionally, a theme may have an associated label column. If a theme has an associated label column, its geometries get labeled with the text value of that column. Labels columns must have an associated style. MapViewer performs sophisticated text management. For example, MapViewer avoids having labels overwrite other labels.
15
Définitions privées, définitions globales
Styles USER_SDO_STYLES = mes styles personnels ALL_SDO_STYLES = tous les styles définis dans la base Themes USER_SDO_THEMES = mes thèmes personnels ALL_SDO_THEMES = les thèmes sur les tables auxquelles j'ai accès Maps USER_SDO_MAPS = mes cartes personnelles ALL_SDO_MAPS = toutes les cartes MapViewer Dictionary Views The definition of styles, themes and maps are stored in the database in MapViewer dictionary views. There are three categories of MapViewer dictionary views: *_SDO_STYLES *_SDO_THEMES *_SDO_MAPS For each category, there is a USER_*, ALL_*, and DBA_* version of that category for a consistent look and feel to other dictionary views in Oracle. For example, for the *_SDO_STYLES category, the following dictionary views exist: USER_SDO_STYLES: Insert styles into this view ALL_SDO_STYLES: Select styles from this view, never insert into this view DBA_SDO_STYLES: Can see all styles, never insert into this view
16
USER_SDO_STYLES Chaque style a un nom unique (par utilisateur)
Type de style: COLOR, MARKER, TEXT, LINE, ADVANCED Définition codée en XML Aussi formes géométriques et bitmaps (pour les symboles) Quelques styles de base fournis dans l'installation de Mapviewer (fichier DefaultStyles.sql) SQL> describe user_sdo_styles Name Type NAME VARCHAR2(32) TYPE VARCHAR2(32) DESCRIPTION VARCHAR2(4000) DEFINITION CLOB IMAGE BLOB GEOMETRY MDSYS.SDO_GEOMETRY USER_SDO_STYLES All themes rendered by MapViewer must have an associated style. Style definitions are stored in the database. New style entries can be made by inserting into the USER_SDO_STYLES MapViewer dictionary view. The Map Definition Tool (discussed in detail in upcoming slides) greatly simplifies the process of inserting new styles in USER_SDO_STYLES. With the Map Definition Tool, users are abstracted from having to know XML to insert new styles. Detailed examples of how to build XML definitions for styles is described in the Oracle9iAS MapViewer User’s Guide. Automatic population of default styles is planned for Oracle10i. The Oracle MapViewer kit when installed includes a SQL script to populate some default styles. The default styles are not populated automatically. To populate the default styles: Log in to SQL*Plus as the Oracle MDSYS user Note: If populating styles in a pre-Oracle9i, Release 2 database, the MapViewer metadata views must get created first.
17
USER_SDO_THEMES Chaque thème a un nom unique (par utilisateur)
Un thème est associé à une table et une colonne géométrique Règles de représentation en XML Se réfèrent aux styles définis par leur nom SQL> describe user_sdo_themes Name Type NAME VARCHAR2(32) DESCRIPTION VARCHAR2(4000) BASE_TABLE VARCHAR2(32) GEOMETRY_COLUMN VARCHAR2(2048) STYLING_RULES CLOB USER_SDO_THEMES All maps rendered by MapViewer are made up of one or more themes. Theme definitions are stored in the database. New theme entries can be made by inserting into the USER_SDO_THEMES MapViewer dictionary view. The Map Definition Tool (discussed in detail in upcoming slides) greatly simplifies the process of inserting new themes in USER_SDO_THEMES. With the Map Definition Tool, users are abstracted from having to know XML to insert new themes. Optionally, a theme may have an associated label column. If a theme has an associated label column, its geometries get labeled with the text value of that column. Label columns must have an associated style. A theme’s label column and associated style are stored along with the rest of the theme styling rules in XML. Detailed examples on how to build XML styling rules for themes is described in the Oracle9iAS MapViewer User’s Guide. As mentioned above, it is much easier to have the Map Definition Tool build the XML styling rules.
18
USER_SDO_MAPS Chaque carte a un nom unique (par utilisateur)
Liste des thèmes utilisés Codés en XML SQL> describe user_sdo_maps Name Type NAME VARCHAR2(32) DESCRIPTION VARCHAR2(4000) DEFINITION CLOB USER_SDO_MAPS All maps rendered by MapViewer are made up of one or more themes. Map definitions include all the themes that make up a map, along with an optional min scale and max scale for each theme. Map definitions are stored in the database. New map entries can be made by inserting into the USER_SDO_MAPS MapViewer dictionary view. The Map Definition Tool (discussed in detail in upcoming slides), greatly simplifies the process of inserting new maps in USER_SDO_MAPS. With the Map Definition Tool, users are abstracted from having to know XML to insert new maps. Detailed examples on how to build XML definition for maps is described in the Oracle9iAS MapViewer User’s Guide. As mentioned above, it is much easier to have the Map Definition Tool build the XML definition.
19
Utilisation de MapBuilder
21
Styles
31
Themes
37
Cartes
41
Console MapViewer
43
Exemple d’utilisation de MapViewer
44
Anatomie d'une requéte XML
<?xml version="1.0" standalone="yes"?> <map_request datasource="spatial10g" basemap="US_BASE_MAP" format="PNG_STREAM" width="480" height="400"> <center size="12"> <geoFeature> <geometricProperty> <Point> <coordinates>-120.0,39.0</coordinates></Point> </geometricProperty> </geoFeature> </center> <themes> <theme name="PARKS.US_PARKS" /> <theme name="INTERSTATES.US_INTERSTATES" /> </themes> </map_request> Data source et carte Format du résultat Centre et taille de la carte Thémes additionnels mapclient.jsp mapclient.jsp along with its source code ships with MapViewer. This is a very useful JSP to get you started viewing maps defined through the Map Definition Tool. Once MapViewer is installed, the source code to the JSP is located in: ORACLE_HOME\lbs\mapviewer\web\demo\mapclient.jsp To run the JSP, go to the following URL where local host is the name of your server, and the port (8888) is the port you configured OC4J with: The following is a definition of each of the fields on the JSP. MapViewer URL: URL to the MapViewer Servlet => Data Source: Name of the data source Title: Optional title for the map Base Map: Name of the base map defined with the Map Definition Tool Map Center X Coord: center x value for the map Map Center Y Coord: center y value for the map Map Size: The horizontal width of the map will be two times the specified size. In the example above, the map will be 10 decimal degrees from east to west. Size is specified in the unit of the coordinate system associated with the spatial data.
45
Le résultat …
46
Une requête en Java // Setup map request
mv = new MapViewer(mapViewerURL); mv.setDataSourceName(dataSource); mv.setBaseMapName(baseMap); mv.setImageFormat(MapViewer.FORMAT_PNG_URL); mv.setDeviceSize(new Dimension(mapWidth, mapHeight)); mv.setCenterAndSize(cx, cy, mapSize); // Send map request mv.run(); // Get URL to generated Map imgURL = mv.getGeneratedMapImageURL(); // Get size and center of new map mapSize = mv.getSize(); Point2D center = mv.getCenter();
47
PL/SQL API SDO_MVCLIENT package Install into your database
Wrappers on the Java API methods: PROCEDURE setDataSourceName(name IN VARCHAR2) AS LANGUAGE JAVA NAME 'oracle.lbs.mapclient.SQLMapClient.setDataSourceName (java.lang.String)'; … FUNCTION getGeneratedMapImageURL RETURN VARCHAR2 AS NAME 'oracle.lbs.mapclient.SQLMapClient.getGeneratedMapImageURL() return java.lang.String';
48
PL/SQL API Example Setup a connection to Mapviewer Setup a map request
Submit the request Extract resulting map URL call sdo_mvclient.createmapviewerclient( ' call sdo_mvclient.setDataSourceName('mvdemo'); call sdo_mvclient.setImageFormat('PNG_URL'); call sdo_mvclient.setBaseMapName('us_base_map') ; call sdo_mvclient.setBox( , , , ); call sdo_mvclient.setDevicesize(500,400); call sdo_mvclient.run(); mapUrl := sdo_mvclient.getgeneratedMapImageURL();
49
MapViewer "AJAX" Architecture
Client (browser) Application JavaScript Map API XML/HTTP Oracle Application Server Map Cache Server FOI Server Map Cache Map Rendering Engine JDBC MapViewer Architecture Client applications connect to MapViewer and send XML mapping requests via the HTTP communications protocol. Requests include information about which database to query, and also information about the map to be drawn. MapViewer connects to the database using JDBC, fetches information about the map to be drawn from the map metadata tables, then selects the spatial data to be mapped by performing spatial queries. MapViewer then renders the map, and the response to the map request sent back to the client for display is a streamed map or a pointer to the map along with the bounds of the map. Database Spatial Tables Map Definitions Mapbuilder
50
Oracle Maps : architecture
Oracle Maps is composed of client and server side components. Client side: Comprised of a JavaScript viewing library (called FSMC - Free Scrolling Map Client) and a public API Resides inside the browser Assembles various contents into a map displayed to the end user Talks to server side components through AJAX calls Server side Map Cache server which manages pre-generated base map tiles FOI server which creates interactive FOI data for the client Both are relying upon the main MapViewer rendering engine
51
Asynchronous JavaScript and XML (AJAX)
Classic browser cycle: Send form to server Get full new page from server "AJAX" browser cycle: Send request(s) to server from page sections Get response to request Process response and update page section only user browser server user browser server
52
Oracle Maps client side: a simple HTML page showing a map
<head> <script language="Javascript" src="jslib/loadscript.js"></script> <script language=JavaScript> var baseURL = " function display_map() { var mapview = new MapView(document.getElementById("map"), baseURL); mapview.addBaseMapLayer(new BaseMap("mvdemo.demo_map")); mapview.setCenter( , 37.75); mapview.setZoomLevel(5); var foiLayer = new ThemeBasedFOI ('customers', 'mvdemo.customers') ; mapview.addThemeBasedFOI (foiLayer); mapview.addNavigationPanel("east"); mapview.display(); } </script> </head> <body onload= JavaScript:display_map() > <h2>A Simple Web Mapping Application</h2> <div id="map" style="left:10; top:60;width: 600px; height: 500px"></div> </body></html> Load the Oracle Maps client viewing lib map initialization function Invoke map initialization function where the map will appear on the page
53
Oracle Maps : map cache server
Map source 1 Map Cache Instance 1 Map source 2 Map Cache Instance 2 Map source 3 Map Cache Instance 3 map tiles
54
Map cache server : tiling
Each map tile in a map cache instance is identified by a mesh code. Defined as a pair of integers (Mx, My) Mx specifies the X dimension index of the tile My specifies the Y dimension index of the tile. Transparent to the application developer Oracle Maps client viewing lib automatically calculates mesh codes. What is Tile Mesh Code? A map tile
55
Map cache server Administration
MapViewer comes with a web based admin console for managing map cache instances:
56
Oracle Maps FOI server Any existing geometry theme can be added to the map as a FOI layer The FOI server requires zero-configuration; it relies on MapViewer to process a theme, then repackages the theme data into a format that can be interpreted by the client viewing library When using MapBuilder to create a predefined theme, you can specify “info columns” in the theme to be displayed in its FOI info-tip windows
Présentations similaires
© 2024 SlidePlayer.fr Inc.
All rights reserved.