<s> import re <EOL> from datetime import date <EOL> from ctypes import c_char , c_char_p , c_double , c_int , c_ubyte , c_void_p , POINTER <EOL> from django . contrib . gis . gdal . envelope import OGREnvelope <EOL> from django . contrib . gis . gdal . libgdal import lgdal , GEOJSON <EOL> from django . contrib . gis . gdal . prototypes . errcheck import check_bool , check_envelope <EOL> from django . contrib . gis . gdal . prototypes . generation import const_string_output , double_output , geom_output , int_output , srs_output , string_output , void_output <EOL> def env_func ( f , argtypes ) : <EOL> "<STR_LIT>" <EOL> f . argtypes = argtypes <EOL> f . restype = None <EOL> f . errcheck = check_envelope <EOL> return f <EOL> def pnt_func ( f ) : <EOL> "<STR_LIT>" <EOL> return double_output ( f , [ c_void_p , c_int ] ) <EOL> def topology_func ( f ) : <EOL> f . argtypes = [ c_void_p , c_void_p ] <EOL> f . restype = c_int <EOL> f . errchck = check_bool <EOL> return f <EOL> if GEOJSON : <EOL> from_json = geom_output ( lgdal . OGR_G_CreateGeometryFromJson , [ c_char_p ] ) <EOL> to_json = string_output ( lgdal . OGR_G_ExportToJson , [ c_void_p ] , str_result = True ) <EOL> to_kml = string_output ( lgdal . OGR_G_ExportToKML , [ c_void_p , c_char_p ] , str_result = True ) <EOL> else : <EOL> from_json = False <EOL> to_json = False <EOL> to_kml = False <EOL> getx = pnt_func ( lgdal . OGR_G_GetX ) <EOL> gety = pnt_func ( lgdal . OGR_G_GetY ) <EOL> getz = pnt_func ( lgdal . OGR_G_GetZ ) <EOL> from_wkb = geom_output ( lgdal . OGR_G_CreateFromWkb , [ c_char_p , c_void_p , POINTER ( c_void_p ) , c_int ] , offset = - <NUM_LIT:2> ) <EOL> from_wkt = geom_output ( lgdal . OGR_G_CreateFromWkt , [ POINTER ( c_char_p ) , c_void_p , POINTER ( c_void_p ) ] , offset = - <NUM_LIT:1> ) <EOL> create_geom = geom_output ( lgdal . OGR_G_CreateGeometry , [ c_int ] ) <EOL> clone_geom = geom_output ( lgdal . OGR_G_Clone , [ c_void_p ] ) <EOL> get_geom_ref = geom_output ( lgdal . OGR_G_GetGeometryRef , [ c_void_p , c_int ] ) <EOL> get_boundary = geom_output ( lgdal . OGR_G_GetBoundary , [ c_void_p ] ) <EOL> geom_convex_hull = geom_output ( lgdal . OGR_G_ConvexHull , [ c_void_p ] ) <EOL> geom_diff = geom_output ( lgdal . OGR_G_Difference , [ c_void_p , c_void_p ] ) <EOL> geom_intersection = geom_output ( lgdal . OGR_G_Intersection , [ c_void_p , c_void_p ] ) <EOL> geom_sym_diff = geom_output ( lgdal . OGR_G_SymmetricDifference , [ c_void_p , c_void_p ] ) <EOL> geom_union = geom_output ( lgdal . OGR_G_Union , [ c_void_p , c_void_p ] ) <EOL> add_geom = void_output ( lgdal . OGR_G_AddGeometry , [ c_void_p , c_void_p ] ) <EOL> import_wkt = void_output ( lgdal . OGR_G_ImportFromWkt , [ c_void_p , POINTER ( c_char_p ) ] ) <EOL> destroy_geom = void_output ( lgdal . OGR_G_DestroyGeometry , [ c_void_p ] , errcheck = False ) <EOL> to_wkb = void_output ( lgdal . OGR_G_ExportToWkb , None , errcheck = True ) <EOL> to_wkt = string_output ( lgdal . OGR_G_ExportToWkt , [ c_void_p , POINTER ( c_char_p ) ] ) <EOL> to_gml = string_output ( lgdal . OGR_G_ExportToGML , [ c_void_p ] , str_result = True ) <EOL> get_wkbsize = int_output ( lgdal . OGR_G_WkbSize , [ c_void_p ] ) <EOL> assign_srs = void_output ( lgdal . OGR_G_AssignSpatialReference , [ c_void_p , c_void_p ] , errcheck = False ) <EOL> get_geom_srs = srs_output ( lgdal . OGR_G_GetSpatialReference , [ c_void_p ] ) <EOL> get_area = double_output ( lgdal . OGR_G_GetArea , [ c_void_p ] ) <EOL> get_centroid = void_output ( lgdal . OGR_G_Centroid , [ c_void_p , c_void_p ] ) <EOL> get_dims = int_output ( lgdal . OGR_G_GetDimension , [ c_void_p ] ) <EOL> get_coord_dim = int_output ( lgdal . OGR_G_GetCoordinateDimension , [ c_void_p ] ) <EOL> set_coord_dim = void_output ( lgdal . OGR_G_SetCoordinateDimension , [ c_void_p , c_int ] , errcheck = False ) <EOL> get_geom_count = int_output ( lgdal . OGR_G_GetGeometryCount , [ c_void_p ] ) <EOL> get_geom_name = const_string_output ( lgdal . OGR_G_GetGeometryName , [ c_void_p ] ) <EOL> get_geom_type = int_output ( lgdal . OGR_G_GetGeometryType , [ c_void_p ] ) <EOL> get_point_count = int_output ( lgdal . OGR_G_GetPointCount , [ c_void_p ] ) <EOL> get_point = void_output ( lgdal . OGR_G_GetPoint , [ c_void_p , c_int , POINTER ( c_double ) , POINTER ( c_double ) , POINTER ( c_double ) ] , errcheck = False ) <EOL> geom_close_rings = void_output ( lgdal . OGR_G_CloseRings , [ c_void_p ] , errcheck = False ) <EOL> ogr_contains = topology_func ( lgdal . OGR_G_Contains ) <EOL> ogr_crosses = topology_func ( lgdal . OGR_G_Crosses ) <EOL> ogr_disjoint = topology_func ( lgdal . OGR_G_Disjoint ) <EOL> ogr_equals = topology_func ( lgdal . OGR_G_Equals ) <EOL> ogr_intersects = topology_func ( lgdal . OGR_G_Intersects ) <EOL> ogr_overlaps = topology_func ( lgdal . OGR_G_Overlaps ) <EOL> ogr_touches = topology_func ( lgdal . OGR_G_Touches ) <EOL> ogr_within = topology_func ( lgdal . OGR_G_Within ) <EOL> geom_transform = void_output ( lgdal . OGR_G_Transform , [ c_void_p , c_void_p ] ) <EOL> geom_transform_to = void_output ( lgdal . OGR_G_TransformTo , [ c_void_p , c_void_p ] ) <EOL> get_envelope = env_func ( lgdal . OGR_G_GetEnvelope , [ c_void_p , POINTER ( OGREnvelope ) ] ) </s>
