public static String generateLink ( Geometry geom , boolean withMarker ) { if ( geom == null ) { return null ; } Envelope env = geom . getEnvelopeInternal ( ) ; StringBuilder sb = new StringBuilder ( "http://www.openstreetmap.org/?" ) ; sb . append ( "minlon=" ) . append ( env . getMinX ( ) ) ; sb . append ( "&minlat=" ) . append ( env . getMinY ( ) ) ; sb . append ( "&maxlon=" ) . append ( env . getMaxX ( ) ) ; sb . append ( "&maxlat=" ) . append ( env . getMaxY ( ) ) ; if ( withMarker ) { Coordinate centre = env . centre ( ) ; sb . append ( "&mlat=" ) . append ( centre . y ) ; sb . append ( "&mlon=" ) . append ( centre . x ) ; } return sb . toString ( ) ; }
Create the OSM map link based on the bounding box of the geometry .