span8
span4
本教程将告诉你如何ESRI的shape文件(* .SHP)转换成谷歌KML(* .KML)。我们会从ESRI的shapefile转化温哥华市的邮政编码的数据,使用不同的颜色样式的数据,并将数据写入出到谷歌KML格式。
ESRI的shape文件(forwardsortationareas.shp)表示不同邮政区覆盖温哥华。前向分拣区域(FSA)是其中所有邮政编码开始具有相同三个字符的地理区域。的FSA代码的第一个字母表示特定的“邮政区”。
This video was created with FME version 2016.0.Some of the steps might be slightly different, but the overall process is the same for newer versions of FME.
ShapefileToKML.zipContains workspace and data
1) Inspect the Data in FME
第一步是检查ForwardSortationAreas.shp文件。打开一个空白FME工作空间,添加一个新的读者。在阅读器对话框,在ESRI的shape文件类型,然后浏览到ForwardSortationAreas.shp文件。单击OK读者添加到画布上。
现在,查看数据,点击ForwardSortationAreas读者特征类型在画布上打开弹出式菜单。然后在弹出菜单中单击查看源数据按钮,在视觉预览窗口中查看数据。
我们代表着分拣区域的区域特征。有一个单一的属性(CFSAUID)识别的前向分拣区域,这是邮政编码的前三个字符。
Note:This step can also be completed in FME Data Inspector for versions previous to FME 2019.Just be sure to add the Esri shapefile reader to FME Workbench after inspecting the data.
2) Set the Output (Writer) Format to Google KML
接下来,我们需要一个作家加入到画布上。点击添加作家和添加作家对话框,在格式中,选择谷歌KML。
那么对于数据集,浏览到一个文件夹保存KML文件,然后设置文件名VancouverFSA.kml,单击OK添加作家。
3) Set KML Properties
当观看在谷歌地球KML文件,如果你对功能点击,信息泡沫出现时,我们要设置所显示的泡沫。一个KMLPropertySetter变压器添加到画布,并将其连接到ForwardSortationAreas读者特征类型。在KMLProperySetter参数,名称设置为CFAUID,然后设置包含属性表为No.如果我们有其他的属性,我们将离开这个设置为YES。
4) Add a KMLStyler
写入数据之前,我们需要风格的KML文件,否则它只是显示为白色的多边形。一个KMLStyler变压器添加到画布,并将其连接到KMLPropertySetter输出端口,然后将其连接到谷歌KML作家特征类型。
然后在参数,设置颜色和填充颜色以任何你选择的颜色,在这个例子中,我们使用了紫色。如果你用点数据的工作,你可以设置在该变压器的图标类型。
5) Run the Workspace
然后通过点击绿色的播放按钮运行工作区。
6) View the Output Dataset in Google Earth
查看输出数据集,点击ForwardSortationAreas writer feature type to open the popup menu.Then click on the Open Containing Folder button, then double-click on the VancouverFSA.kml file to open it in Google Earth.
If you do not have Google Earth installed, you can still view the data in FME, you won’t be able to view the contents of the information bubble.
Data Attribution
The Forward Sortation Areas data set provided here comes from Statistics Canada, 2011 Census Digital Boundary Files, 2013.Reproduced and distributed on an "as is" basis with the permission of Statistics Canada.© This data includes information copied with permission from Canada Post Corporation.
©2020安全亚搏在线软件公司|法律