Cityengine uses Python scripts to export roads by feature

Source: Internet
Author: User

In cityengine, there are two options for road export:

Use File Size Limit: export the selected path as an OBJ file

Create one: route the selected road to a network node. Each line segment is exported as an obj.

 

Neither of the preceding two export methods can export a complete path as an OBJ file, that is, the path cannot be exported as an independent model file according to feature.

 

To export the path by feature, you need to use the Python script in cityengine for custom export.

1. Export a single Road Based on the road name

1. Add the name field to the Road Layer attribute data. The type is text.

2. assign a value to the name field (non-Chinese)

3. Generate a road model

4. Create a script file and edit it as follows:

Parameter description:

The Union in CE. withname ("'Union '") is the name of the road.

Name is the name of the exported model file.

D:/tmp is the export path

 

5. Select a model, file ---- export models of selected shapes (allmodels are generated), select script based Export (Python), and finally select a script in MISC options.

6. Click Finish to export the model.

2. Export all data based on the road name

 

The actual data processing method is as follows:

1. Assign the name field added to the road GIS data to its FID, reload the network data, and generate a model.

2. Modify the Python script:

28 in the range parameter is the number of roads + 1 (currently, the circular model is exported based on the number of roads)

3. Execute the preceding script to obtain the result.

Note:

1. The sample data used in this document is data ---- streets. SHP In the Pasadena project in the Tutorial:

2. The file name issue is not well resolved during batch export at the full graph layer in the second part. We need to continue to study more intelligent export scripts.

3. Some errors may occur in some situations.

This problem is temporarily analyzed as a data or script problem, but is not found in the 50 rows of the actual data test.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.