How to use the laspy.base.Writer 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 / file.py View on Github external
if self._header is None:
                raise util.LaspyException("Creation of a file in write mode requires a header object.")  
            if isinstance(self._header,  header.HeaderManager):
                vlrs = self._header.vlrs
                evlrs = self._header.evlrs
                self._header = self._header.copy() 
                if self._vlrs != False:
                    self._vlrs.extend(vlrs)
                else:
                    self._vlrs = vlrs
                if self._evlrs != False:
                    self._evlrs.extend(evlrs)
                else:
                    self._evlrs = evlrs

            self._writer = base.Writer(self.filename, mode = "w",
                                      header = self._header, 
                                      vlrs = self._vlrs, evlrs = self._evlrs)
            self._reader = self._writer
            ## Wire up API for any extra Dimensions
            if self._writer.extra_dimensions != []:
                for dimension in self._writer.extra_dimensions:
                    dimname = dimension.name.decode().replace("\x00", "").replace(" ", "_").lower()
                    self.addProperty(dimname) 

        elif self._mode == 'w+':
            raise NotImplementedError
        else:
            raise util.LaspyException("Mode %s not supported" % self._mode)

        if self._reader.compressed and self._mode not in ("r", "r-"):
            raise NotImplementedError("Compressed files / buffer objects can only be opened in mode 'r' for now")
github laspy / laspy / laspy / base.py View on Github external
def close(self, ignore_header_changes = False, minmax_mode = "scaled"):
        '''Flush changes to mmap and close mmap and fileref'''
        if (not ignore_header_changes) and (self.has_point_records):
            if not self._header_current:
                self.header.update_histogram()
            self.header.update_min_max(minmax_mode)
        super(Writer, self).close()