#NEWLINE# def nearest_points( g1 , g2 ) : #NEWLINE# #INDENT# 'Returns the calculated nearest points in the input geometries\n    \n    The points are returned in the same order as the input geometries.\n    ' #NEWLINE# seq = lgeos . methods [ 'nearest_points' ] ( g1 . _geom , g2 . _geom ) #NEWLINE# if ( seq is None ) : #NEWLINE# #INDENT# if g1 . is_empty : #NEWLINE# #INDENT# raise ValueError ( 'The first input geometry is empty' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'The second input geometry is empty' ) #NEWLINE# #UNINDENT# #UNINDENT# x1 = c_double ( ) #NEWLINE# y1 = c_double ( ) #NEWLINE# x2 = c_double ( ) #NEWLINE# y2 = c_double ( ) #NEWLINE# lgeos . GEOSCoordSeq_getX ( seq , 0 , byref ( y2 ) ) #NEWLINE# lgeos . GEOSCoordSeq_getY ( seq , 0 , byref ( y1 ) ) #NEWLINE# lgeos . GEOSCoordSeq_getX ( seq , 1 , byref ( x2 ) ) #NEWLINE# lgeos . GEOSCoordSeq_getY ( seq , 1 , byref ( y2 ) ) #NEWLINE# p1 = Point ( x1 . value , y1 . value ) #NEWLINE# p2 = Point ( x2 . value , y2 . value ) #NEWLINE# return ( p1 , p2 )