Demo entry 4784796

test

   

Submitted by anonymous on May 17, 2016 at 16:35
Language: Java. Code size: 506 Bytes.

private ArrayNode lineStringToLatLngArray(String lineString) {
		if (lineString == null) {
			return Json.newArray();
		}
		lineString = lineString.replaceAll("LINESTRING\\(([^)]+)\\)", "$1");
		String[] lnglatArray = lineString.split(",");
		ArrayNode returnValue = Json.newArray();
		for (String lnglat : lnglatArray) {
			String[] temp = lnglat.split(" ");
			returnValue.add(String.format("%.6f,%.6f", Double.parseDouble(temp[1]), Double.parseDouble(temp[0])));
		}
		return returnValue;
	}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).