I'm trying to get images with the Google Maps Image API of polygons representing areas of the UK. For some reason the imaging doesn't work when the polygon has too many coordinates and I can't find out why.
I'm encoding the polygons into the url as described here using the rails polylines gem.
A polygon of Camden in London is made with the following coordinates:
coords = [[-0.120544, 51.531198], [-0.127403, 51.533038], [-0.12757, 51.544915], [-0.139614, 51.558465], [-0.140785, 51.56867], [-0.172904, 51.574357], [-0.200339, 51.553112], [-0.215729, 51.553112], [-0.210376, 51.545751], [-0.190134, 51.532201], [-0.179428, 51.537889], [-0.172067, 51.536049], [-0.155841, 51.535213], [-0.150655, 51.526012], [-0.135097, 51.517648], [-0.131585, 51.512295], [-0.12389, 51.516979], [-0.114856, 51.516979], [-0.108834, 51.521161]]
Which when used with the gem produces an encoded string:
enc = Polylines::Encoder.encode_points(coords)
-> jpV_uoyHzi@oJ`@giAfjAusAjFw~@tgEqb@njDxcCd_B?m`@~l@q}BtsA{aAqb@_m@nJmdBfDk_@nx@g`Bfs@}Tl`@co@g\\mw@?ud@cY
Then when placed in the API url doesn't produce a polygon (click here).
But if I cut the coordinates in half, limiting the coordinates, it does produce a polygon.
enc = Polylines::Encoder.encode_points([[51.531198, -0.120544], [51.533038, -0.127403], [51.544915, -0.12757], [51.558465, -0.139614], [51.56867, -0.140785], [51.574357, -0.172904], [51.553112, -0.200339], [51.553112, -0.215729]])
-> _uoyHjpVoJzi@giA`@usAfjAw~@jFqb@tgExcCnjD?d_B
Any ideas why? I can't find any documented limits in this API with regards to encoded polygons.