Posts

Showing posts with the label python

Creating a new field with attributes incrementing by 1

Image
pre-logic script code: rec=0 def autoIncrement( ):  global rec  pStart = 1   pInterval = 1   if (rec == 0):    rec = pStart   else:    rec = rec + pInterval   return rec

Minimizing my lidar velodyne point cloud

Image
I think I should be reminding myself how I did the timestamping of the point cloud data with that of the GPS. Here are the seemingly easy steps. I converted the GPS data from geographic lat, long, ht to an ECEF(Earth-centered-earth-fixed) cartesian coordinate system using this formula: The reason for conversion into cartesian is so that I can easily do the translation from our velodyne device to the GPS antenna. I used the WGS84 reference ellipsoid parameters for conversion.   a  = 6,378,137 m , 1/f=  6,356,752.3142  Now after I got all my coordinates in X, Y, Z, I matched the timestamps in the LIDAR packets as that of the timestamp provided by the GPS. I then performed some translation based on the structure of the vehicle mount that we have fabricated for the fieldwork. Now my data is in X,Y,Z and ready for plotting in a point cloud software. When I'm finally down with the timestamping of the LIDAR with GPS, I am now overwhelmed by the number of points ...

PYTHON CODE THAT ADDS A NEW FIELD TO A SHAPEFILE AND SPECIFIES ITS CONTENT

Arcpy class is new to ArcGIS 10.0. ArcPy is a site-package that builds on (and is a successor to) the successful arcgisscripting module. Its goal is to create the cornerstone for a useful and productive way to perform geographic data analysis, data conversion, data management, and map automation with Python. Here's a code that will add a new field to a shapefile and then specify the contents of the added field. In this case, all areas greater than 1000 square meters will be labelled "YES" meaning it is subdividable otherwise it will be "NOO". ********************************************************************************** import arcpy def cursor():     inFeatures = GetParameterAsText(0)     subdvdable = GetParameterAsText(1)     #inFeatures = "C:\\Users\\RS Lab\\Desktop\\222\\vector\\parcel_area.shp"     arcpy.AddField_management(inFeatures, subdvdable, "TEXT")     rows = arcpy.UpdateCursor(...