@Override
	public Node latLongQuery(double longitude, double latitude) throws IOException {
//		System.out.println("Calling latLongQuery.");
		Node node = new Node();
		String input = null;
		try {
			
			StringBuilder sb = new StringBuilder("latLongQuery\n");
			sb.append(ProtocolParser.encodeDouble(longitude));
			sb.append(ProtocolParser.encodeDouble(latitude));
			String output = ProtocolParser.appendLineCount(sb.toString());
			writer.print(output);
			writer.flush();
			
			int lines = Integer.parseInt(reader.readLine().trim());
			sb = new StringBuilder();
			for (int i = 0; i < lines; i++) {
				String line = reader.readLine().trim();
				sb.append(line);
				sb.append("\n");
			}
			
			input = sb.toString();
			
		} catch (IOException e){
			System.err.println("ERROR: problem interacting with server.");
			System.err.println(e.getMessage());
		} catch (NullPointerException e) {
			System.err.println("ERROR: not receiving server response. Exiting.");
			System.exit(-1);
		}
		if (input != null)
			if (input.startsWith("Node")) {
				node = ProtocolParser.decodeNode(input);
			} else if (input.startsWith("IOException")) {
				throw ProtocolParser.decodeIOException(input);
			}
		
		return node;
	}