﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-Rukas - Oh, My Blog!-随笔分类-GIS</title><link>http://www.cnitblog.com/rukas/category/1444.html</link><description /><language>zh-cn</language><lastBuildDate>Thu, 29 Sep 2011 15:06:36 GMT</lastBuildDate><pubDate>Thu, 29 Sep 2011 15:06:36 GMT</pubDate><ttl>60</ttl><item><title>Data Sharing System for E-Government - IIMS Solution</title><link>http://www.cnitblog.com/rukas/archive/2005/12/02/5067.html</link><dc:creator>Rukas - Oh, My Blog!</dc:creator><author>Rukas - Oh, My Blog!</author><pubDate>Fri, 02 Dec 2005 02:37:00 GMT</pubDate><guid>http://www.cnitblog.com/rukas/archive/2005/12/02/5067.html</guid><wfw:comment>http://www.cnitblog.com/rukas/comments/5067.html</wfw:comment><comments>http://www.cnitblog.com/rukas/archive/2005/12/02/5067.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/rukas/comments/commentRss/5067.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/rukas/services/trackbacks/5067.html</trackback:ping><description><![CDATA[<A href="http://www.gisdevelopment.net/technology/gis/ma03211.htm"><BR>http://www.gisdevelopment.net/technology/gis/ma03211.htm</A><BR><BR><FONT size=1><FONT face=Verdana><STRONG>Kenji Endo<BR></STRONG>Basic Engineering Co., Ltd.<BR>1) Takasaki East Tower 6F, 16-11 Sakae-cho, Takasaki, Gunma 370-0841, Japan<BR>Tel: 81-27-327-5431, Fax: 81-27-327-7415<BR>Email: </FONT></FONT><A href="mailto:k-endo@basic-hq.co.jp"><FONT face=Verdana size=1>k-endo@basic-hq.co.jp</FONT></A><FONT face=Verdana size=1> <BR>Web: </FONT><A href="http://www.basicengineering.com/" target=_blank><FONT face=Verdana size=1>http://www.basicengineering.com</FONT></A><FONT face=Verdana size=1> <BR><BR><B>Fuhu Ren</B><BR>240-8211 Ackroyd Road, Richmond, BC V6X 3K8, Canada<BR>Tel: 1-604-214-1456, Fax: 1-604-214-1457<BR>Email: </FONT><A href="mailto:fren@basicengineering.ca"><FONT face=Verdana size=1>fren@basicengineering.ca</FONT></A><FONT face=Verdana size=1> <BR>Web: </FONT><A href="http://www.basicengineering.ca/" target=_blank><FONT face=Verdana size=1>http://www.basicengineering.ca</FONT></A> <BR><BR><BR><B>1. Information Integrated Management System (IIMS) Solution</B><BR>The Information Integrated Management System (IIMS) is a commercial off-the-shelf (COTS) product developed by Basic Engineering Co., Ltd. It provides a total solution through an integrated mechanism of catalogue services, metadata integration, distributive unstructured data management, security control and GIS data interoperability (Endo and Ren, 2001). <BR><BR>IIMS unique concept for data sharing is based-on the service to integrate distributive and diversified data resources for distributive and diversified data applications. The basic considerations are as the following: 
<OL>
<LI>The source data could contain different types (such as documents, spread sheets, pictures, images, GIS maps, multimedia files, and databases) and in various formats. The data could be distributive at networked computers. 
<LI>The metadata and data catalog shall be accessible from a central point (a server computer) without physically accessing the original data. 
<LI>Client could register, maintain, search or access the data from remote computers and use the data in various applications. </LI></OL>The following explains the technical components of IIMS solution. <BR><BR><B>1.1 Catalog Services</B><BR>Catalog is to support organization, discovery, and access of data and information. Catalog services are one of the key functions for data sharing GIS. Because network GIS often links with vast amounts of Geospatial information resources, it is only through catalog searches that users can efficiently find the data suitable to their purposes. Without a catalog, it is almost impossible to locate the correct data, even when the data exist. <BR><BR>IIMS provides catalog services through its metadata server that allows remote search on the metadata database and access distributive data linked with the catalog. The registration, editing and maintenance can be done remotely by data owners. The catalog services can be accessed through IIMS Java Client software, Web Browser, or IIMS Application Programming Interface (API). <BR><BR>Figure 1 shows the main windows of IIMS Client for searching catalog and downloading dataset. <BR><BR>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211.jpg"><BR><FONT face=verdana size=1><B>Figure 1 IIMS Client for Searching Catalog and Downloading Dataset </B></FONT></CENTER><BR><B>1.2 Metadata</B><BR>Metadata are data that describe the content, quality, condition, and other characteristics of GIS data. Metadata is very important for user to find, understand and process the shared data. <BR><BR>Metadata are the core data in IIMS for search and understanding contents data. Depending on the type of the contents data, metadata usually contain the information such as title and keywords, abstract of contents, contact of author, spatial coverage, and technical information. <BR><BR>IIMS catalog provides services to search and browse metadata. Since IIMS can host sharing of data in different formats, not limited to text data and databases, it is impossible to search through the data contents directly but must through the metadata. IIMS metadata are structured descriptive data over unstructured contents data for search and understanding the contents data. Metadata play the role as indexes for unified one-stop search to quickly find the accurate data of interest. <BR><BR>Considering there are many metadata standards for different data types and resources, IIMS allows users to define multiple metadata models for different purposes. The metadata model can be a flat list, or hierarchical. Templates for popular metadata standards, such as the Content Standards for Digital Geospatial Metadata (CSDGM) by the Federal Geographic Data Committee (FGDC), are provided for user to easily configure their standard metadatabases. <BR><BR>For each metadatabase, multiple views can be defined for search or quick catalog listing. Each view can contain full or partial metadata items in the metadata model. This feature allows users to concentrate on certain metadata items for convenience in different situations. The metadata for spatial location can be defined by points or rectangles. Index maps can be registered to such spatial items showing the location on a map or by collecting coordinates from a map. Word (or location name) lists can be defined for String or spatial items. Users can select a word from a word list for String items, or get the location of spatial items from a location name list. <BR><BR><B>1.3 Distributive Data Archive and Management</B><BR>IIMS provides services to manage distributive data and share the data anywhere and any time. Figure 2 shows a typical architecture of deploying IIMS in a multi-departmental organization for sharing data. Each department has an IIMS data server to store its valuable data, there is a metadata server hosted by information center that contains the metadata of all data for sharing in the organization. Data are still maintained and updated by each department in charge, internal users can access via LAN while external users can access through Internet. <BR><BR>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211a.gif"><BR><FONT face=verdana size=1><B>Figure 2 Scenario of Application of IIMS in E-Government </B></FONT></CENTER><BR><B>1.3.1 Distributive data servers. </B><BR>IIMS Data servers are established to archive the data for sharing. Such data server can provide access services with proper protection and can be left in service all the time, while the data owner抯 computer may be shut off or taken away when the owner is not at work. The storage space for both the owner抯 computer and user抯 computers can be saved, since they can access the archived data at IIMS data server when needed. Thus, they do not need to keep a permanent copy of data in their local computers (except if they want to save downloading time). So ideally, only one copy (besides the backup copies) of a dataset is needed. <BR><BR>If all data are stored at a single server, when the data volume is huge, the performance would not be satisfied. If all the data are accumulated in a single server, when the data volume is huge or when massive users are concurrently accessing the data server, the server workload could be very heavy and so may become very slow. Distributive server systems can distribute the data accessing workload for better performance. When the disk is full, a single server system is difficult to be extended for more space. It抯 almost impossible to host complete data resources accumulated in years of a huge organization by a single data server. In IIMS, new data servers can be extended at any time and anywhere to avoid this problem. <BR><BR>There are also managerial issues. There are often issues about who should provide and maintain the data servers. In each department, there may be some sensitive data that must be kept within the department and shared internally. Data owner may worry about safety of storing its data to a data server of other department. In such cases, it抯 not feasible to submit the data to the centralized server, but must be kept on their own servers. On the other hand, a department may not like to host data from other department at its own data server. When all data are stored in a centralized server, for security reason and managerial regulations, the server administrator may have to take care of the overall data input, updating and maintenance. Alone with the growth of the data contents, such work will become so huge and impossible to be done efficiently on time. With IIMS, each department or group can have its own data server(s) for storing its own data. IIMS metadata server just provides catalog service for distributive data instead of hosting actual contents data. The maintenance work can be shared by respective departments. <BR><BR>Moreover, particularly for GIS, it抯 often impossible to put all spatial data in different formats into a single database at one data server. IIMS provides registration and search services for various data servers that host data of different types and in different formats. <BR><BR><STRONG>1.3.2 Centralized metadata Server. <BR></STRONG>Some systems manage metadata and data together at same location. When there are multiple data servers and a large number of datasets, searching metadata have do be done from each location. This may cost much time and add burden to each data server because each data server has to respond to search request even no data of interest available. This way may also make many difficulties to keep a compatibility of metadata from different data servers. <BR><BR>IIMS allows data from multiple data servers to be registered to a centralized metadata server. Through a centralized metadata server, IIMS can quickly search all available data from integral metadatabases. IIMS data servers don抰 need to serve for data search but only serve for data access. Furthermore, as described in the following, IIMS also provides a gateway (Data Exchange System) to support unified search over multiple metadata servers. <BR><BR><B>1.3.3. Integrating multiple metadatabases from different metadata servers. </B><BR>A standard IIMS configuration is a metadata server with multiple data servers. This is called an IIMS Data Sharing System (DSS). However in certain cases, multiple such DSS systems are needed. The reason for multiple DSS could be one of the following: 
<OL>
<LI>There are multiple organizations each independently established its own IIMS DSS system. So each has its own metadata server. 
<LI>Different groups have different metadata standards and management rules; this makes a single metadata server impossible. 
<LI>For a large organization, particularly with geographically distributive branches, the metadata volume could be too large to be hosted by a single metadata server. </LI></OL>When the organizations want to promote high-level data sharing among their internal IIMS DSS systems, IIMS provides a solution with IIMS Data Exchange System (DES) that enables multiple metadata servers to be searched integrally. <BR><BR>The purpose of IIMS DES is to allow data search and exchange among multiple metadata servers of IIMS DSS. It is like a gateway to allow user easier search through multiple DSS systems each with a metadata server. Each metadata server can contain multiple metadatabases, and those metadatabases may have different metadata standards and definitions. <BR><BR><B>1.4 On-Line Data Processing</B><BR>This will be an important feature of IIMS future version. IIMS will support data to be processed on-line when demanded by client at uploading to and downloading from IIMS data server. This feature allows the following extensions for specific applications: 
<OL>
<LI>Dynamic distributive database connection; 
<LI>On-line data encryption/decryption for enhanced data security; 
<LI>On-line data compression to reduce server space usage and data downloading time; 
<LI>On-demand data extraction for remote sensing imagery, digital maps, OLAP, etc.; 
<LI>Data format conversion; and 
<LI>Accounting for data on-line trading (e-commerce). </LI></OL><B>1.5 Data Security</B><BR>Apart from server security, the archived data shall be properly protected because: 
<OL>
<LI>
<LI>Owner wants only authorized persons to modify its data when necessary. 
<LI>Owner requires that its data are only seen and used by certain people, because of non-disclosure restrictions, or for the purposes of selling data. 
<LI>User needs to be sure the data are the original version published by its owner. </LI></OL>IIMS provides the following flexible security measures to assure security and authority to access IIMS servers and the data: 
<OL>
<LI>User account will be verified through a central user database at IIMS metadata server when accessing metadata or data from any registered distributive data server. User doesn抰 need to be registered repeatedly to each data server. 
<LI>Only the users authorized by system manager can upload data files to a data server. This helps to prevent illegal occupation of disk space at data servers. 
<LI>The owner of a dataset can allow only users belong to certain user groups to be able to view and access its data. The catalog will be hidden from users who have no authority to access the dataset. The owner can also assign only certain users to have the authority to modify the catalog and the linked dataset. This function allows a user to assign different security-level to each dataset with maximum flexibility. For example, financial report dataset may be only assessable to high-rank officials; planning map dataset may be only available to planners before publication, while announcement dataset can be opened to every staff. 
<LI>Data files at a data server can not be accessed directly, but must through the IIMS data server access service. Thus, all access is under security/authority control of IIMS. 
<LI>Each access and operation from IIMS user will be recorded in IIMS log database, IIMS manager can read the log information to monitor and trace illegal use of system and data. 
<LI>Concurrent editing of a dataset is controlled by locking/unlocking functions to make sure the modification on data is not lost. 
<LI>Data user can query IIMS to show real owner information to assure no fake data publication. 
<LI>As a supplementary security, data owner could make its dataset encrypted when uploading to IIMS. Users shall then contact the owner to get a proper key to decrypt the dataset at downloading. <BR></LI></OL>
<P><STRONG>1.6 GIS Data Interoperability</STRONG> <BR>Interoperability is a big issue. Because different GIS systems may be connected to the network, the data resources may be in various formats and projections. Without data interoperability, on-line access is meaningless and on-line processing is impossible. Ideally, every GIS on the network will provide a unique interface for data access, as defined by OpenGIS specifications. Otherwise the data format/projection conversion services shall be provided by the data server, so the user or applications can get the data in its needed format. <BR><BR>IIMS provides a GIS format converter to provide GIS format and projection conversion services on the data server. Most popular GIS data formats, such as ArcView Shape, Arc/Info E00, MapInfo MIF, AutoCAD DXF, USGS, DLG, G-XML, and some native formats often used in Japan, are supported. <BR><BR><B>1.7 Networking GIS</B><BR>A GIS system called GeoBasic? which has been developed by Basic Engineering Co., Ltd. is integrated with IIMS to provide viewing and manipulating functions of distributive Geo-Spatial Data (Ren et al. 1998). Within GeoBasic, users can directly search digital maps and images registered to IIMS and stored in distributive data servers, and directly load the data into GeoBasic for viewing, analyzing or plotting. Users can also create or modify maps and register to an IIMS data server for real-time sharing with other users. Other GIS can be integrated with IIMS through IIMS API too. Figure 3 shows the concept of integrating distributive data from different departments through IIMS. <BR><BR></P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211b.jpg"><BR><FONT face=verdana size=1><B>Figure 3 Integration of Distributive Spatial Data Through IIMS </B></FONT></CENTER>
<P><BR><B>1.8 Web Access</B><BR>IIMS supports two client modes: Java Client and Web Client. Although IIMS Java Client can be used to access IIMS servers through either Intranet or Internet, but for assuring security or avoiding client installation, web client accessed can be supported. Web client is for external users to access the catalog services and Geo-Spatial data through Internet with a commercial web browser, such as IE or Netscape. Web Client or Web GIS can access the data servers through IIMS Web Server, so web user can use up-to-date data in real-time. All transmission for Web access is through XML. IIMS can be a backbone system of Web GIS to manage the server data and supply data in real-time from distributive data servers. <BR><BR><B>2. Application of IIMS in E-government Projects</B><BR><BR><B>2.1 Prefecture Networking GIS</B><BR>Participating the national-wide e-government (e-Japan) movement, a pioneer Prefecture in Japan has recently acquired IIMS and GeoBasic and established a data sharing networking GIS for the government of the Prefecture. Leading by the Information System Department, totally twelve departments have participated the data sharing system, covering the data and management in construction, river, road, sanitation, environment, culture, natural resource, and disaster prevention. Each department creates and maintains data generated for its own business. All data are registered to an IIMS metadata server managed by the Information System Department for sharing with other departments. GeoBasic and IIMS Client are installed for individual users in each department. GIS data are registered and manipulated through GeoBasic, the integrated GIS tool for IIMS. <BR><BR>The scenarios of the prefecture GIS is shown in Figure 4. <BR><BR></P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211c.jpg"><BR><FONT face=verdana size=1><B>Figure 4 Scenario of Japanese Prefecture GIS </B></FONT></CENTER>
<P><BR><B>2.2 River Information Management System</B><BR>A major river management office in middle Japan has acquired IIMS and established a distributive river information management system. This management office, with 12 divisions, 9 filed brach offices, and around 150 staffs, has the responsibility to monitoring and manage 11 important rivers. Over 100 projects are implemented and over 1500 license applications are received in each yaer. Various types of data are gathered and shall be managed. Among them the most important are: </P>
<UL>
<LI>Project data 
<LI>Construction data 
<LI>Check porint data 
<LI>License application data 
<LI>Disaster information </LI></UL>
<P>The formats are diversified, such as documents, forms, CAD drawings, digital maps, and pictures. All those different types of data are now registered to a river information management system based-on IIMS (Figure 5). Staff from the different devisions in headquarter and geographically distributive brach offices can search and access the databases from anywhere through Intranet or Internet. More importatantly a knowledge database is also created on IIMS to share the intellenece information among staff in job training and solving problems. The work effiency and information management are greatly improved. In near future the system will be extended to include other kinds of data and support various business applications. <BR><BR></P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211d.jpg"><BR><FONT face=verdana size=1><B>Figure 5 IIMS for River Information Management </B></FONT></CENTER>
<P><BR><BR><STRONG>2.3 Technical Data Sharing System</STRONG> <BR><BR>An organization in Japan is now implementing a project to integrate and share the technical data and information for improving space equipment manufacturing and operation. IIMS is chosen as the backbone of the technical data sharing system. The data that will be managed and shared through IIMS include the following: </P>
<UL>
<LI>Standard business documents (regulations, specifications, requirements, etc.) 
<LI>Technical information (technical information from domestic/foreign space agency and manufacturers, reports, analytic data, image data, CAD data, knowledge data, etc.) 
<LI>Internal documents (meeting minutes, travel reports, etc.) 
<LI>Purchased book and paper materials. </LI></UL>
<P>The technical data will be able to be exchanged among domestic agencies as well as with foreign agencies (Figure 6). <BR><BR></P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211e.gif"><BR><FONT face=verdana size=1><B>Figure 6 The Conceptual Structure of the Technical Data Sharing System </B></FONT></CENTER>
<P><BR><B>2.4 Geospatial Data Sharing System</B> <BR>Five Universities in Japan have been cooperating in Yakushima Zero Emissions Project, a research project on resource recycling and sustainable society model. Rich results and data have been developed by participating institutions. To enforce the sharing and exchange the information and data, particularly the base map and spatial database of Yakushima, among participating researchers, a spatial data sharing system is being developed using IIMS. <BR><BR>The five participating Universities are: </P>
<UL>
<LI>United Nations University (UNU) 
<LI>Kagoshima University 
<LI>Tokyo Institute of Technology 
<LI>Aichi Gakuin University 
<LI>Toyohashi University of Technology </LI></UL>
<P>Figure 7 shows the sample screens of web interface of the system. Figure 8 shows the hardware and software configurations of the system. <BR><BR></P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211f.jpg"><BR><FONT face=verdana size=1><B>Figure 7 Web Interface of Kagoshima Zero Emissions Project Spatial Data Sharing System </B></FONT></CENTER>
<P><BR><B>2.5 Digital City</B><BR>Digital city is another name for e-government at municipal level in China. The objective of Digital City is to promote digitization and utilization of urban information resources through an integrated data management and sharing system, and improve the information service to government agencies, enterprises and the public. <BR><BR><FONT color=#a52a2a><U><FONT color=#006400><STRONG>Chengdu </STRONG>city, the capital of Sichuan province, is a pioneer in digital city construction in China. At the first phase, IIMS was adopted to develop an Urban Information Resource Management Platform. The system is composed of three tiers as shown in Figure 9. Data Tier is the base for creating and maintaining data resources. Management Tier is realized by IIMS providing fast metadata query and distributive data accessing capabilities. Through the IIMS data sharing system, the Service Tier provides services to various data and information users. <BR><BR>Figure 10 and 11 present two typical application scenarios of the data sharing system in <STRONG>Digital Chengdu</STRONG>.</FONT></U> <BR></FONT><BR></P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211g.gif"><BR><FONT face=verdana size=1><B>Figure 8 Hardware/Software Configurations of Kagoshima Zero Emissions Project Spatial Data Sharing System </B></FONT></CENTER>
<P><BR>&nbsp;</P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211h.gif"><BR><FONT face=verdana size=1><B>Figure 9 Three Tiers of Data Sharing System for Digital Chengdu </B></FONT></CENTER>
<P><BR>&nbsp;</P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211i.gif"><BR><FONT face=verdana size=1><B>Figure 10 Sharing Information to Support Decision Making </B></FONT></CENTER>
<P><BR>&nbsp;</P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211j.gif"><BR><FONT face=verdana size=1><B>Figure 11 Sharing Information to Support Disaster Mitigation </B></FONT></CENTER>
<P><BR><B>2.6 Disaster Prevention System</B><BR>A national agency for disaster prevention in Mexico has started a project for establishing the National Atlas of Risks (ANR, by their letters in Spanish) and the System for Identification of Risks of Disasters in Mexico (Siiride, by their letters in Spanish). <BR><BR>Those projects demand the extensive use of shared information among departments and institutions. Basic Engineering Co. Ltd. is invited to develop the solutions on shared information systems that could satisfy their requirements by using IIMS Technology. <BR><BR>The National Atlas of Risk is a project for incorporating all information related to risk of disasters in Mexico. The main goal is to create an information system that evolves in time by the distributed aggregation of digital files. As an initial step, a shared information system for generating all the basic information for the ANR will be developed for all the different departments to contribute with their files and databases. <BR><BR>The following data will be included into the data sharing system: </P>
<UL>
<LI>Informative Maps 
<LI>Reports of Popocatepetl Volcano 
<LI>Reports of Hurricanes 
<LI>Industries with hazardous substances 
<LI>Database of chemical accidents 
<LI>Seismic Events </LI></UL>
<P>The Siiride is a complex system for risk assessment. The integration with IIMS is fundamental for making analysis for different governmental dependencies. Each of those dependencies has their own requirements for using the information maintained by IIMS. Therefore, several different models for risk assessment and analysis must be shared through the solution. Figure 12 shows the general architecture and data flow of the system. <BR><BR></P>
<CENTER><IMG src="http://www.gisdevelopment.net/technology/gis/images/ma03211k.gif"><BR><FONT face=verdana size=1><B>Figure 12 General Architecture and Data Flow of IIMS-ANR-Siiride System </B></FONT></CENTER>
<P><BR><B>References</B> </P>
<UL>
<LI>Fuhu Ren, et al. 1998, Information Infrastructure Management System (IIMS) and Networking GIS. Proceedings of UM3?8 International Workshop on Urban Multi-Media/3D Mapping, Tokyo, Japan, 88-95 
<LI>Kenji Endo and Fuhu Ren. 2001, IIMS-A Data Sharing Platform for Networking GIS, Asian Journal of Geoinformatics, 1, 4, 91-96 </LI></UL>
<P>&nbsp;</P><img src ="http://www.cnitblog.com/rukas/aggbug/5067.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/rukas/" target="_blank">Rukas - Oh, My Blog!</a> 2005-12-02 10:37 <a href="http://www.cnitblog.com/rukas/archive/2005/12/02/5067.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Google Maps API 簡易使用文件</title><link>http://www.cnitblog.com/rukas/archive/2005/11/23/4842.html</link><dc:creator>Rukas - Oh, My Blog!</dc:creator><author>Rukas - Oh, My Blog!</author><pubDate>Wed, 23 Nov 2005 06:15:00 GMT</pubDate><guid>http://www.cnitblog.com/rukas/archive/2005/11/23/4842.html</guid><wfw:comment>http://www.cnitblog.com/rukas/comments/4842.html</wfw:comment><comments>http://www.cnitblog.com/rukas/archive/2005/11/23/4842.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/rukas/comments/commentRss/4842.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/rukas/services/trackbacks/4842.html</trackback:ping><description><![CDATA[<DIV class=main><BR>在 <A href="http://www.google.com/" target=_>Google</A> 推出 <A href="http://maps.google.com/" target=_>Google Maps</A> 之後，網路上出現各種 hack 網站及文件，討論如何直接從 Google Maps 的 CGI 取得地圖圖檔並推出自己的地圖服務，但是這類的網站對 Google 的負荷很大，例如前不久的 Google Maps Wallpaper 即是，大量無節制的下載圖檔，Google 沒多久就將他封殺了，而且各式 hacking 的程式良莠不齊，所以 Google 就乾脆自己推出 API 程式庫讓全世界對 Google Maps 有興趣的程式設計師能夠自行開發 Google Maps 服務，而且 Google 也可以透過 API 來對這些服務做一個控管。<BR><BR>這篇文章主要要介紹如何利用 Google Maps API 來把 Google 所提供的地圖服務內嵌到你的網頁中，看過這篇介紹後，你會發現這是多麼簡單的一件事情。如果你有興趣，不妨一起討論討論，或許你也可以想出很有創意的應用來。<BR>
<DIV></DIV><BR clear=all></DIV><A name=more></A>
<DIV class=main>
<STYLE>PRE {
	BORDER-RIGHT: silver 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: silver 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 90%; PADDING-BOTTOM: 3px; OVERFLOW: auto; BORDER-LEFT: silver 1px solid; COLOR: #008000; PADDING-TOP: 3px; BORDER-BOTTOM: silver 1px solid; FONT-FAMILY: Courier New, Courier; BACKGROUND-COLOR: #eeeeee
}
</STYLE>
目錄： 
<UL>
<LI><A href="http://blog.yam.com/syshen/archives/347151.html#application">申請一組 Google Maps API Key</A> 
<LI><A href="http://blog.yam.com/syshen/archives/347151.html#first">第一個範例：在網頁嵌入 Google Maps</A> 
<LI><A href="http://blog.yam.com/syshen/archives/347151.html#otherinfo">增加其他資訊：Marker，InfoWindow 或是 Polyline</A> 
<LI><A href="http://blog.yam.com/syshen/archives/347151.html#compability">瀏覽器相容性問題</A> 
<LI><A href="http://blog.yam.com/syshen/archives/347151.html#resource">其他資源</A> 
<LI><A href="http://blog.yam.com/syshen/archives/347151.html#license">版權宣告</A> </LI></UL>
<H3><A name=application>申請一組 Google Maps API Key</A></H3>在使用 Google Maps API 之前，你必須向 Google 申請到一組 Key，申請的方法很簡單： 
<OL>
<LI>首先，先決定你的網頁會出現在哪個 <A href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator" target=_>URL</A>，例如我想把 Google Maps 嵌入到我的 blog 中，我可以先知道該網頁的 URL 應該會是 http://blog.yam.com/syshen/archives/XXXX.html，前面包含到最後一個目錄的字串便是要來申請 Key 的基準，也就是 http://blog.yam.com/syshen/archives/。 
<LI>以你的帳號登入 Google，如果你還沒有帳號，請到 <A href="https://www.google.com/accounts/" target=_>https://www.google.com/accounts/</A> 申請。 
<LI>連到 <A href="http://www.google.com/apis/maps/signup.html" target=_>Google Maps API Sign Up 網頁</A>將 (1) 所決定的 URL 填入，並按 "Generate API Key" 取得 Key。 
<LI>最後會出現三個方塊，分別是你取得的 Key，你指定的 URL，以及一個範例。建議是將範例中的 <B><U>&lt;script src="..."&gt;&lt;/script&gt;</U></B> 整行 Copy/Paste 下來。 </LI></OL><BR>Goole Maps API 使用上有些法律上的限制要注意： 
<OL>
<LI>你的 Google Maps 服務必須免費開放給一般使用者。 
<LI>如果你預估你的地圖服務會有超過每天 50,000 筆頁面的存取量，請主動聯絡 Google。 
<LI>Google 會不定期更新 API，你有責任跟著更新你的網頁中的 API。 
<LI>你不能更改或隱藏 Google 的 logo。 
<LI>Google 有權力以後在地圖上放廣告，而你不能更改或破壞這些廣告。 
<LI>有些地圖應用是 Google 不希望看到的，例如指明哪些地方可以購買到毒品或是任何違法行為。 </LI></OL>這些限制我想一般簡單的應用都不太會觸及，目前為止，Google 也尚未在地圖上擺放廣告。<BR><BR>
<H3><A name=first>第一個範例：在網頁嵌入 Google Maps</A></H3>當你取得一把 API Key 之後，我們就可以來寫第一個範例了，這個範例相當簡單： <PRE>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
<FONT color=red><B>&lt;script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=ABQIAAAAuG7oWOtWqEZB1PNN_pEvsBQ5_R83DoQvDaRjoUUcz5SOzE95uxQPI9Bh8GLJN8gz2X_Ib6OP9qcsVQ" type="text/javascript"&gt;&lt;/script&gt;</B></FONT>
&lt;/head&gt;
&lt;body&gt;
   <FONT color=red><B>&lt;div id="mymap" style="width: 300px; height: 300px"&gt;&lt;/div&gt;</B></FONT>
   &lt;script type="text/javascript"&gt;<FONT color=red><B>
      //&lt;![CDATA[
	 var map = new GMap(document.getElementById("mymap"));
	 map.centerAndZoom(new GPoint(139.7600, 35.6700), 1);
      //]]&gt;</B></FONT>
   &lt;/script&gt;
