Exemplo n.º 1
0
 def Union(self, geom):
     """
     Method to calculate the geometric union of two geometries.
     :param geom: Geometry to calculate union against
     :return: Either Polygon or MultiPolygon class depending if output geometry intersects itself.
     """
     return pg.OpenGeometry(self.geom.Union(geom), self.gtype)
Exemplo n.º 2
0
 def Buffer(self, dist):
     """
     Method to calculate the buffer of a geometry.
     :param dist: Buffer distance to apply.  Determines the width of the buffer.
     :return: Either Polygon or MultiPolygon class depending if output buffer intersects itself.
     """
     return pg.OpenGeometry(self.geom.Buffer(dist), self.gtype)
Exemplo n.º 3
0
 def Reproject(self, in_epsg, out_epsg):
     """
     Method to reproject a geometry from one EPSG to another
     :param in_epsg: Initial EPSG of geometry.
     :param out_epsg: Desired output EPSG.
     :return: Geometry class containing the reprojected geometry.
     """
     transform = createTransformer(in_epsg, out_epsg)
     proj_geom = self.geom.Clone()
     proj_geom.Transform(transform)
     return pg.OpenGeometry(proj_geom, self.gtype)
Exemplo n.º 4
0
    def ReprojectFast(self, transformer):
        """
        Optimized method for the bulk reprojection and on-the-fly reprojection of geometries.  Allows the user to pass
        in an osr.CoordinateTransformation() object which avoids recreating the object in each call (see Reproject).  This method
        is exponentially faster than Reproject() when used in a for loop and should be used when speed is a concern.

        :param transformer: osr.CoordinateTransformation() object determining the projection.  The function createTransformer()
                            provides an easy way of generating an osr.CoordinateTransformation() object.
        :return: Geometry class containing the reprojected geometry
        """
        proj_geom = self.geom.Clone()
        proj_geom.Transform(transformer)
        return pg.OpenGeometry(proj_geom, self.gtype)
Exemplo n.º 5
0
 def SimplifyPreserveTopology(self, tolerance):
     return pg.OpenGeometry(self.geom.SimplifyPreserveTopology(tolerance),
                            self.gtype)
Exemplo n.º 6
0
 def Simplify(self, tolerance):
     return pg.OpenGeometry(self.geom.Simplify(tolerance), self.gtype)
Exemplo n.º 7
0
 def Intersection(self, geom):
     return pg.OpenGeometry(self.geom.Intersection(geom), self.gtype)
Exemplo n.º 8
0
 def SymmetricDifference(self, geom):
     return pg.OpenGeometry(self.geom.SymmetricDifference(geom), self.gtype)