-1

I am using geojson files to draw polygon on the map on Android. Now I wanna add info windows on top of this polygons. I try to use GeoJsonPolygonStyle from GeoJsonlayer -> getFeature() method to style these polygon with info window.

But It doesnt give me any options like setTitle() and setSnippet() like it offers for GeoJsonPointStyle . Any help is appreciated .

rana
  • 1,824
  • 3
  • 21
  • 36

2 Answers2

0

what about setting an setOnPolygonClickListener?

getMap().setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() {
    public void onPolygonClick(Polygon polygon) {
    //show the a pop-up containing information 
    }
}
});
ismail alaoui
  • 5,748
  • 2
  • 21
  • 38
  • It doesnt work . because Polygon is part of Map SDK n GeoJson is open source standard and returns *GeoJsonPolygon* as a reference to the polygon on the map. – rana May 30 '19 at 18:50
0

I ended up creating LatLong bounds using the geojson co-ordinates and created InfoWindow using that bounds at the center . Hopefully google releases api in upcoming releases.

rana
  • 1,824
  • 3
  • 21
  • 36