&lt;/html&gt;
</PRE><A href="http://gais4.cs.ccu.edu.tw/~sys89/map_example1.html" target=_><I>看範例所呈現的結果</I></A><BR>第一行紅字的部分就是用你取得的 Key 去載入 Google Maps API，這裡要注意的是，你一定要用你自己的 URL 去取得這把 Key，否則網頁在載入時，會得到錯誤訊息。接下來，宣告一個 <B><U>div</U></B> 區塊用來擺置地圖，<B><U>style="width: 300px; height:300px"</U></B> 則是用來指定地圖區塊大小。<BR><BR>再來利用 <B><U>var map = new GMap (document.getElementById("mymap"));</U></B> 宣告一個 GMap 物件。而 <B><U>map.centerAndZoom(new GPoint(139.7600, 35.6700), 1);</U></B> 則是將地圖的中心點固定在<A href="http://en.wikipedia.org/wiki/Longitude" target=_>經度</A> 139.7600 和<A href="http://en.wikipedia.org/wiki/Latitude" target=_>緯度</A> 35.6700，而 Zoom Level 在這範例中設成 1 (1 為最大，數字越大 Zoom Level 越小)。在這邊你或許會有個疑問，要怎麼知道某個地點的經緯度？如果你是在美國或加拿大，有些網站會提供依照地址查詢經緯度的服務，但是其他國家就比較麻煩了，而我有個比較簡單的方法你可以參考看看，也就是先利用 <A href="http://maps.google.com/" target=_>Google Maps</A> 的大地圖找到你要的地點，將他固定在中間，然後按下網頁上的 <U>Link to this page</U>，這時候 Google Maps 就會顯示出這頁的 URL，URL 上就有該點的經緯度了，舉例來說，我想要找出日本京都車站的經緯度，我先用 <A href="http://maps.google.co.jp/" target=_>Google Japan Maps</A> 找到車站位置，並將他固定在中心，最後並取得連結：http://maps.google.co.jp/maps?ll=<FONT color=red><U>34.982050</U></FONT>,<FONT color=red><U>135.761490</U></FONT>&amp;spn=0.012443,0.020262&amp;hl=ja，紅字所標的就是京都車站的經緯度。<BR><BR>這個範例中，你有沒有覺得是不是少了什麼？那就是少了 Google Maps 中的控制項，沒有這個你沒辦法放大縮小地圖，也沒辦法切換衛星空照圖。如下範例你就可以在你的地圖中加入這兩個控制項：<BR><PRE>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=ABQIAAAAuG7oWOtWqEZB1PNN_pEvsBQ5_R83DoQvDaRjoUUcz5SOzE95uxQPI9Bh8GLJN8gz2X_Ib6OP9qcsVQ" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;div id="mymap" style="width: 300px; height: 300px"&gt;&lt;/div&gt;
   &lt;script type="text/javascript"&gt;
      //&lt;![CDATA[
	 var map = new GMap(document.getElementById("mymap"));<FONT color=red><B>
	 map.addControl(new GSmallMapControl());
	 map.addControl(new GMapTypeControl());</B></FONT>
	 map.centerAndZoom(new GPoint(139.7600, 35.6700), 1);
      //]]&gt;
   &lt;/script&gt;
