Working, including URL fetch.
This commit is contained in:
parent
47ca5b17ba
commit
5cbcaa85a1
3 changed files with 133 additions and 19 deletions
26
index.html
26
index.html
|
|
@ -122,8 +122,8 @@ crossorigin=""/>
|
|||
<li>
|
||||
For each <code>div</code> which you wish to contain a map view,
|
||||
an invocation of the function
|
||||
<code>geocsv_lite.core.initialise_map_element(id, data-source)</code>: <br/>
|
||||
<samp><script>geocsv_lite.core.initialise_map_element("map", "data/data.csv");</script></samp>
|
||||
<code>geocsv_lite.core.initialiseMapElement(id, data-source)</code>: <br/>
|
||||
<samp><script>geocsv_lite.core.initialiseMapElement("map", "data/data.csv");</script></samp>
|
||||
</li>
|
||||
</ol>
|
||||
<p>
|
||||
|
|
@ -159,6 +159,12 @@ crossorigin=""/>
|
|||
and you don't have an appropriate pin image for each value present,
|
||||
then you will get 'broken' pin images appearing on your map.
|
||||
</p>
|
||||
<h2>
|
||||
GitHub repository
|
||||
</h2>
|
||||
<p>
|
||||
Is <a href="https://github.com/simon-brooke/geocsv-js">here.</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
|
@ -181,10 +187,10 @@ crossorigin=""></script>
|
|||
<script src="js/geocsv.js" type="text/javascript"></script>
|
||||
<script>
|
||||
/* Map using data from element content */
|
||||
GeoCSV.initialise_map_element("element-content-map",
|
||||
GeoCSV.initialiseMapElement("element-content-map",
|
||||
document.getElementById("element-content-map").innerText);
|
||||
/* Map using inline CSV passed to the function */
|
||||
GeoCSV.initialise_map_element("inline-csv-map",
|
||||
GeoCSV.initialiseMapElement("inline-csv-map",
|
||||
"Country,Name,Latitude,Longitude,CountryCode,Continent,Category\n" +
|
||||
"Somaliland,Hargeisa,9.55,44.05,NULL,Africa,\n" +
|
||||
"Western Sahara,El-Aaiún,27.153611,-13.203333,EH,Africa,EH\n" +
|
||||
|
|
@ -245,8 +251,16 @@ crossorigin=""></script>
|
|||
"Zimbabwe,Harare,-17.8166666666667,31.033333,ZW,Africa,ZW\n" +
|
||||
"British Indian Ocean Territory,Diego Garcia,-7.3,72.4,IO,Africa,\n" );
|
||||
/* Map using CSV from URL */
|
||||
var url = window.location.href.substring(0, window.location.href.length - "index.html".length) + "data/europe-capitals.csv";
|
||||
GeoCSV.initialise_map_element("url-map", url);
|
||||
console.log( "Window.location.href = `" + window.location.href + "`");
|
||||
var url = window.location.href;
|
||||
|
||||
if (url.endsWith( "index.html")) {
|
||||
url = url.substring(0, window.location.href.length - "index.html".length);
|
||||
}
|
||||
|
||||
url = url + "data/europe-capitals.csv";
|
||||
|
||||
GeoCSV.initialiseMapElement("url-map", url);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue