I have data in this format:
POINT(73.0166738279393 33.6788721326803)
MULTILINESTRING((73.0131224998036 33.679001500419,73.0119635003153 33.678392400389,73.01
Here is a function I wrote to convert a simple (no holes etc.) polygon given in WKT into an array of LatLang:
public static LatLng[] GetPolygonPoints(String poligonWkt){
ArrayList points = new ArrayList();
Pattern p = Pattern.compile("(\\d*\\.\\d+)\\s(\\d*\\.\\d+)");
Matcher m = p.matcher(poligonWkt);
String point;
while (m.find()){
point = poligonWkt.substring(m.start(), m.end());
points.add(new LatLng(Double.parseDouble(m.group(2)), Double.parseDouble(m.group(1))));
}
return points.toArray(new LatLng[points.size()]);
}
You can then use the array to add the polygon on the map:
LatLng[] points = GeographyHelper.GetPolygonPoints(shapeWkt);
Polygon p = mMap.addPolygon(
new PolygonOptions()
.add(points)
.strokeWidth(4)
.strokeColor(Color.RED));