&lt;/html&gt;
</PRE><A href="http://gais4.cs.ccu.edu.tw/~sys89/map_example2.html" target=_><I>看範例所呈現的結果</I></A><BR>Google Maps API 內建四種控制項： 
<UL>
<LI>GLargeMapControl : 適合給大型地圖的控制項。 
<LI>GSmallMapControl : 適合給小型地圖的控制項。 
<LI>GSmallZoomControl : 只有 Zoom Level 的調整，沒有地圖移動控制。 
<LI>GMapTypeControl : 顯示地圖型態切換的控制項。 </LI></UL>至於要用什麼控制項，你可以依照你所提供的地圖大小以及用途而定，每一種都試看看吧。<BR><BR>
<H3><A name=otherinfo>增加其他資訊：Marker，InfoWindow 或是 Polyline</A></H3>Google Maps API 好玩的地方是在於我們可以在地圖上面加很多東西，API 也提供一些基本的元件，包含你可以標示一個點，顯示資訊，甚至在地圖上畫線。 
<H4>GMarker</H4>先看看下面這個範例： <PRE>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=ABQIAAAAuG7oWOtWqEZB1PNN_pEvsBQ5_R83DoQvDaRjoUUcz5SOzE95uxQPI9Bh8GLJN8gz2X_Ib6OP9qcsVQ" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;div id="mymap" style="width: 300px; height: 300px"&gt;&lt;/div&gt;
   &lt;script type="text/javascript"&gt;
      //&lt;![CDATA[
	 var map = new GMap(document.getElementById("mymap"));
	 map.addControl(new GSmallMapControl());
	 map.addControl(new GMapTypeControl());
	 map.centerAndZoom(new GPoint(135.758486, 34.985320), 3);
	<FONT color=red><B>
	 var KyotoStation = new GMarker (new GPoint (135.761404, 34.982823));
         map.addOverlay (KyotoStation);
	</B></FONT>
      //]]&gt;
   &lt;/script&gt;
