span8
span4
在这种转换中,我们将采取一些表格CSV数据,沿着道路代表点,连接到创建行,从访问文件加入一些属性数据的行写上道路出来的ESRI的shapefile点。
让我们来看看我们的源数据一探究竟。许多用户在使用某种形式的分隔符的文本格式的空间数据的工作,如CSV文件就像我们在这个例子中。
此文件包含代表被调查的道路GPS点;每个记录持有道路ID值,顶点数和XY坐标的每一个点。道路ID是用于每条道路的唯一标识符,从而,这些12条记录与道ID等于1,表示一个路。我们也有在Access文件中的一些道路属性。请注意,也有在该表中的道路标识列;我们将使用这个关键属性在翻译过程中加入这些道路属性到我们的路线。
View of the GPS point data in a CSV file
Note: This video was created with FME 2015, the concepts are similar but the user interface will be different.In this demo, we'll set up a workflow to automatically import a CSV file of GPS data, convert it to GIS points and lines, join with a Microsoft Access file to get further attribute data, then write out to Esri Shapefile.You'll see how to control the output schema and clean up the attributes.
CSVToShape.zip(contains a completed workspace and data)
1.Add Reader
让我们在FME工作台打开一个空白工作区开始。一个CSV阅读器添加到画布上,开辟Roads.csv数据集。查看CSV文件的参数,以确认FME已经正确地拿起架构。这个数据是在城市得克萨斯州奥斯汀的,所以我们需要建立的坐标系。对于坐标。系统进入TX83-CF,然后单击确定以添加读者。
CSV Reader parameters, change the data type to x and y_coordinate
2.创建 points with the VertexCreator
添加VertexCreator到画布上。中的参数,设定X值x和y值为y。确保模式设置为添加点。
3.创建 lines with the LineBuilder
在画布上放置一个LineBuilder变压器;如果我们只是跑了工作区不设置任何参数LineBuilder,我们会得到一个乱七八糟的看线。我们需要设置连接中断属性。请记住,道路ID是什么唯一地表示每条道路;其设置为连接中断属性。
LineBuilder parameters, set the Connection Break Attributes to road_id
4.Join the data to an MS Access file containing attribute details
现在,让我们在roads_attrs.mdb MS Access文件读取包含道路属性使用DatabseJoiner互感器,DatabaseJoiner连接上LineBuilder线路输出端口。在参数方面,阅读MS Access文件和表设置为major_roads。然后,对于要素属性将其设置为road_id属性和表字段设置为ROAD_ID。对于字段添加,点击省略号,然后选择所有的功能。默认值的其余的都很好,单击确定。
数据库Joiner, join on road_id and ROAD_ID
5.Write to Shapefile
让我们添加一个Shape文件作家,然后选择自动...的定义。浏览到一个文件夹来保存Shape文件到,然后单击确定。在下一个对话框中,输入Shapefile道路 Name, and set the Geometry to shape_polyline.Click ok and connect it to the Joined Output port on the DatabaseJoiner.
In the Shapefile Writer parameters, change the Shapefile Name to Roads, and the Geometry to shae_polyline
6.Clean up attributes and run translation
As soon as we connect it up with the DatabseJoiner, notice that the attributes are automatically populated based on what the destination feature type is connected to.Now, we really just want to see the attribute from the MS Access file in our final output so let's clean up the destination attributes.Double-click on the Shapefile writer to open the Destination Feature Type Properties and in the User Attributes tab click on Manual for the attribute definition;this allows us to edit the schema.Remove road_id, vertex_num, x and y;these came from the CSV file.Run the workspace and view the output.
Output of the road lines created from GPS points
Data Attribution
Data provided by the City of Austin and Travis County, Texas
©2020安全亚搏在线软件公司|法律