public String findDrivingDistance(int id,double x,double y,double distance,
			String mode, boolean is_reverse_cost) {
		
		String rTable = "road_profile_"+id;
		
		StringBuffer sb = new StringBuffer();
		
		JSONObject jobj   = new JSONObject();
		JSONObject jstat  = new JSONObject();
		JSONArray  jfeats = new JSONArray();
		
		int sCode       = 200;
		String sMessage = "Command completed successfully";
		
		String cost = "'cost'";
		String reverse_cost = "'reverse_cost'";
		
		if( mode.compareToIgnoreCase("length") == 0) {
			cost         = "'length'"; //"'st_length(the_geom)'";
			reverse_cost = "'length'"; //"'st_length(the_geom)'";
		}
		
		sb.append("select st_asgeojson(the_geom) as the_geom ");
		sb.append("from driving_distance_service('");
		sb.append( rTable ).append("',");
		sb.append(x).append(",").append(y).append(",");
		sb.append(distance).append(",");
		sb.append(cost).append(",").append(reverse_cost).append(",");
		sb.append(RouteProperties.getDirected()).append(",");
		sb.append( is_reverse_cost ).append(",");
		sb.append(RouteProperties.getBbox_dd()).append(")");

		if( dbConn != null ) {
			try {				
				Connection conn = dbConn.getConnection();
				Statement stmt  = conn.createStatement();
				
				ResultSet rs = stmt.executeQuery(sb.toString());

				if( rs.next() ) {
					JSONObject jfeat = new JSONObject();
					JSONObject jcrs  = new JSONObject();
					JSONObject jcprop= new JSONObject();
					JSONObject jprop = new JSONObject();
					JSONObject jgeom = new JSONObject(rs.getString("the_geom"));
					
					jcprop.put("code", RouteProperties.getSrid() );
					jcrs.put("type", "EPSG");
					jcrs.put("properties", jcprop);
					
					jprop.put("id", new Integer(1));
					
					jfeat.put("crs", jcrs);
					jfeat.put("geometry", jgeom);
					jfeat.put("type", "Feature");
					jfeat.put("properties", jprop);
					jfeats.add(jfeat);
				}
				
				rs.close();
				stmt.close();
				conn.close();
			}
			catch( Exception ex ) {
				sCode = 400;
				sMessage = "Database Query Error";
				ex.printStackTrace();
			}
		}
		else {
			sCode = 400;
			sMessage = "Database Connection Error";
		}

		try {
			jstat.put("code", new Integer(sCode));
			jstat.put("success", true);
			jstat.put("message",sMessage);

			jobj.put("type", "FeatureCollection");
			jobj.put("features", jfeats);
			jobj.put("status",jstat);			 
		}
		catch( Exception e ) {
			;
		}
		
		return jobj.toString();
	}