&lt;/html&gt;
</PRE><A href="http://gais4.cs.ccu.edu.tw/~sys89/map_example3.html" target=_><I>看範例所呈現的結果</I></A><BR>我在這個範例中設立了一個 Marker 標示出京都車站的位置，京都車站經緯度取得的方式如前面所述，最重要的是要新增加一個 GMarker 物件，並將此 Marker 物件加入到 map 物件中。你也可以在地圖上標示好幾的 Marker，甚至可以用自訂的 icon 來標示。<BR>
<H4>Info Window</H4>除了標示地點外，你也可以在 Marker 上顯示額外的資訊。 <PRE>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=ABQIAAAAuG7oWOtWqEZB1PNN_pEvsBQ5_R83DoQvDaRjoUUcz5SOzE95uxQPI9Bh8GLJN8gz2X_Ib6OP9qcsVQ" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;div id="mymap" style="width: 300px; height: 300px"&gt;&lt;/div&gt;
   &lt;script type="text/javascript"&gt;
      //&lt;![CDATA[
	 var map = new GMap(document.getElementById("mymap"));
	 map.addControl(new GSmallMapControl());
	 map.addControl(new GMapTypeControl());
	 map.centerAndZoom(new GPoint(135.758486, 34.985320), 3);
	 var KyotoStation = new GMarker (new GPoint (135.761404, 34.982823));
	<FONT color=red><B>
         GEvent.addListener (KyotoStation, "click", function() {
            KyotoStation.openInfoWindowHtml ("<B>日本京都車站</B>");
         });
	</B></FONT>
         map.addOverlay (KyotoStation);
      //]]&gt;
   &lt;/script&gt;
