neulab/docprompting-conala huggingface dataset:
statistics(refresh=False, approximate=False)  
Compute statistics on the pixel values of this band. The return value is a tuple with the following structure: (minimum, maximum, mean, standard deviation). If the approximate argument is set to True, the statistics may be computed based on overviews or a subset of image tiles. If the refresh argument is set to True, the statistics will be computed from the data directly, and the cache will be updated with the result. If a persistent cache value is found, that value is returned. For raster formats using Persistent Auxiliary Metadata (PAM) services, the statistics might be cached in an auxiliary file. In some cases this metadata might be out of sync with the pixel values or cause values from a previous call to be returned which don’t reflect the value of the approximate argument. In such cases, use the refresh argument to get updated values and store them in the cache. For empty bands (where all pixel values are “no data”), all statistics are returned as None. The statistics can also be retrieved directly by accessing the min, max, mean, and std properties.
std  
The standard deviation of all pixel values of the band (excluding the “no data” value).
bands  
List of all bands of the source, as GDALBand instances. >>> rst = GDALRaster({"width": 1, "height": 2, 'srid': 4326,
...                   "bands": [{"data": [0, 1]}, {"data": [2, 3]}]})
>>> len(rst.bands)
2
>>> rst.bands[1].data()
array([[ 2.,  3.]], dtype=float32)
driver  
The name of the GDAL driver used to handle the input file. For GDALRasters created from a file, the driver type is detected automatically. The creation of rasters from scratch is an in-memory raster by default ('MEM'), but can be altered as needed. For instance, use GTiff for a GeoTiff file. For a list of file types, see also the GDAL Raster Formats list. An in-memory raster is created through the following example: >>> GDALRaster({'width': 10, 'height': 10, 'srid': 4326}).driver.name
'MEM'
 A file based GeoTiff raster is created through the following example: >>> import tempfile
>>> rstfile = tempfile.NamedTemporaryFile(suffix='.tif')
>>> rst = GDALRaster({'driver': 'GTiff', 'name': rstfile.name, 'srid': 4326,
...                   'width': 255, 'height': 255, 'nr_of_bands': 1})
>>> rst.name
'/tmp/tmp7x9H4J.tif'           # The exact filename will be different on your computer
>>> rst.driver.name
'GTiff'
extent  
Extent (boundary values) of the raster source, as a 4-tuple (xmin, ymin, xmax, ymax) in the spatial reference system of the source. >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326})
>>> rst.extent
(0.0, -20.0, 10.0, 0.0)
>>> rst.origin.x = 100
>>> rst.extent
(100.0, -20.0, 110.0, 0.0)
geotransform  
The affine transformation matrix used to georeference the source, as a tuple of six coefficients which map pixel/line coordinates into georeferenced space using the following relationship: Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2)
Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5)
 The same values can be retrieved by accessing the origin (indices 0 and 3), scale (indices 1 and 5) and skew (indices 2 and 4) properties. The default is [0.0, 1.0, 0.0, 0.0, 0.0, -1.0]. >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326})
>>> rst.geotransform
[0.0, 1.0, 0.0, 0.0, 0.0, -1.0]
height  
The height of the source in pixels (Y-axis). >>> GDALRaster({'width': 10, 'height': 20, 'srid': 4326}).height
20
info  
Returns a string with a summary of the raster. This is equivalent to the gdalinfo command line utility.
is_vsi_based  
A boolean indicating if this raster is stored in GDAL’s virtual filesystem.
metadata  
The metadata of this raster, represented as a nested dictionary. The first-level key is the metadata domain. The second-level contains the metadata item names and values from each domain. To set or update a metadata item, pass the corresponding metadata item to the method using the nested structure described above. Only keys that are in the specified dictionary are updated; the rest of the metadata remains unchanged. To remove a metadata item, use None as the metadata value. >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326})
>>> rst.metadata
{}
>>> rst.metadata = {'DEFAULT': {'OWNER': 'Django', 'VERSION': '1.0'}}
>>> rst.metadata
{'DEFAULT': {'OWNER': 'Django', 'VERSION': '1.0'}}
>>> rst.metadata = {'DEFAULT': {'OWNER': None, 'VERSION': '2.0'}}
>>> rst.metadata
{'DEFAULT': {'VERSION': '2.0'}}
name  
The name of the source which is equivalent to the input file path or the name provided upon instantiation. >>> GDALRaster({'width': 10, 'height': 10, 'name': 'myraster', 'srid': 4326}).name
'myraster'
origin  
Coordinates of the top left origin of the raster in the spatial reference system of the source, as a point object with x and y members. >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326})
>>> rst.origin
[0.0, 0.0]
>>> rst.origin.x = 1
>>> rst.origin
[1.0, 0.0]
scale  
Pixel width and height used for georeferencing the raster, as a point object with x and y members. See geotransform for more information. >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326})
>>> rst.scale
[1.0, -1.0]
>>> rst.scale.x = 2
>>> rst.scale
[2.0, -1.0]
skew  
Skew coefficients used to georeference the raster, as a point object with x and y members. In case of north up images, these coefficients are both 0. >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326})
>>> rst.skew
[0.0, 0.0]
>>> rst.skew.x = 3
>>> rst.skew
[3.0, 0.0]
srid  
The Spatial Reference System Identifier (SRID) of the raster. This property is a shortcut to getting or setting the SRID through the srs attribute. >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326})
>>> rst.srid
4326
>>> rst.srid = 3086
>>> rst.srid
3086
>>> rst.srs.srid  # This is equivalent
3086
srs  
The spatial reference system of the raster, as a SpatialReference instance. The SRS can be changed by setting it to an other SpatialReference or providing any input that is accepted by the SpatialReference constructor. >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326})
>>> rst.srs.srid
4326
>>> rst.srs = 3086
>>> rst.srs.srid
3086
transform(srs, driver=None, name=None, resampling='NearestNeighbour', max_error=0.0)  
Transforms this raster to a different spatial reference system (srs), which may be a SpatialReference object, or any other input accepted by SpatialReference (including spatial reference WKT and PROJ strings, or an integer SRID). It calculates the bounds and scale of the current raster in the new spatial reference system and warps the raster using the warp function. By default, the driver of the source raster is used and the name of the raster is the original name appended with '_copy' + source_driver_name. A different driver or name can be specified with the driver and name arguments. The default resampling algorithm is NearestNeighbour but can be changed using the resampling argument. The default maximum allowed error for resampling is 0.0 and can be changed using the max_error argument. Consult the warp documentation for detail on those arguments. >>> rst = GDALRaster({
...     "width": 6, "height": 6, "srid": 3086,
...     "origin": [500000, 400000],
...     "scale": [100, -100],
...     "bands": [{"data": range(36), "nodata_value": 99}]
... })
>>> target_srs = SpatialReference(4326)
>>> target = rst.transform(target_srs)
>>> target.origin
[-82.98492744885776, 27.601924753080144]
  Changed in Django 3.2: Support for SpatialReference srs was added
