We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi!
I have a geojson data that has multiple points that are classified into "red", "blue" and "green". Is there a way to create markers manually for the points similar to the example code for SimpleLineMarkers? I got stuck 'cause most of the examples I saw were for SimplePointMarker which is for one location only. Thank you!
List<Marker> transitMarkers = new ArrayList<Marker>();
// Load features from GeoJSON
List<Feature> transitLines = GeoJSONReader.loadData(this, "MBTARapidTransitLines.json");
// Create markers from features, and use LINE property to color the markers.
for (Feature feature : transitLines) {
ShapeFeature lineFeature = (ShapeFeature) feature;
SimpleLinesMarker m = new SimpleLinesMarker(lineFeature.getLocations());
String lineColor = lineFeature.getStringProperty("LINE");
int color = 0;
// Original MBTA colors
if (lineColor.equals("BLUE")) {
color = color(44, 91, 167);
}
if (lineColor.equals("RED")) {
color = color(233, 57, 35);
}
if (lineColor.equals("GREEN")) {
color = color(59, 130, 79);
}
if (lineColor.equals("SILVER")) {
color = color(154, 156, 157);
}
if (lineColor.equals("ORANGE")) {
color = color(238, 137, 40);
}
m.setColor(color);
m.setStrokeWeight(5);
transitMarkers.add(m);
}
map.addMarkers(transitMarkers);