GoogleEarthKML中文说明.doc_第1页
GoogleEarthKML中文说明.doc_第2页
GoogleEarthKML中文说明.doc_第3页
GoogleEarthKML中文说明.doc_第4页
GoogleEarthKML中文说明.doc_第5页
已阅读5页,还剩62页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Google Earth KML中文说明基于Google Earth客户端版本3.0 的KML 版本2.0本文来源于Google由S翻译并整理,若有任何疑问,可到评论区留言KML 2.0介绍KML全称是Keyhole Markup Language KML,是一个基于XML语法和文件格式的文件,用来描述和保存地理信息如点、线、图片、折线并在Google Earth客户端之中显示, (KML以前的版本能够被Google Earth读取并保存为KML 2.0) KML 2.0提供以下功能: 指定一个地点的图标和标注来区分每一个地点 为每一个视图指定明确的视角来创建不同的特写镜头 使用指定到屏幕或地理位置的图片标注 为特定种类的标注定义显示样式 为标注指定基于简单HTML语法的描述,支持超级链接和图片的显示 使用目录(folders)对标注进行树形的分类管理(为了便于理解和符合习惯,将folder翻译为目录,实际上是代表一组地理标注,请谅解) 基于时间戳记的标注可以用来进行动态的播放 从本地或远程的网络地址动态的加载KML文件 当Google Earth客户端视图变化时,自动将视图信息发送给指定的源服务器并从服务器获取相关的标注信息 KML被Google Earth viewer显示的过程和HTML网页被浏览器处理差不多,而且和HTML一样,KML也使用一种基于标签(名称和属性)的语法格式来描述地里标注信息,可以说,Google Earth viewer是一个KML文件浏览器.目录 KML 2.0 Whats New 编写您自己的Google earth KML文件 KML基础 o 常用标签 o 地名标注(Placemarks) o 几何图形(Geometry) o 目录(Folders) o 文档(Documents) o 图片标注(Image Overlays) 地理图片标注(Ground Overlays) 屏幕图片标注(Screen Overlays) o 时间 o 样式 o Schemas o 网络连接 o Google Earth KML 2.0参考 KML语法规则 文档结构 标记类型 字符串 KML标签列表 KML 2.0 Whats NewKML 1.0是由原先的Keyhole客户端进行读写的文件格式,Google Earth完全支持KML 1.0文件,KML 2.0 是KML 1.0的升级版本,主要的更新如下:o Google Earth默认的输出文件格式改为KMZ,这是一个经过ZIP格式压缩过的KML文件,可以被任何支持ZIP压缩文件格式的软件打开,这种文件的优点是自身可以包含图片而不需要引用网络上的图片; o 标签现在可以支持一些标准的HTML格式语法,例如链接、图片、带格式文本和表格; o 过去使用的标签被新的标签替代; o 对标签的语法进行了升级更新; o 样式功能更为强大,现在由、 、 和四个分样式组成; o 过去的网络连接功能升级后能支持基于视图变化的更新; o 线段可以选择是否根据地形进行自动调整; o 标签不再支持,推荐使用标签来实现透明; o Network links功能现在支持向服务器发送当前视角信息,以便让服务器返回特定的KML文件。 编写您自己的Google earth KML文件Google Earth中的所有标注都是通过KML来描述的,KML有以下撰写方式:使用Google Earth client撰写KML文件:对于希望创建通过E-mail或者网页来发布的不动态的KML文件的用户来说,Google Earth 客户端就是一个很好的KML撰写工具,在Google Earth客户端中简单的按照您自己的要求组织您需要的数据并保存成一个独立的文件即可,在开发人员想要测试复杂的KML文档结构的时候,这个功能也同样有用, Google Earth客户端能够创建和保存几乎所有的KML标签。使用文本编辑器:你可以使用一个文本编辑器来创建简单的KML文件,或者测试一个KML文件的结构和语法的有效性。 TIP: 想要快速的检查KML语法,在Google Earth中右键点击一个地名标注或者图片标注,然后在菜单中选择Copy, 然后你可以打开一个简单的文本文档然后将KML内容粘贴到其中,就可以方便的查看Google Earth撰写的KML内容了使用开发环境来自动生成KML文件:您能够使用一种用来动态生成网页内容的编辑平台来生成KML地标文件,只要能够生成XML文件,就可以同样生成KML文件。下面是一个KML文件范例: !CDATAGoogle Search! Google Headquarters -122.0839 37.4219 540.68 0 3 -122.0839,37.4219,0 这个文件里有一个标签,包含一个被命名为Google Headquarters的标签,当这个文件被Google Earth客户端读取的时候,将会以默认的图标和在中指定的经纬度处显示, 的子标签指定当在Google Earth中显示这个标注的时候照相机视点.你可以复制该范例内容并保存成扩展名为.kml的文本文件,在Google Earth之中打开查看效果本文档的剩下部分还包含以下内容: 在你撰写你自己的KML文件的时候涉及到的Google Earth客户端 标签 程序员和GIS(地理信息系统)专业人员在用适当的方式撰写KML文件的时候需要的KML语法和指导 KML语法参考,包括复合标签和单一标签 KML基础Google Earth 客户端支持了大量的显示标签用来创建和保存成KML文档。如果你喜欢,你可以先用文本编辑器修改KML文档,然后在Google Earth客户端中打开看显示的效果,这和你修改一个HTML文档并在浏览器之中观看效果是一样的。对于更高级的程序,你可以使用CGI脚本生成KML文件,这一节讲解在Google Earth客户端之中支持的KML基本标签。常用标签在本节中描述的所有标注(目录folders,地名标注placemarks,图片标注overlays 和 网络连接)都包含以下元素.KML语法使用标签来指定目录(floder)、地名标注(placemark)、图片标注(overlay)或其他标记的名称,以便在Google Earth中进行区别,下面的例子显示了标签在标签上的应用: My House . . .使用描述元素给标注附加更多的关于该标注的信息,Google Earth自动识别其中的网址并显示为一个链接,并不需要任何HTML标记,不过你也可以再需要时使用HTML格式化文本的显示,甚至还可以使用图片。为了在描述之中使用HTML标签,您需要使用CDATA XML 标签来避免XML对HTML字符的解析,或者您也可以对特定的字符进行实体引用注意:在第一个测试版中在标签中部允许包含GIF图片,这个错误将在下一版本中修正,不过现在您可能还是只能使用JPG, PNG or BMP这几种格式。用来设置标注在第一次被Google Earth打开时的默认显示属性. Visibility对所有的标注都有效。不过visibility在目录之中使用的时候存在特殊情况,一个标记只有在它和它所有的上级标签都设成true(1)的时候才会显示。你可以定义该标注在用户打开KML文件的时候是否显示,在文件打开完成之后是否显示该标注完全取决于用户的操作。元素用来指定对给定点的特定视角,Google Earth能够为地名标注(placemarks),目录(folders),图片标注(overlays)和其他标注设置视角,当一个标注存在指定的标签时,双击该标注将使Google Earth平滑移动到指定视角。值得注意的是,视角和标注的经纬度没有任何关系,例如,一个地名标注可能在一大片陆地的中央,而该标注对应的视角观察者却朝向陆地的左边边界。实际上,一个标注的视点可能被设置到甚至根本看不到该标注本身的位置,因此当你为一个地名标注设置一个视点的时候,不要认为它会自动的让该标注出现在Google Earth视图之中。这样可能在你想为一个特定的标注使用一个特定的,不受限制的视角时非常有用,可有时候也会带来麻烦,因此,请谨慎使用本功能。当一个标记没有标签时,双击该标签将使Google Earth缩放当前视图到包含该标注点你可以使用包含地址字符串的标签来代替指定经纬度,例如1600 Amphitherter Pkwy, Mountain View, CA 这样将使用Google Earth的功能来解析这个地址(请注意这个功能现在只支持美国地址)标签允许您插入多行的描述文本,当用户选中该标签的时候,这些文本将显示在窗口的底部。地名标注Placemarks are the primary means of marking a location on the earth.A plcaemark may contain a single point, linestring, polygon, or arbitrary collections of these features. User-defined styles may be created to control the appearance of each of these elements. With KML, you can customize your placemark information in a variety of ways. In addition to the common elements, the placemark element uses a style reference () to specify the desired style for that placemark. For example, you can use any image-such as your company logo-as the icon for a placemark by using the style reference to point to the desired icon. In addition, the style can reference a style map in order to display a different style when the user mouses over a placemark. In this way, you can have both a normal and a highlighted state for placemark icons. Finally, you can also use style references to set scale and color for geometry as well as point labels.You can also specify a within a . This style is known as the Placemarks local style. Any fields that are specified in the local style will override the corresponding fields in the referenced style (i.e., any style referenced through ). Minimal use of local styles is recommended for best efficiency.几何图形GeometryThe following types of geometry can be expressed in the Google Earth client viewer:Point geometryPoints may be mapped on the earths surface as either icons or labels, or both. Placemarked points may be richly annotated within the Google Earth client, and may be positioned three-dimensionally. Points positioned at altitude may also be extruded, creating a line that tethers the placemark to the ground. Line geometryThis includes lines and linestrings (polylines), but not road data. As with points, lines may be positioned at altitude, and extruded to form solid walls. PolygonsTwo dimensional polygons may be created in the Google Earth client. As with lines, polygons may be positioned at altitude and extruded to form three-dimensional objects. Using a combination of points, lines, and polygons, it is easy to create rich, visually arresting displays of your data. CollectionsLines and polygons may be grouped into collections. CoordinatesCoordinate values for geometry must be entered in degrees (longitude, latitude) and meters (elevation above sea level). KML uses the tag to describe this feature. See the entry for for more information. Important: The required geographic coordinates specification is Longitude, Latitude, and Altitude, in that order. If you dont follow this method, your coordinate specifications will be misinterpreted.3D GeometryIn the Google Earth client it is possible to create three-dimensional shapes by extruding two-dimensional objects. See the entry for for more information. 目录Most uses of KML employ folders to organize placemarks, screen and ground overlays, and other folders. Use folders to structure collections of features and overlay groups, andto provide a unified view for a group of placemarks and/or overlays. In addition to the common elements, folders may have a number of extra properties:A switch (0 or 1) that controls whether or not the folder will be in an expanded or collapsed state when it is loaded.Logical containment of related data, and folder nestingYou can use a folder to contain related placemarks, overlays, and other folders. By providing folders with a name and LookAt values, you can group information in way to make it easily identifiable and manageable. For example, you can use a folder to associate a placemark with a related overlay image file for a multi-layered view of a particular region. You can create a hierarchical structure in a manner similar to the Microsoft Windows folder view, so that folders can be expanded or collapsed to reveal or hide content as needed. Do this in the Google Earth client by dragging and dropping folders on top of other folders in order to nest them. In KML, tags simply nest within each other, in the same way that tags can be nested in HTML.文档A document is a type of folder that can also contain the and tags in addition to features such as placemarks, overlays and folders. Use documents to group styles and schemas for a collection. Documents are also often root-level containers of KML hierarchies.Note: When you need to use styles or schema for your data, you must also use the element to contain these other elements. Use styles when you want to add custom icons and color and/or size information to geometry (see the entry for ). Use schemas when your data collection contains features that are not native to KML. With schemas, you can define a feature and its associated meta-data so that it is correctly displayed in the Google Earth client.图片标注(Image Overlays)Image overlays can be described in KML for adding image-based meta-data to your GIS data in the Google Earth client. There are two types of overlays:地理图片标注Use ground overlays for information-rich site display such as phased plans or weather maps. Ground overlays are images that are fixed to the planet surface.A screen overlay is a floating image independent of the camera position and is fixed to the screen. Examples of screen overlays might include displaying a legend of key for the data, or perhaps copyright messages. When using overlapping overlays, you can set the draw order to determine the overlay stacking order. In this way, for example, overlay images with black boundary edges or masked boundaries can be assigned a lower number than adjacent overlays so as not to obscure useful information. The tag references the overlay image file either locally or remotely, such as on your corporate web server. Remote users do not have to have a local copy of an overlay image if the image is supplied remotely. In this way, you can provide real-time updates of overlay data, such as weather, or development progress of site plans. The icon tag also contains child elements such as , which may be used to control automatic updates of remotely-served images (webcams, for example).The following image types are supported:o JPG o PNG o GIF o TIFF You can set the rotation of the overlay image. The image can be rotated up to 180 degrees in a clockwise (positive) or counter-clockwise (negative) rotation from north. In KML, ground overlay tags can be placed inside any folder or subfolder in your KML document. In addition to the common elements, ground overlays support the following elements:, , , Four coordinates set the edges of the overlay. These coordinates set the North-South (latitude), East-West (longitude) positions of the overlay boundaries. In addition, you can indicate the overlays rotation, which is about the center of the overlay. In the Google Earth client viewer, you can drag and rotate the overlay in order to set the coordinates, or you can enter in your own values.屏幕图片标注Use screen overlays to display information regardless of the camera position, such as heads up display, co-branding, or other types of dashboard display. As with ground overlays, you can define multiple screen overlays and associate them with a folder. You can define the position as an absolute coordinate position in the viewer, or as a percentage of the viewer size. You can also set the color of a screen overlay.Note: Screen overlays can currently only be authored in KML using a text editor, not in the Google Earth client.Screen overlays have the following features:Screen positionTwo mechanisms for screen positioning provide flexibility in different presentation formats. You can determine the position of the screen image using X/Y coordinates either with exact pixels, or as a fraction of the overall screen. See the entries for , and for more information.Use the tag to indicate the width and height of the overlay image based on the screen size. For more information, see the entry for .时间Time can be attached to all features in KML. Currently, time cannot be authored in the Google Earth client itself, but must be authored directly in KML. When the time feature is enabled (feature only available in the Google Earth EC client) all time-stamped features in a KML document can be made visible or hidden according to a number of adjustable parameters in the Google Earth EC client time user interface. For example, polygons representing each state of the United States can have a time value applied to represent the year the state joined the Union. Playback can be set in the Google Earth client to visually display the addition of each state.For more information, see the entries for , , and .样式Similar to styles in HTML, styles can be employed in KML to define the appearance of geometry, icons, and labels in the viewer. Styles can be used for the following effects:o Individual icons for normal, highlighted, and blinking states o Icon styling o Label styling o Line styling o Polygon styling Style SelectorsYou can use a tag to reference a style selector. A style selector selects a specific style from a group of styles, and may be used to apply that style to any piece of geometry. There are three style selector types in KML:StyleA tag is used to indicate drawing style for icons, labels, lines and polygons. A tag is a style selector that selects itself. See the entry for for more information.StyleMapA tag is used to provide a second level of style referencing for such features as placemarks. It selects a style based on the placemark highlight state. See the entry for for more information. StyleBlinkerA tag can be used to reference custom icons so that they blink in the viewer. It selects a style based on time. The frequency and duration of the blinking is customizable.Important: All style selectors must have an id, the XML attribute, in order to be accessible. The following example shows how it is possible to implement a simple rollover icon change. Two style ids are defined-normal and highlighted-which are then mapped to a styleUrl. The placemark has no local style, but instead is referenced to the global style. Simple Icon Rollover 1 C:/green_icon.jpg C:/red_icon.jpg normal #normalPlacemark highlight #highlightPlacemark Example Placemark #exampleStyleMap -122.0856545755255,37.42243077405461,0 SchemasFor elements in your KML that are not native to the default KML schema, you can define your own schema as a set of named and typed XML elements. For example, you can specify how KML should interpret imported files such as from a GPS tracker. A schema requires the following:Parent entityThe KML entity that the new schema will inherit from. For example, if you want the data in your KML document to inherit the elements of a placemark, you would set Placemark as the parent. See the entry for for more information.Schema nameAs with all other features, the name element identifies the schema. See the entry for for more information.Field declaration(s)The field declaration specif

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论