#NEWLINE# def __getitem__( self , key ) : #NEWLINE# #INDENT# "\n        If the result is a column containing only 'geometry', return a\n        GeoSeries. If it's a DataFrame with a 'geometry' column, return a\n        GeoDataFrame.\n        " #NEWLINE# result = super ( GeoDataFrame , self ) . __getitem__ ( key ) #NEWLINE# geo_col = self . _geometry_column_name #NEWLINE# if ( isinstance ( key , string_types ) and ( key == geo_col ) ) : #NEWLINE# #INDENT# result . __class__ = GeoSeries #NEWLINE# result . crs = self . crs #NEWLINE# result . _invalidate_sindex ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( result , DataFrame ) and ( geo_col in result ) ) : #NEWLINE# #INDENT# result . __class__ = GeoDataFrame #NEWLINE# result . crs = self . crs #NEWLINE# result . _geometry_column_name = geo_col #NEWLINE# result . _invalidate_sindex ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( result , DataFrame ) and ( key not in result ) ) : #NEWLINE# #INDENT# result . __class__ = DataFrame #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return result