Working with Python 3.6 (Anaconda) under Windows using a laspy fork that works with Python 3 (https://github.com/sethrh/laspy).
I am loading a LAS file to a GeoPandas GeoDataFrame to eventually perform a spatial join (using sjoin) with a polygon layer. I am sure there is a more elegant way to do what I am doing using the kludge below:
import numpy as np
from laspy.file import File
from pandas import DataFrame
from geopandas import GeoDataFrame
from shapely.geometry import Point
#Read LAS file
inFile = File("s428_7568.las", mode = "r")
#Import LAS into numpy array (X=raw integer value x=scaled float value)
lidar_points = np.array((inFile.x,inFile.y,inFile.z,inFile.intensity,
inFile.raw_classification,inFile.scan_angle_rank)).transpose()
#Transform to pandas DataFrame
lidar_df=DataFrame(lidar_points)
#Transform to geopandas GeoDataFrame
crs = None
geometry = [Point(xyz) for xyz in zip(inFile.x,inFile.y,inFile.z)]
lidar_geodf = GeoDataFrame(lidar_df, crs=crs, geometry=geometry)
lidar_geodf.crs = {'init' :'epsg:2959'} # set correct spatial reference
So, is there a better way, more efficient, more pythonesque way of injecting the .las file points (from laspy) to the GeoPandas dataframe without passing through a numpy array?