Set color to geojson googlemaps android zones

I displayed geojson on maps using the Google Utiltiy lib. I want to set the color to zones. How can i achieve this.

I tried the following:

JSONObject polygonproperties = object.getJSONObject("geometry");
            JSONArray polyshape = polygonproperties.getJSONArray("coordinates");
           JSONArray arraycoordinates= (JSONArray) polyshape.get(0);
            for(int i=0;i<arraycoordinates.length();i++)
            {
                JSONArray abcd= (JSONArray) arraycoordinates.get(i);
                latLng=new LatLng(abcd.getDouble(0),abcd.getDouble(1));
                Polygon polygon= googleMap.addPolygon(new 
                   PolygonOptions().add(
                        latLng ));
                polygon.setFillColor(Color.BLACK);
                polygon.setStrokeColor(Color.BLUE);

            }

But nothing works.

+4
source share

Source: https://habr.com/ru/post/1686386/


All Articles