span8
span4
Converting from CSV to point,line or polygon features is easy as long as there is spatial data contained within the CSV file,like latitude and longitude information.In this article,我们将使用内置的csv阅读器参数将csv转换为点功能,变压器,as well as using geocoding.We will also convert CSV to line and polygon features using the VertexCreator transformer with the LineBuilder transformer.
csvtospatial.zip(contains a workspace to demonstrate all three parts with data)
要获得点特征,有三种不同的方法:(1)使用读卡器参数,(2) using the VertexCreator,and (3) geocoding addresses.To start for all methods,在空白工作区中,添加一个csv阅读器并添加rapid_transit_stations.csv文件。设置适当的坐标系,for this example enter UTM83-10,then follow either Method 1 or Method 2.You can use both Method 1 or Method 2 interchangeably,但是,如果您知道要从头创建空间点,并且在设置读卡器时记住将数据类型更改为x/y/y_坐标,那么方法1会很好地工作。Method 2 can be done later in the translation after the coordinate values have been manipulated or if you didn't setup the Data Type in the reader setup.如果您的数据只有地址,则方法3非常有用,没有坐标。
Open the CSV reader parameters,在下面属性定义,select Manual.Then set the X/Y/Z (Longitude/Latitude/Elevation) fields to the x/y/z_coordinate data type,click OK until the reader is added to the canvas.
In the reader parameters,set the Attribute Definition to Manual and set the X and Y Coordinate data type
在读卡器添加到画布中而不在参数中设置属性定义之后,add a变极器transformer.The VertexCreator creates a point feature of each record using X/Y/Z or Longitude/Latitude/Elevation values stored in the attributes.Each point feature retains all the attributes of the original non-geometry feature.
Use the VertexCreator to create points if the data type wasn't set in the reader
Sometimes your CSV file will only contain addresses,without latitude/longitude data.为了处理这些情况,您可以使用地理编码变压器.Add a CSV reader with the CulturalSpaces2016.csv dataset to the canvas,add a Geocoder.在地理编码参数中,sign up for a free Google Geocoder API and then paste the API into the parameters.下一步,for Street Address,identify where the address is stored select that Attribute.For this example,the address is stored in ADDRESS.在运行翻译之前,set the Rejected Feature Handling to Continue Translation.We need to do this because some of the cultural spaces don't have an address associated with them,so our translation will stop when the Geocoder rejects these features.要做到这一点,in the Navigator Pane > Workspace Parameters > Translation > Rejected Feature Handling > Continue Translation.运行翻译,你现在可以在地图上找到点了。
Use a Geocoder to create points if you only have address data
Output of point features using any of the three methods
获取线条特征是一个两步过程。In a workspace,添加一个csv阅读器并添加rapid_transit_lines.csv文件,设置适当的坐标系,对于本例,输入utm83-10。然后遵循第1部分:点特征中介绍的方法1或方法2。
添加线路建设者变压器to the canvas connecting it to either the CSV reader or the VertexCreator depending on the method you chose to get the points.在linebuilder参数中,将connection break属性设置为line。This tells the LineBuilder to stop connecting the points together when the LINE attribute changes.这将导致本例中出现三条不同的行。If your lines are not coming out as expected,可能需要按特定属性排序,以便使用Sorter.
亚搏在线
Results
使用三种方法中的任何一种和线路生成器变压器输出线路
To get polygon features it is the same method to get line features.In a workspace,add a CSV Reader and add the NeighborhoodNames.csv file,设置适当的坐标系,在此示例中,输入ll84。然后遵循第1部分:点特征中介绍的方法1或方法2。Add a LineBuilder transformer to the canvas connecting it to either the CSV reader or the VertexCreator depending on the method you chose to get the points.在linebuilder参数中,set the Connection Break Attribute to NeighbourhoodName.If the last point is the same as the first then a polygon is automatically created.
亚搏在线
Results
使用三种方法中的任何一种和一个linebuilder转换器输出多边形
Data Attribution
此处使用的数据源于温哥华市,British Columbia.It contains information licensed under the Open Government License - Vancouver.
© 2019 亚搏在线Safe Software Inc |Legal