0

I followed this documentation https://developers.google.com/maps/documentation/javascript/examples/polygon-simple, but I have a problem with zoom and polygons. Depending on the zoom level, the polygon renders diferently.

Below is the same polygon at different zoom levels:

this level work well this level not work well

My code:

function montapoligonos() {
            $(".coordenadas-cercas").each(function (index) {

                var Coordenadas = $(this).find("input[name=coordenadas]").val();
                coordenadasList = Coordenadas.split(';')
                var t = [];

                for (var i = 0; i < coordenadasList.length; i++) {
                    t.push(
                        {
                            lat: parseFloat(coordenadasList[i].split(',')[0]),
                            lng: parseFloat(coordenadasList[i].split(',')[1]),

                        }
                    );
                }
                var triangleCoords = t;

                var bermudaTriangle = new google.maps.Polygon({
                    paths: triangleCoords,
                    strokeColor: '#FF0000',
                    strokeOpacity: 0.8,
                    strokeWeight: 2,
                    fillColor: '#FF0000',
                    fillOpacity: 0.35
                });

                bermudaTriangle.setMap(mapEsfriamento.map);
           });
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.