Esempio n. 1
0
    return double_output(f, [c_void_p, c_int])


def topology_func(f):
    f.argtypes = [c_void_p, c_void_p]
    f.restype = c_int
    f.errchck = bool
    return f


# ### OGR_G ctypes function prototypes ###

# GeoJSON routines.
from_json = geom_output(lgdal.OGR_G_CreateGeometryFromJson, [c_char_p])
to_json = string_output(lgdal.OGR_G_ExportToJson, [c_void_p],
                        str_result=True,
                        decoding='ascii')
to_kml = string_output(lgdal.OGR_G_ExportToKML, [c_void_p, c_char_p],
                       str_result=True,
                       decoding='ascii')

# GetX, GetY, GetZ all return doubles.
getx = pnt_func(lgdal.OGR_G_GetX)
gety = pnt_func(lgdal.OGR_G_GetY)
getz = pnt_func(lgdal.OGR_G_GetZ)

# Geometry creation routines.
from_wkb = geom_output(
    lgdal.OGR_G_CreateFromWkb,
    [c_char_p, c_void_p, POINTER(c_void_p), c_int],
    offset=-2)
Esempio n. 2
0
    "For accessing point information."
    return double_output(f, [c_void_p, c_int])


def topology_func(f):
    f.argtypes = [c_void_p, c_void_p]
    f.restype = c_int
    f.errchck = check_bool
    return f

### OGR_G ctypes function prototypes ###

# GeoJSON routines, if supported.
if GEOJSON:
    from_json = geom_output(lgdal.OGR_G_CreateGeometryFromJson, [c_char_p])
    to_json = string_output(lgdal.OGR_G_ExportToJson, [c_void_p], str_result=True)
    to_kml = string_output(lgdal.OGR_G_ExportToKML, [c_void_p, c_char_p], str_result=True)
else:
    from_json = False
    to_json = False
    to_kml = False

# GetX, GetY, GetZ all return doubles.
getx = pnt_func(lgdal.OGR_G_GetX)
gety = pnt_func(lgdal.OGR_G_GetY)
getz = pnt_func(lgdal.OGR_G_GetZ)

# Geometry creation routines.
from_wkb = geom_output(lgdal.OGR_G_CreateFromWkb, [c_char_p, c_void_p, POINTER(c_void_p), c_int], offset=-2)
from_wkt = geom_output(lgdal.OGR_G_CreateFromWkt, [POINTER(c_char_p), c_void_p, POINTER(c_void_p)], offset=-1)
create_geom = geom_output(lgdal.OGR_G_CreateGeometry, [c_int])
Esempio n. 3
0
                              [c_void_p, c_char_p])

# Morphing to/from ESRI WKT.
morph_to_esri = void_output(lgdal.OSRMorphToESRI, [c_void_p])
morph_from_esri = void_output(lgdal.OSRMorphFromESRI, [c_void_p])

# Identifying the EPSG
identify_epsg = void_output(lgdal.OSRAutoIdentifyEPSG, [c_void_p])

# Getting the angular_units, linear_units functions
linear_units = units_func(lgdal.OSRGetLinearUnits)
angular_units = units_func(lgdal.OSRGetAngularUnits)

# For exporting to WKT, PROJ.4, "Pretty" WKT, and XML.
to_wkt = string_output(std_call('OSRExportToWkt'),
                       [c_void_p, POINTER(c_char_p)],
                       decoding='utf-8')
to_proj = string_output(std_call('OSRExportToProj4'),
                        [c_void_p, POINTER(c_char_p)],
                        decoding='ascii')
to_pretty_wkt = string_output(std_call('OSRExportToPrettyWkt'),
                              [c_void_p, POINTER(c_char_p), c_int],
                              offset=-2,
                              decoding='utf-8')

# Memory leak fixed in GDAL 1.5; still exists in 1.4.
to_xml = string_output(lgdal.OSRExportToXML,
                       [c_void_p, POINTER(c_char_p), c_char_p],
                       offset=-2,
                       decoding='utf-8')
Esempio n. 4
0
from_xml = void_output(lgdal.OSRImportFromXML, [c_void_p, c_char_p])
from_user_input = void_output(std_call('OSRSetFromUserInput'), [c_void_p, c_char_p])

# Morphing to/from ESRI WKT.
morph_to_esri = void_output(lgdal.OSRMorphToESRI, [c_void_p])
morph_from_esri = void_output(lgdal.OSRMorphFromESRI, [c_void_p])

# Identifying the EPSG
identify_epsg = void_output(lgdal.OSRAutoIdentifyEPSG, [c_void_p])