vsi_buffer  
A bytes representation of this raster. Returns None for rasters that are not stored in GDAL’s virtual filesystem.
warp(ds_input, resampling='NearestNeighbour', max_error=0.0)  
Returns a warped version of this raster. The warping parameters can be specified through the ds_input argument. The use of ds_input is analogous to the corresponding argument of the class constructor. It is a dictionary with the characteristics of the target raster. Allowed dictionary key values are width, height, SRID, origin, scale, skew, datatype, driver, and name (filename). By default, the warp functions keeps most parameters equal to the values of the original source raster, so only parameters that should be changed need to be specified. Note that this includes the driver, so for file-based rasters the warp function will create a new raster on disk. The only parameter that is set differently from the source raster is the name. The default value of the raster name is the name of the source raster appended with '_copy' + source_driver_name. For file-based rasters it is recommended to provide the file path of the target raster. The resampling algorithm used for warping can be specified with the resampling argument. The default is NearestNeighbor, and the other allowed values are Bilinear, Cubic, CubicSpline, Lanczos, Average, and Mode. The max_error argument can be used to specify the maximum error measured in input pixels that is allowed in approximating the transformation. The default is 0.0 for exact calculations. For users familiar with GDAL, this function has a similar functionality to the gdalwarp command-line utility. For example, the warp function can be used for aggregating a raster to the double of its original pixel scale: >>> rst = GDALRaster({
...     "width": 6, "height": 6, "srid": 3086,
...     "origin": [500000, 400000],
...     "scale": [100, -100],
...     "bands": [{"data": range(36), "nodata_value": 99}]
... })
>>> target = rst.warp({"scale": [200, -200], "width": 3, "height": 3})
>>> target.bands[0].data()
array([[  7.,   9.,  11.],
       [ 19.,  21.,  23.],
       [ 31.,  33.,  35.]], dtype=float32)
width  
The width of the source in pixels (X-axis). >>> GDALRaster({'width': 10, 'height': 20, 'srid': 4326}).width
10
class GeometryCollection  
 
add(geom) 
 Adds a geometry to this geometry collection. Not applicable to other geometry types.
class LineString  
 
x 
 Returns a list of X coordinates in this line: >>> OGRGeometry('LINESTRING (1 2,3 4)').x
[1.0, 3.0]
  
y 
 Returns a list of Y coordinates in this line: >>> OGRGeometry('LINESTRING (1 2,3 4)').y
[2.0, 4.0]
  
z 
 Returns a list of Z coordinates in this line, or None if the line does not have Z coordinates: >>> OGRGeometry('LINESTRING (1 2 3,4 5 6)').z
[3.0, 6.0]
class OGRGeomType(type_input)  
This class allows for the representation of an OGR geometry type in any of several ways: >>> from django.contrib.gis.gdal import OGRGeomType
>>> gt1 = OGRGeomType(3)             # Using an integer for the type
>>> gt2 = OGRGeomType('Polygon')     # Using a string
>>> gt3 = OGRGeomType('POLYGON')     # It's case-insensitive
>>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects
True True
  
name 
 Returns a short-hand string form of the OGR Geometry type: >>> gt1.name
'Polygon'
  
num 
 Returns the number corresponding to the OGR geometry type: >>> gt1.num
3
  
django 
 Returns the Django field type (a subclass of GeometryField) to use for storing this OGR type, or None if there is no appropriate Django type: >>> gt1.django
'PolygonField'
class Point  
 
x 
 Returns the X coordinate of this point: >>> OGRGeometry('POINT (1 2)').x
1.0
  
y 
 Returns the Y coordinate of this point: >>> OGRGeometry('POINT (1 2)').y
2.0
  
z 
 Returns the Z coordinate of this point, or None if the point does not have a Z coordinate: >>> OGRGeometry('POINT (1 2 3)').z
3.0
class Polygon  
 
shell 
 Returns the shell or exterior ring of this polygon, as a LinearRing geometry.  
exterior_ring 
 An alias for shell.  
centroid 
 Returns a Point representing the centroid of this polygon.
class GeoIP2(path=None, cache=0, country=None, city=None)
fromfile(file_h)  
   
Parameters:

file_h (a Python file object or a string path to the file) – input file that contains spatial data  
Return type:
a GEOSGeometry corresponding to the spatial data in the file   Example: >>> from django.contrib.gis.geos import fromfile
>>> g = fromfile('/home/bob/geom.wkt')
fromstr(string, srid=None)  
   
Parameters:

 
string (str) – string that contains spatial data 
srid (int) – spatial reference identifier    
Return type:

