public static FieldBridge buildSpatialBridge(Spatial spatial, String latitudeField, String longitudeField) {
FieldBridge bridge = null;
if ( spatial != null ) {
if ( spatial.spatialMode() == SpatialMode.GRID ) {
if ( latitudeField != null && longitudeField != null ) {
bridge = new SpatialFieldBridgeByGrid( spatial.topGridLevel(), spatial.bottomGridLevel(), latitudeField, longitudeField );
}
else {
bridge = new SpatialFieldBridgeByGrid( spatial.topGridLevel(), spatial.bottomGridLevel() );
}
}
else {
if ( latitudeField != null && longitudeField != null ) {
bridge = new SpatialFieldBridgeByRange( latitudeField, longitudeField );