Note that there are some explanatory texts on larger screens.

plurals
  1. POLeaflet error: Invalid LatLng object: ( , undefined)
    primarykey
    data
    text
    <p>I'm trying to move my L.polygon data to a different file. I'm using jQuery to get the data from the separate file. It seems like it should be returning the exact same data I was using when I had it as a L.polygon in the index.html file, but instead it's returning this error:</p> <pre><code>Invalid LatLng object: ( , undefined) </code></pre> <p>I searched for the error, but it seems that everyone else who has reported it was using a different data type than I am.</p> <p>Here's the full example:</p> <p>index.html:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;meta charset="utf-8"&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" /&gt; &lt;script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"&gt;&lt;/script&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt; &lt;/script&gt; &lt;style type="text/css"&gt; #map { height: 500px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="map"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; var map = L.map('map').setView([33.720818, -84.240], 11); $.get("data/temp.csv", function(data) { console.log(data); var temp = new L.polygon(data).setStyle(defaultStyle).addTo(map); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>data/temp.csv:</p> <pre><code>[ [33.829205,-84.377261], [33.829121,-84.377257], [33.829039,-84.377271], [33.828937,-84.377204], [33.828871,-84.377122] ] </code></pre> <p>Edit: To clarify, adding the following to the index.html file works just fine, but bringing it in from another file (above) isn't working.</p> <pre><code>var temp = L.polygon([ [33.829205,-84.377261], [33.829121,-84.377257], [33.829039,-84.377271], [33.828937,-84.377204], [33.828871,-84.377122] ]).setStyle(defaultStyle).addTo(map); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload