My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 6197: Bug: Polygon does not fill correctly; Concave issue?
54 people starred this issue and may be notified of changes. Back to list
Status:  Acknowledged
Owner:  ----


Sign in to add a comment
 
Reported by [email protected], Dec 31, 2013
I attempting to draw a filled Polygon using the v2 google maps API. If I draw a standard rectangle everything looks great. If I try to something different like a arrow head the lines draw, but they do not fill. The app allows the user to define the points by interacting on the map).

In the example below, if you run the code segment below as is, it will draw an arrow like image that aims to the lower left. The outline draws, but the map doesn't fill.

If you comment the "bad point" section and uncomment the "good point" line, the map draws and fills correctly.

Please see the attached screen shot for an example.

private void drawTest() {
    PolygonOptions rectOptions = new PolygonOptions();
    rectOptions.add(new LatLng(44.97437590304863,-93.27457655221224)); // bad point
    //rectOptions.add(new LatLng(44.99098216930516,-93.27247872948647)); // good point
    rectOptions.add(new LatLng(44.977891781610175,-93.2605804502964));
    rectOptions.add(new LatLng(44.95120423204544,-93.26962251216173));
    rectOptions.add(new LatLng(44.97884376398687,-93.29010352492332));

    rectOptions.fillColor(0x50880000);
    rectOptions.strokeWidth(5);

    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(44.97437590304863, -93.27457655221224),13));
    mPropOverlay.add(mMap.addPolygon(rectOptions));
}
google-maps-issue.PNG
628 KB   View   Download
Dec 31, 2013
#1 [email protected]
Please note; i forgot to mention that this was done with a Nexus 5 running 4.4.2 and the latest version of Play Services installed
Jan 1, 2014
#2 [email protected]
Same for Samsung Galaxy S2. Also tried different settings for GPU rendering, but all the same, the polygon stays unfilled.
Jan 13, 2014
#3 camueller28
Same problem here with Google Play Services 4030500 on a Samsung Galaxy S3 running Android 4.4.2
Jan 13, 2014
#4 [email protected]
The coordinates must be specified in order. If added in a clockwise order the polygon fill renders correctly:

options.add(new LatLng(44.97884376398687,-93.29010352492332));
options.add(new LatLng(44.97437590304863,-93.27457655221224)); // bad point
//options.add(new LatLng(44.99098216930516,-93.27247872948647)); // good point
options.add(new LatLng(44.977891781610175,-93.2605804502964));
options.add(new LatLng(44.95120423204544,-93.26962251216173));

The "Fill color" section also says "If the polygon geometry is not specified correctly (see above for Outline and Holes), then no fill will be drawn."

Concave and convex polygons are supported, see https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Polygon. However if I reverse the list so that the coordinates are specified in counter-clockwise order then the fill is not rendered even though the documentation says it is supported.

concave-polygon.png
499 KB   View   Download
Feb 24, 2014
#5 [email protected]
I have a similar problem. In my case the polygons are defined by geographic regions, and as can be see it in the screenshots the regions are drawn, or not, depending on the zoom level, but not in a random way, for the same zoom level I always get the same result.
Screenshot_2014-02-24-12-19-56w.png
214 KB   View   Download
Screenshot_2014-02-24-12-20-13w.png
422 KB   View   Download
Feb 25, 2014
#6 [email protected]
I've experienced this issue as well. Are the shared boundaries being represented by exactly the same coordinates? If not, then what I've noticed is that if there is some overlap then it won't be filled at certain zoom levels.
Feb 25, 2014
#7 tomasz.zielinski
It looks like at certain zoom level some vertices are removed to simplify shape, but in such case two isolated holes can start intersecting and fill is gone.
Feb 26, 2014
#8 [email protected]
So, if there are intersections between polygons the fill is not going to work? From what I have read in the documentation it is no possible to disable the optimisation, I am I right?
Feb 27, 2014
#9 [email protected]
Me too, Here's an abridged file of what I'm processing. The first polygon gets filled, but the other one (on the right) doesn't. This renders well on Google Earth of course.
apartment_recycling_areas - Copy.kml
7.1 KB   Download
Apr 14, 2014
#10 [email protected]
I am developing a project that uses lots of polygons and they can have any shape and any number of points and they can even overlap randomly. This bug is very annoying. I tried drawing points in reverse order but it has no effect. My project is useless until this bug is fixed. Google should do something...
Aug 13, 2014
#11 [email protected]
I reported this on December 31st of last year.  32 stars and multiple people having the same problem.  

I've released my app with this problem with people e-mailing us about this issue.

Google, please review this issue and update us on the status of a resolution for this problem.
Aug 26, 2014
#12 [email protected]
This bug is perhaps related to performance of the phone. I have three Android phones here, ZTE Blade 3 with Android 4.4.3, ZTE Blade Apex 2 with Android 4.4.2 and Samsung Galaxy XCover 2 with Android 4.1.2. Blade 3 is the only phone having this polygon issue. I'm running the same app and same code on every phone. Blade 3 is generally very slow phone. Also I noticed that simple polygons with just few points draw correctly more often than complex polygons with lots of points.
Blade 3 has single core CPU and 512 MB RAM, Blade Apex 2 has quad core CPU and 1GB RAM and XCover 2 has dual core CPU and 1 GB RAM. I have never seen the problem with Blade Apex 2 or XCover 2. 
It's possible that I'm wrong but just noticed this. Maybe it helps someone.
Sep 11, 2014
#13 [email protected]
(No comment was entered for this change.)
Labels: Internal-17346452
Sep 18, 2014
Project Member #14 [email protected]
(No comment was entered for this change.)
Status: Acknowledged
Oct 1, 2014
#15 [email protected]
I'm not exactly sure but I experience this problem in some particular cases.
It seems that it depends on the number of vertexes you put when creating the polygon.
I developed a sort of "editing" library which allows users to create/modify/delete shapes and when drawing "arrows" they are filled most of the times, but hollowed when the last point is removed (if you do not put the first point again as last one).
I can't check it, you should make some tests but that's what I've noticed
Oct 15, 2014
#16 [email protected]
Thankyou for all the details. I've taken a look into this and there are some bugs and some known limitations.

 - There is a specific bug with concave quadrilaterals (e.g., the arrowhead shape in the initial report).  We are fixing this.  Unfortunately, the obvious workaround of adding another point on one of the lines won't work because it is removed during simplification.

 - We do not support self-intersecting polygons (either the outline or the hole intersecting)

 - Currently, we have a limitation of 2000 vertices for filling polygons - this will probably affect some of the complicated geographical regions.  We do attempt to simplify the polygon when zoomed out in order to reduce the number of vertices but if this causes other issues (e.g, causes self-intersection to occur) then we can't do this.
Labels: -Internal-17346452 Internal-18007489
Oct 16, 2014
#17 [email protected]
Does this mean that the simplification of polygons when zooming will not occur in this fix if it results in self-intersections?
Nov 6, 2014
#18 [email protected]
 as well am running into he same issue.  No matter on which starts first, mine cuts off the same corner in the polygon.

www.valvik.info/tCard?Num=101
Dec 3, 2014
#19 [email protected]
I'm having this issue as well. What's the fun part is that Google maps for IOS doesn't have this issue. Everything works like a charm there. Also this bug has been in the android maps v2 for over an year that doesn't sound promising.
Dec 16, 2014
#20 [email protected]
The bug with concave quadrilaterals (e.g., the arrowhead shape in the initial report) is fixed in Google Play services 6.5.

However, the other limitations still exist.

jorge.polack - your understanding is correct. If simplification causes self-intersections, we try to triangulate the unsimplified version. But if this has > 2000 vertices (and this number is subject to change in the future), then we don't triangulate that either and so we can't fill the polygon at all.
Dec 30, 2014
#21 [email protected]
Attempting to map several properties within Google Earth and view KMZ file on Galaxy S4 with Android version 4.4.2.
Whether via Google Drive or Email of kmz file, not all properties are displayed/nor displayed properly when opened on Google Earth (on Galaxy).


Capay Farms.kmz
6.4 KB   Download
Jan 12, 2016
#22 [email protected]
I am having the same issue. Polygons do not fill properly when zoomed out, but do fill properly when zoomed in to a certain zoom level.
Jan 14, 2016
Project Member #23 [email protected]
(No comment was entered for this change.)
Labels: -Internal-18007489 Internal-18007395
Sign in to add a comment

Powered by Google Project Hosting