a GEOSGeometry corresponding to the spatial data in the string    fromstr(string, srid) is equivalent to GEOSGeometry(string, srid). Example: >>> from django.contrib.gis.geos import fromstr
>>> pnt = fromstr('POINT(-90.5 29.5)', srid=4326)
class GeometryCollection(*args, **kwargs)  
GeometryCollection objects may be instantiated by passing in other GEOSGeometry as arguments, or a single sequence of GEOSGeometry objects: >>> poly = Polygon( ((0, 0), (0, 1), (1, 1), (0, 0)) )
>>> gc = GeometryCollection(Point(0, 0), MultiPoint(Point(0, 0), Point(1, 1)), poly)
>>> gc = GeometryCollection((Point(0, 0), MultiPoint(Point(0, 0), Point(1, 1)), poly))
class GEOSGeometry(geo_input, srid=None)  
   
Parameters:

 
geo_input – Geometry input value (string or buffer) 
srid (int) – spatial reference identifier
GEOSGeometry.boundary  
Returns the boundary as a newly allocated Geometry object.
GEOSGeometry.buffer(width, quadsegs=8)  
Returns a GEOSGeometry that represents all points whose distance from this geometry is less than or equal to the given width. The optional quadsegs keyword sets the number of segments used to approximate a quarter circle (defaults is 8).
GEOSGeometry.buffer_with_style(width, quadsegs=8, end_cap_style=1, join_style=1, mitre_limit=5.0)  
Same as buffer(), but allows customizing the style of the buffer.  
end_cap_style can be round (1), flat (2), or square (3). 
join_style can be round (1), mitre (2), or bevel (3). Mitre ratio limit (mitre_limit) only affects mitered join style.
GEOSGeometry.centroid  
Returns a Point object representing the geometric center of the geometry. The point is not guaranteed to be on the interior of the geometry.
GEOSGeometry.clone()  
This method returns a GEOSGeometry that is a clone of the original.
GEOSGeometry.contains(other)  
Returns True if other.within(this) returns True.
GEOSGeometry.convex_hull  
Returns the smallest Polygon that contains all the points in the geometry.
GEOSGeometry.covers(other)  
Returns True if this geometry covers the specified geometry. The covers predicate has the following equivalent definitions:  Every point of the other geometry is a point of this geometry. The DE-9IM Intersection Matrix for the two geometries is T*****FF*, *T****FF*, ***T**FF*, or ****T*FF*.  If either geometry is empty, returns False. This predicate is similar to GEOSGeometry.contains(), but is more inclusive (i.e. returns True for more cases). In particular, unlike contains() it does not distinguish between points in the boundary and in the interior of geometries. For most situations, covers() should be preferred to contains(). As an added benefit, covers() is more amenable to optimization and hence should outperform contains().
GEOSGeometry.crosses(other)  
Returns True if the DE-9IM intersection matrix for the two Geometries is T*T****** (for a point and a curve,a point and an area or a line and an area) 0******** (for two curves).
GEOSGeometry.difference(other)  
Returns a GEOSGeometry representing the points making up this geometry that do not make up other.
GEOSGeometry.dims  
Returns the dimension of the geometry:  
0 for Points and MultiPoints 
1 for LineStrings and MultiLineStrings 
2 for Polygons and MultiPolygons 
-1 for empty GeometryCollections the maximum dimension of its elements for non-empty GeometryCollections
GEOSGeometry.disjoint(other)  
Returns True if the DE-9IM intersection matrix for the two geometries is FF*FF****.
GEOSGeometry.distance(geom)  
Returns the distance between the closest points on this geometry and the given geom (another GEOSGeometry object).  Note GEOS distance calculations are linear – in other words, GEOS does not perform a spherical calculation even if the SRID specifies a geographic coordinate system.
GEOSGeometry.empty  
Returns whether or not the set of points in the geometry is empty.
GEOSGeometry.envelope  
Returns a Polygon that represents the bounding envelope of this geometry. Note that it can also return a Point if the input geometry is a point.
GEOSGeometry.equals(other)  
Returns True if the DE-9IM intersection matrix for the two geometries is T*F**FFF*.
GEOSGeometry.equals_exact(other, tolerance=0)  
Returns true if the two geometries are exactly equal, up to a specified tolerance. The tolerance value should be a floating point number representing the error tolerance in the comparison, e.g., poly1.equals_exact(poly2, 0.001) will compare equality to within one thousandth of a unit.
GEOSGeometry.ewkb  
Return the EWKB representation of this Geometry as a Python buffer. This is an extension of the WKB specification that includes any SRID value that are a part of this geometry.
GEOSGeometry.ewkt  
Returns the “extended” Well-Known Text of the geometry. This representation is specific to PostGIS and is a superset of the OGC WKT standard. [1] Essentially the SRID is prepended to the WKT representation, for example SRID=4326;POINT(5 23).  Note The output from this property does not include the 3dm, 3dz, and 4d information that PostGIS supports in its EWKT representations.
GEOSGeometry.extent  
This property returns the extent of this geometry as a 4-tuple, consisting of (xmin, ymin, xmax, ymax).
GEOSGeometry.geojson  
Alias for GEOSGeometry.json.
GEOSGeometry.geom_type  
Returns a string corresponding to the type of geometry. For example: >>> pnt = GEOSGeometry('POINT(5 23)')
>>> pnt.geom_type
'Point'
GEOSGeometry.geom_typeid  
Returns the GEOS geometry type identification number. The following table shows the value for each geometry type:   
Geometry ID   
Point 0  
LineString 1  
LinearRing 2  
Polygon 3  
MultiPoint 4  
MultiLineString 5  
MultiPolygon 6  
GeometryCollection 7
GEOSGeometry.hasz  
Returns a boolean indicating whether the geometry is three-dimensional.
GEOSGeometry.hex  
Returns the WKB of this Geometry in hexadecimal form. Please note that the SRID value is not included in this representation because it is not a part of the OGC specification (use the GEOSGeometry.hexewkb property instead).
GEOSGeometry.hexewkb  
Returns the EWKB of this Geometry in hexadecimal form. This is an extension of the WKB specification that includes the SRID value that are a part of this geometry.
GEOSGeometry.interpolate_normalized(distance)  
Given a distance (float), returns the point (or closest point) within the geometry (LineString or MultiLineString) at that distance. The normalized version takes the distance as a float between 0 (origin) and 1 (endpoint). Reverse of GEOSGeometry.project().
GEOSGeometry.intersection(other)  
Returns a GEOSGeometry representing the points shared by this geometry and other.
GEOSGeometry.intersects(other)  
Returns True if GEOSGeometry.disjoint() is False.
GEOSGeometry.json  
Returns the GeoJSON representation of the geometry. Note that the result is not a complete GeoJSON structure but only the geometry key content of a GeoJSON structure. See also GeoJSON Serializer.
GEOSGeometry.kml  
Returns a KML (Keyhole Markup Language) representation of the geometry. This should only be used for geometries with an SRID of 4326 (WGS84), but this restriction is not enforced.
GEOSGeometry.length  
Returns the length of this geometry (e.g., 0 for a Point, the length of a LineString, or the circumference of a Polygon).
GEOSGeometry.normalize()  
Converts this geometry to canonical form: >>> g = MultiPoint(Point(0, 0), Point(2, 2), Point(1, 1))
>>> print(g)
MULTIPOINT (0 0, 2 2, 1 1)
>>> g.normalize()
>>> print(g)
MULTIPOINT (2 2, 1 1, 0 0)
GEOSGeometry.num_coords  
Returns the number of coordinates in the geometry.
GEOSGeometry.num_geom  
Returns the number of geometries in this geometry. In other words, will return 1 on anything but geometry collections.
GEOSGeometry.ogr  
Returns an OGRGeometry object corresponding to the GEOS geometry.
GEOSGeometry.overlaps(other)  
Returns true if the DE-9IM intersection matrix for the two geometries is T*T***T** (for two points or two surfaces) 1*T***T** (for two curves).
GEOSGeometry.point_on_surface  
Computes and returns a Point guaranteed to be on the interior of this geometry.
GEOSGeometry.prepared  
Returns a GEOS PreparedGeometry for the contents of this geometry. PreparedGeometry objects are optimized for the contains, intersects, covers, crosses, disjoint, overlaps, touches and within operations. Refer to the Prepared Geometries documentation for more information.
GEOSGeometry.project_normalized(point)  
Returns the distance (float) from the origin of the geometry (LineString or MultiLineString) to the point projected on the geometry (that is to a point of the line the closest to the given point). The normalized version returns the distance as a float between 0 (origin) and 1 (endpoint). Reverse of GEOSGeometry.interpolate().
GEOSGeometry.relate(other)  
Returns the DE-9IM intersection matrix (a string) representing the topological relationship between this geometry and the other.
GEOSGeometry.relate_pattern(other, pattern)  
Returns True if the elements in the DE-9IM intersection matrix for this geometry and the other matches the given pattern – a string of nine characters from the alphabet: {T, F, *, 0}.
GEOSGeometry.ring  
Returns a boolean indicating whether the geometry is a LinearRing.
GEOSGeometry.simple  
Returns a boolean indicating whether the geometry is ‘simple’. A geometry is simple if and only if it does not intersect itself (except at boundary points). For example, a LineString object is not simple if it intersects itself. Thus, LinearRing and Polygon objects are always simple because they do cannot intersect themselves, by definition.
GEOSGeometry.simplify(tolerance=0.0, preserve_topology=False)  
Returns a new GEOSGeometry, simplified to the specified tolerance using the Douglas-Peucker algorithm. A higher tolerance value implies fewer points in the output. If no tolerance is provided, it defaults to 0. By default, this function does not preserve topology. For example, Polygon objects can be split, be collapsed into lines, or disappear. Polygon holes can be created or disappear, and lines may cross. By specifying preserve_topology=True, the result will have the same dimension and number of components as the input; this is significantly slower, however.
GEOSGeometry.srid  
Property that may be used to retrieve or set the SRID associated with the geometry. For example: >>> pnt = Point(5, 23)
>>> print(pnt.srid)
None
>>> pnt.srid = 4326
>>> pnt.srid
4326
GEOSGeometry.srs  
Returns a SpatialReference object corresponding to the SRID of the geometry or None.
GEOSGeometry.sym_difference(other)  
Returns a GEOSGeometry combining the points in this geometry not in other, and the points in other not in this geometry.
GEOSGeometry.touches(other)  
Returns True if the DE-9IM intersection matrix for the two geometries is FT*******, F**T***** or F***T****.
GEOSGeometry.transform(ct, clone=False)  
Transforms the geometry according to the given coordinate transformation parameter (ct), which may be an integer SRID, spatial reference WKT string, a PROJ string, a SpatialReference object, or a CoordTransform object. By default, the geometry is transformed in-place and nothing is returned. However if the clone keyword is set, then the geometry is not modified and a transformed clone of the geometry is returned instead.  Note Raises GEOSException if GDAL is not available or if the geometry’s SRID is None or less than 0. It doesn’t impose any constraints on the geometry’s SRID if called with a CoordTransform object.
GEOSGeometry.unary_union  
Computes the union of all the elements of this geometry. The result obeys the following contract:  Unioning a set of LineStrings has the effect of fully noding and dissolving the linework. Unioning a set of Polygons will always return a Polygon or MultiPolygon geometry (unlike GEOSGeometry.union(), which may return geometries of lower dimension if a topology collapse occurs).
GEOSGeometry.union(other)  
Returns a GEOSGeometry representing all the points in this geometry and the other.
GEOSGeometry.valid_reason  
Returns a string describing the reason why a geometry is invalid.
GEOSGeometry.within(other)  
Returns True if the DE-9IM intersection matrix for the two geometries is T*F**F***.