# Getting the angular_units, linear_units functions
linear_units = units_func(lgdal.OSRGetLinearUnits)
angular_units = units_func(lgdal.OSRGetAngularUnits)

# For exporting to WKT, PROJ.4, "Pretty" WKT, and XML.
to_wkt = string_output(std_call('OSRExportToWkt'), [c_void_p, POINTER(c_char_p)], decoding='utf-8')
to_proj = string_output(std_call('OSRExportToProj4'), [c_void_p, POINTER(c_char_p)], decoding='ascii')
to_pretty_wkt = string_output(
    std_call('OSRExportToPrettyWkt'),
    [c_void_p, POINTER(c_char_p), c_int], offset=-2, decoding='utf-8'
)

# Memory leak fixed in GDAL 1.5; still exists in 1.4.
to_xml = string_output(lgdal.OSRExportToXML, [c_void_p, POINTER(c_char_p), c_char_p], offset=-2, decoding='utf-8')

# String attribute retrival routines.
get_attr_value = const_string_output(std_call('OSRGetAttrValue'), [c_void_p, c_char_p, c_int], decoding='utf-8')
get_auth_name = const_string_output(lgdal.OSRGetAuthorityName, [c_void_p, c_char_p], decoding='ascii')
get_auth_code = const_string_output(lgdal.OSRGetAuthorityCode, [c_void_p, c_char_p], decoding='ascii')

# SRS Properties
Esempio n. 5
0
from_user_input = void_output(std_call("OSRSetFromUserInput"), [c_void_p, c_char_p])

# Morphing to/from ESRI WKT.
morph_to_esri = void_output(lgdal.OSRMorphToESRI, [c_void_p])
morph_from_esri = void_output(lgdal.OSRMorphFromESRI, [c_void_p])

# Identifying the EPSG
identify_epsg = void_output(lgdal.OSRAutoIdentifyEPSG, [c_void_p])

# Getting the angular_units, linear_units functions
linear_units = units_func(lgdal.OSRGetLinearUnits)
angular_units = units_func(lgdal.OSRGetAngularUnits)

# For exporting to WKT, PROJ.4, "Pretty" WKT, and XML.
to_wkt = string_output(
    std_call("OSRExportToWkt"), [c_void_p, POINTER(c_char_p)], decoding="utf-8"
)
to_proj = string_output(
    std_call("OSRExportToProj4"), [c_void_p, POINTER(c_char_p)], decoding="ascii"
)
to_pretty_wkt = string_output(
    std_call("OSRExportToPrettyWkt"),
    [c_void_p, POINTER(c_char_p), c_int],
    offset=-2,
    decoding="utf-8",
)

# Memory leak fixed in GDAL 1.5; still exists in 1.4.
to_xml = string_output(
    lgdal.OSRExportToXML,
    [c_void_p, POINTER(c_char_p), c_char_p],
Esempio n. 6
0
def to_gml3(OGRGeom):
    gml3_capi = string_output(lgdal.OGR_G_ExportToGMLEx, [c_void_p, POINTER(c_char_p)], str_result=True, decoding='ascii')
    return gml3_capi(OGRGeom.ptr,byref(c_char_p('FORMAT=GML3'.encode())))
Esempio n. 7
0
    return double_output(f, [c_void_p, c_int])


def topology_func(f):
    f.argtypes = [c_void_p, c_void_p]
    f.restype = c_int
    f.errchck = check_bool
    return f


### OGR_G ctypes function prototypes ###

# GeoJSON routines, if supported.
if GEOJSON:
    from_json = geom_output(lgdal.OGR_G_CreateGeometryFromJson, [c_char_p])
    to_json = string_output(lgdal.OGR_G_ExportToJson, [c_void_p],
                            str_result=True)
else:
    from_json = False
    to_json = False

# GetX, GetY, GetZ all return doubles.
getx = pnt_func(lgdal.OGR_G_GetX)
gety = pnt_func(lgdal.OGR_G_GetY)
getz = pnt_func(lgdal.OGR_G_GetZ)

# Geometry creation routines.
from_wkb = geom_output(
    lgdal.OGR_G_CreateFromWkb,
    [c_char_p, c_void_p, POINTER(c_void_p), c_int],
    offset=-2)
from_wkt = geom_output(lgdal.OGR_G_CreateFromWkt,
Esempio n. 8
0
def to_gml3(OGRGeom):
    gml3_capi = string_output(lgdal.OGR_G_ExportToGMLEx,
                              [c_void_p, POINTER(c_char_p)],
                              str_result=True,
                              decoding='ascii')
    return gml3_capi(OGRGeom.ptr, byref(c_char_p('FORMAT=GML3'.encode())))