&lt;/html&gt;
</PRE><A href="http://gais4.cs.ccu.edu.tw/~sys89/map_example4.html" target=_><I>看範例所呈現的結果</I></A><BR>上面這個程式，在當使用者點了該 Marker 時會出現一個方匡顯示你輸入的文字，這文字可以是 HTML 格式，也就是說允許上面出現圖片等資訊。那可不可以不用去等到使用者點了之後才出現，可不可以在載入時就出現呢？好像是不行的，至少我測試的結果都會得到一些錯誤訊息。不過你可以這樣做： <PRE>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=ABQIAAAAuG7oWOtWqEZB1PNN_pEvsBQ5_R83DoQvDaRjoUUcz5SOzE95uxQPI9Bh8GLJN8gz2X_Ib6OP9qcsVQ" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;div id="mymap" style="width: 300px; height: 300px"&gt;&lt;/div&gt;
   &lt;script type="text/javascript"&gt;
      //&lt;![CDATA[
	 var map = new GMap(document.getElementById("mymap"));
	 map.addControl(new GSmallMapControl());
	 map.addControl(new GMapTypeControl());
	 map.centerAndZoom(new GPoint(135.758486, 34.985320), 3);
	<FONT color=red><B>
         map.openInfoWindow (new GPoint(135.761404, 34.982823), document.createTextNode("日本京都車站"));
	</B></FONT>
         map.addOverlay (KyotoStation);
      //]]&gt;
   &lt;/script&gt;
