Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8513649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:38:04+00:00 2026-06-11T04:38:04+00:00

I am building a polygon from an XML sheet. I am getting this error:

  • 0

I am building a polygon from an XML sheet. I am getting this error:

Message: Invalid value for constructor parameter 0: (15.850885, -97.058372)

Here is my code:

downloadUrl(searchUrl, function(data) { 
   var xml = parseXml(data);
   var triangleNodes = xml.documentElement.getElementsByTagName("triangle"); 
   for (var i = 0; i < triangleNodes.length; i++) {
   var trianglelatlng = new google.maps.LatLng(
          parseFloat(triangleNodes[i].getAttribute("triangle_lat")),
          parseFloat(triangleNodes[i].getAttribute("triangle_lng")),
          parseFloat(triangleNodes[i].getAttribute("triangle_lat1")),
          parseFloat(triangleNodes[i].getAttribute("triangle_lng1")),
          parseFloat(triangleNodes[i].getAttribute("triangle_lat2")), 
          parseFloat(triangleNodes[i].getAttribute("triangle_lng2")),
          parseFloat(triangleNodes[i].getAttribute("triangle_lat")),
          parseFloat(triangleNodes[i].getAttribute("triangle_lng")));
          createTriangle(trianglelatlng);
          }

As you can see here I am constructing my polygon array.

Now I am attempting to add the polygon to my map:

function createTriangle(trianglelatlng) { 
  var html2 = "<div id='infodiv'>HelloMatt</div>"; 
    var triangle = new google.maps.Polygon({     
        paths: trianglelatlng,     
        strokeColor: "#FF0000",     
        strokeOpacity: 0.8,    
        strokeWeight: 2,
        zIndex: 7,     
        fillColor: "#FF0000",     
        fillOpacity: 0.35
        });

triangle.setMap(map);

However if I add a static array such as below the polygon will show on the map.

var triangleCoords = [
  new google.maps.LatLng(25.774252, -80.190262),
  new google.maps.LatLng(18.466465, -66.118292),
  new google.maps.LatLng(32.321384, -64.75737),
  new google.maps.LatLng(25.774252, -80.190262)
  ];

I have also declared the var triangle in the global variables.
I am certain the issue is in the way I am constructing my array. Hopefully someone has constructed a polygon and can point me in the right direction

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:38:06+00:00Added an answer on June 11, 2026 at 4:38 am

    I think that in the first case your var triangleCoords is created only as a LatLng element (see here) while you need an array of LatLng, that you correctly make in the second way you describe. Try to add each point in the for loop to a pre-defined array and use that.

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Building a multi-language application in Java. Getting an error when inserting String value from
Building our Android app from Ant fails with this error: [apply] [apply] UNEXPECTED TOP-LEVEL
building on my last question jQuery getting values from multiple selects together I have
building upon the $.fn.serializeObject() function from this question , i'd like to be able
I'm building a custom control (inherited from TCustomControl ) in Delphi XE2 (and have
Building a website. When I order my tags like this, LightCycle works but Lightbox
Building a client-side swing application what should be notified on a bus (application-wide message
Building my baseclasses for user interface controls is getting there. I have command buttons
Building a GTK+ widget dynamically from code allows for easy access to the child
Building on this question: Django Celery Time Limit Exceeded? I have some tasks that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.