title: Retrieving GeoPoint array from Firestore Database add map polygon
body: <p>After searching for a few days across StackOverflow groups I have been able to come up with the below coding which is a combination of items found for retrieving geopoint arrays from Firestore and also items for displaying polygons on Android googleMap. The activity loads and there are no errors however the polygon does not seem to be showing; I believe it is the List Object that is the issue as the QueryDocuementSnapshot works fine for when I add normal markers to the map from different documents. Thank you in advance for your assistance.</p>
  
  <pre><code>private void addPolygonsToMap(GoogleMap googleMap) {
      FirebaseFirestore db = FirebaseFirestore.getInstance();
      CollectionReference pProfileRef = db.collection("polygons");
      pProfileRef.get().addOnCompleteListener(new OnCompleteListener&lt;QuerySnapshot&gt;() {
          @Override
          public void onComplete(@NonNull Task&lt;QuerySnapshot&gt; task) {
              if (task.isSuccessful()) {
                  for (QueryDocumentSnapshot document : task.getResult()) {
                      Log.d(TAG, document.getId() + " =&gt; " + document.getData());
                      List&lt;Object&gt; polyPoint=(List&lt;Object&gt;)document.get("points"); for (Object geoObject : polyPoint) {
                          int length = polyPoint.size();
                          if(length ==0){
                              return;
                          }
                          PolygonOptions poly = new PolygonOptions();
                          poly.fillColor(0x4d4fa5d5);
                          for (int i = 0; i &lt; length; i++) {
                              poly.add(new LatLng(polyPoint.get(i).a, polyPoint.get(i).b));
                          }
                          googleMap.addPolygon(poly);
                      }
                  }
              } else {
                  Log.d(TAG, "Error getting documents:", task.getException());
              }
          }
      });
  }
  </code></pre>
  
  <p>Then in my onMapReady I have.</p>
  
  <pre><code>@Override
      public void onMapReady(GoogleMap googleMap) {
          mMap = googleMap;
         // polyMap = googleMap;
          LatLng latLng = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude());
          MarkerOptions markerOptions = new MarkerOptions().position(latLng).title("My Location");
          googleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
          googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 5));
          googleMap.addMarker(markerOptions);
          //googleMap.setMaxZoomPreference(18.0f);
          //googleMap.setMinZoomPreference(6.0f);
          addMarkersToMap(googleMap);
          addPolygonsToMap(googleMap);
  
          if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
              return;
          }
          googleMap.setMyLocationEnabled(true);
          // Set a listener for marker click.
          //googleMap.setOnMarkerClickListener(this);
      }
  </code></pre>
  
  <p>Screenshot of Firebase database as requested
  <img src="https://i.stack.imgur.com/Iy8Dp.jpg" alt="enter image description here"></p>