&lt;/html&gt;
</PRE><A href="http://gais4.cs.ccu.edu.tw/~sys89/map_example5.html" target=_><I>看範例所呈現的結果</I></A><BR>直接在地圖上顯示 Info Window，而不是在 Marker 上。但是 GMap 物件並沒有 openInfoWindowHtml() Function，只有 openInfoWindow() 可以用，而這個 Function 是以一個 DOM 物件作為參數，而非 HTML 格式的字串內容。 
<H4>GPolyline</H4>在地圖上畫線，這更酷了，請看以下範例： <PRE>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" <FONT color=red><B>xmlns:v="urn:schemas-microsoft-com:vml</B></FONT>"&gt;
&lt;head&gt;
<FONT color=red><B>
&lt;style type="text/css"&gt;
v\:* {
	behavior:url(#default#VML);
}
&lt;/style&gt;
</B></FONT>
&lt;script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=ABQIAAAAuG7oWOtWqEZB1PNN_pEvsBQ5_R83DoQvDaRjoUUcz5SOzE95uxQPI9Bh8GLJN8gz2X_Ib6OP9qcsVQ" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;div id="mymap" style="width: 300px; height: 300px"&gt;&lt;/div&gt;
   &lt;script type="text/javascript"&gt;
      //&lt;![CDATA[
	 var map = new GMap(document.getElementById("mymap"));
	 map.addControl(new GSmallMapControl());
	 map.addControl(new GMapTypeControl());
	 map.centerAndZoom(new GPoint(<FONT color=blue>135.770159, 34.986128</FONT>), 3);
	<FONT color=red><B>
	var points = [new GPoint(135.762649, 34.984124), new GPoint(135.762563, 34.986128), new GPoint(135.777369, 34.985952), new GPoint(135.778806, 34.990910)];
	var line = new GPolyline(points, "#ff0000");
        map.addOverlay(line);
	</B></FONT>
      //]]&gt;
   &lt;/script&gt;
&lt;/html&gt;
</PRE><A href="http://gais4.cs.ccu.edu.tw/~sys89/map_example6.html" target=_><I>看範例所呈現的結果</I></A><BR>OK，這個範例要告訴你如何從京都車站搭公車到音羽山清水寺。我設定了一串的 GPoint 物件陣列，每個點都是線條轉折處，並利用此陣列新增了一個 GPolyline 物件，並將這 polyline 加到地圖中即可(你也可以自訂 Polyline 的顏色及大小)。你或許還會注意到這個範例多了一些奇怪的東西，一個 namespace 以及一個 CSS style 設定，這是為了 IE 瀏覽器的相容性而加的，關於這個稍後會再提到。<BR><BR>
<H3><A name=compability>瀏覽器相容性問題</A></H3>Google Maps API 基本上沒有什麼瀏覽器相容性的問題，他支援的瀏覽器有： 
<UL>
<LI>Firefox/Mozilla 
<LI>IE 5.5+ 
<LI>Safari 1.2+ 
<LI>Opera </LI></UL>除此外，你也可以利用 <B><U>GBrowserIsCompatible()</U></B> 函式來檢查使用者的瀏覽器是否有相容性上的問題。例如，你可以這樣做： <PRE>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=ABQIAAAAuG7oWOtWqEZB1PNN_pEvsBQ5_R83DoQvDaRjoUUcz5SOzE95uxQPI9Bh8GLJN8gz2X_Ib6OP9qcsVQ" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;div id="mymap" style="width: 300px; height: 300px"&gt;&lt;/div&gt;
   &lt;script type="text/javascript"&gt;
      //&lt;![CDATA[<FONT color=red><B>
         if (GBrowserIsCompatible()) {</B></FONT>
	    var map = new GMap(document.getElementById("mymap"));
	    map.centerAndZoom(new GPoint(139.7600, 35.6700), 1);<FONT color=red><B>
	 } else {
	    var map = document.getElementById ("mymap");
	    map.innerHTML = "";
            map.innerHTML = "Sorry, 你的瀏覽器不支援 Google Maps";
	 }</B></FONT>
      //]]&gt;
   &lt;/script&gt;
&lt;/html&gt;
</PRE><A href="http://gais4.cs.ccu.edu.tw/~sys89/map_example7.html" target=_><I>看範例所呈現的結果</I></A><BR><BR>另外，如果你有用到 GPolyline 物件，為了能夠在 IE 上也能夠正確顯示，你必須引用微軟的 VML namespace 以及增加一個 CSS Style 來正確顯示 VML，關於這個請參考：<A href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/VML/ref/appendix.asp" target=_>http://msdn.microsoft.com/library/default.asp?url=/workshop/author/VML/ref/appendix.asp</A>，但是如果是只針對 Firefox/Mozilla 等瀏覽器則無此困擾。<BR><BR>
<H3><A name=resource>其他資源</A></H3>
<UL>
<LI><A href="http://www.google.com/apis/maps/" target=_>Google Maps API</A> 
<LI><A href="http://groups-beta.google.com/group/Google-Maps-API" target=_>討論群組</A> 
<LI>看看網路上其他 Google Maps 應用：<A href="http://googlemapsmania.blogspot.com/" target=_>Goole Maps Mania</A> 
<LI><A href="http://gmaps.tommangan.us/tlabel.html" target=_>A Google Maps Extension - TLabel</A> </LI></UL><BR><BR>
<H3><A name=license>版權宣告</A></H3><I>本文內容為作者(沈時宇)所有，本文內容及資料，僅提供給個人從事非營利的學術研究或參考，嚴禁以任何方式做全部或局部的改寫、轉載、重製或販賣等違反著作權的行為，若有違者，必當追究。<BR></I></DIV><img src ="http://www.cnitblog.com/rukas/aggbug/4842.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/rukas/" target="_blank">Rukas - Oh, My Blog!</a> 2005-11-23 14:15 <a href="http://www.cnitblog.com/rukas/archive/2005/11/23/4842.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>