In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to create new feature data in python". In daily operation, I believe many people have doubts about how to create new feature data in python. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to create new feature data in python". Next, please follow the editor to study!
According to the coordinate information in the data service on the network, according to certain rules, it can be combined into a feature layer and saved locally, and the whole process only stores the data in a transformed form. However, this form of data can be easily opened and viewed by gis tools, such as arcmap,qgis, etc., and superimposed to view the effect.
Fiona and shapely libraries in python can deal with spatial data, see python Development: feature data processing, of course, you can also create a new feature layer based on the data.
There are some common formats such as ESRI Shapefile and geojson in the driver of fiona, so it is convenient to create a common format of feature data.
Shapely can convert lists, tuple data, into spatial coordinate format, and be compatible with coordinate storage in fiona.
Here is how to create a new feature data based on the sample code:
Define the structure of a data, the spatial geometry type of the data, support common spatial geometry types such as Point,Polyline,Polygon, etc. What is placed in properties is the attribute information of data, corresponding to the attribute information of each element.
Yourschema = {'geometry':' Point'
'properties': {'bx':' float:13.3'
'by': 'float:13.3'
'bline': 'str'}}
Create a new spatial data file, the type is w, represent the written data, and fill in the coordinate system information according to the actual situation. Driver can use shapefile,geojson and other common formats to input the above data structure.
With fiona.open ('file path', 'file path', crs=from_epsg (4326)
Driver='ESRI Shapefile',schema=yourschema) as output:
To write data, the attribute information should correspond to the structure defined above, and the coordinate information is defined by the function in shapely, and then written to the file through mapping.
Prop = {'bx': 13.2001
'by': 5.898989898
'bline': 'aaaaaa'
}
Point = Point (0,0)
Output.write ({'geometry': mapping (point),' properties': prop}) at this point, the study on "how to create new feature data in python" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.