How to use the laspy.util.Point function in laspy

To help you get started, we’ve selected a few laspy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github laspy / laspy / laspy / base.py View on Github external
def set_points(self, points):
        '''Set the point data for the file, using either a list of laspy.util.Point
        instances, or a numpy array of point data (as recieved from get_points).'''
        if isinstance(points, GeneratorType):
            points = list(points)
        if not self.has_point_records:
            self.has_point_records = True
            self.pad_file_for_point_recs(len(points))
        if isinstance(points[0], laspy.util.Point):
            self.data_provider._mmap[self.header.data_offset:self.data_provider._mmap.size()] = b"".join([x.pack() for x in points])
            self.data_provider.point_map()
        else:
             #self.data_provider._mmap[self.header.data_offset:self.data_provider._mmap.size()] = points.tostring()
             #self.data_provider._pmap["point"] = points["point"]
             self.data_provider._pmap[:] = points[:]
             #self.data_provider.point_map()
github laspy / laspy / laspy / file.py View on Github external
def write(self, pt):
        '''Writes the point to the file if it is append or write mode. LAS
        files are written sequentially starting from the first point (in pure
        write mode) or from the last point that exists (in append mode).

        :param pt: The point to write.
        :type pt: :obj:`laspy.util.Point` instance to write

        .. note::
            At this time, it is not possible to duck-type point objects and
            have them be written into the LAS file (from say numpy or
            something). You have to take care of this adaptation yourself.

        '''
        if not isinstance(pt, util.Point):
            raise util.LaspyException('cannot write %s, it must '
                                    'be of type laspy.point.Point' % pt)
        if self._mode != "r":
            #core.las.LASWriter_WritePoint(self.handle, pt.handle)
            pass
    def __enter__(self):
github laspy / laspy / laspy / base.py View on Github external
def get_point(self, index, nice=False):
        '''Return point object for point of number index / #legacy_api'''
        if index >= self.get_pointrecordscount():
            return
        self._current = index
        return(laspy.util.Point(self, self.get_raw_point(index), nice= nice))