Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update axis labels on plot of cropped cloud. #15

Closed
bw4sz opened this issue Jul 10, 2018 · 2 comments
Closed

Update axis labels on plot of cropped cloud. #15

bw4sz opened this issue Jul 10, 2018 · 2 comments
Assignees
Labels
Projects

Comments

@bw4sz
Copy link
Collaborator

bw4sz commented Jul 10, 2018

I think the plot function needs to re-calculate the extent of the cloud.las.points objects before plotting. If you crop and then plot, the same extent is used?

Tile is here:
https://github.com/weecology/TreeSegmentation/blob/master/data/training/NEON_D03_OSBS_DP1_407000_3291000_classified_point_cloud.laz

import pyfor
from shapely import geometry

def createPolygon(xmin,xmax,ymin,ymax):
    '''
    Convert a pandas row into a polygon bounding box
    ''' 
    
    p1 = geometry.Point(xmin,ymax)
    p2 = geometry.Point(xmax,ymax)
    p3 = geometry.Point(xmax,ymin)
    p4 = geometry.Point(xmin,ymin)
    
    pointList = [p1, p2, p3, p4, p1]
    
    poly = geometry.Polygon([[p.x, p.y] for p in pointList])
    
    return poly

#Grab some coords.
window_xmin=407690.2
window_xmax=407715.2
window_ymin=3291477.2
window_ymax=3291452.2

#Create shapely polygon
poly=createPolygon(window_xmin, window_xmax, window_ymin, window_ymax)

#Read lidar tile
pc=pyfor.cloud.Cloud("/Users/ben/Documents/DeepForest/data/NEON_D03_OSBS_DP1_407000_3291000_classified_point_cloud.laz")

pc.filter(min = -5, max = 100, dim = "z")

#View result

image

#Clip to geographic extent
clipped=pc.clip(poly)

clipped.plot()

image

Version

(pyfor_env) MacBook-Pro:pyfor ben$ git log
commit a893ddb23d9192ea4f4b49d32ef1583ed6446dbe (HEAD -> master, origin/master, origin/HEAD)
Author: brycefrank <bryce.frank@oregonstate.edu>
Date:   Sat Jun 23 11:16:15 2018 -0700

    test data fix
@brycefrank
Copy link
Owner

Thanks, Ben. I am expecting to get to this next week along with a merge of 0.2.2 to master.

@brycefrank brycefrank added this to in progress in 0.2.2 Jul 12, 2018
@brycefrank
Copy link
Owner

Fixed in 0.2.2, was referencing the laspy header class, which does not update until written to (for many reasons). Raster.plot now references the pyfor cloud header.

x_ticks, y_ticks = np.rint(np.linspace(self.grid.las.min[0], self.grid.las.max[0], 3)), \

@brycefrank brycefrank moved this from in progress to done in 0.2.2 Jul 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
0.2.2
  
done
Development

No branches or pull requests

2 participants