#NEWLINE# def __init__( self , geo_input , srid = None ) : #NEWLINE# #INDENT# '\n        The base constructor for GEOS geometry objects, and may take the\n        following inputs:\n\n         * strings:\n            - WKT\n            - HEXEWKB (a PostGIS-specific canonical form)\n            - GeoJSON (requires GDAL)\n         * buffer:\n            - WKB\n\n        The `srid` keyword is used to specify the Source Reference Identifier\n        (SRID) number for this Geometry.  If not set, the SRID will be None.\n        ' #NEWLINE# if isinstance ( geo_input , basestring ) : #NEWLINE# #INDENT# if isinstance ( geo_input , unicode ) : #NEWLINE# #INDENT# geo_input = geo_input . encode ( 'ascii' ) #NEWLINE# #UNINDENT# wkt_m = wkt_regex . match ( geo_input ) #NEWLINE# if wkt_m : #NEWLINE# #INDENT# if wkt_m . group ( 'srid' ) : #NEWLINE# #INDENT# srid = int ( wkt_m . group ( 'srid' ) ) #NEWLINE# #UNINDENT# g = wkt_r ( ) . read ( wkt_m . group ( 'wkt' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hex_regex . match ( geo_input ) : #NEWLINE# #INDENT# g = wkb_r ( ) . read ( geo_input ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( gdal . GEOJSON and json_regex . match ( geo_input ) ) : #NEWLINE# #INDENT# g = wkb_r ( ) . read ( gdal . OGRGeometry ( geo_input ) . wkb ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'String or unicode input unrecognized as WKT EWKT, and HEXEWKB.' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( geo_input , GEOM_PTR ) : #NEWLINE# #INDENT# g = geo_input #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( geo_input , buffer ) : #NEWLINE# #INDENT# g = wkb_r ( ) . read ( geo_input ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( geo_input , GEOSGeometry ) : #NEWLINE# #INDENT# g = capi . geom_clone ( geo_input . ptr ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise TypeError ( ( 'Improper geometry input type: %s' % str ( type ( geo_input ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if bool ( g ) : #NEWLINE# #INDENT# self . ptr = g #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise GEOSException ( 'Could not initialize GEOS Geometry with given input.' ) #NEWLINE# #UNINDENT# self . _post_init ( srid )