WUSTL-GIS-Programming-spring-2014 / classinfo

Class information including syllabus
The Unlicense
2 stars 13 forks source link

leaflet assignment #13

Closed planetarygeo closed 10 years ago

planetarygeo commented 10 years ago

Howdy,

I am having trouble seeing how they are importing a GeoJSON dataset (like the ones you linked to on the Class 11 page for St. Louis County. In the example we went through it seems like you are just creating one-off features, and I tried looking at this example as well: http://leafletjs.com/examples/choropleth.html but I couldn't see how they are "importing" or linking to the statesdata GeoJSON info. Clearly I am missing something, so help would be appreciated :).

planetarygeo commented 10 years ago

p.s. I tried putting one of the St. Louis datasets on my github page with the variable "levees" defined and linking to that, but it still isn't showing up... probably I am doing something wrong somewhere else, but just wanted to check if that part at least should work: https://raw.githubusercontent.com/planetarygeo/planetarygeo.github.io/master/levees.js (I even remembered the ";")

blordcastillo commented 10 years ago

I will get a chance to look at this later tonight and let you know what I find.


From: planetarygeo [notifications@github.com] Sent: Saturday, April 05, 2014 3:05 PM To: WUSTL-GIS-Programming-spring-2014/classinfo Subject: Re: [classinfo] leaflet assignment (#13)

p.s. I tried putting one of the St. Louis datasets on my github page with the variable "levees" defined and linking to that, but it still isn't showing up... probably I am doing something wrong somewhere else, but just wanted to check if that part at least should work: https://raw.githubusercontent.com/planetarygeo/planetarygeo.github.io/master/levees.js (I even remembered the ";")

— Reply to this email directly or view it on GitHubhttps://github.com/WUSTL-GIS-Programming-spring-2014/classinfo/issues/13#issuecomment-39649371.

Nancy-Cole commented 10 years ago

Are we supposed to add layers to our basemap using code snippets drawn from this page, Using GeoJSON with Leaflet? http://leafletjs.com/examples/geojson.html

fbaum commented 10 years ago

I think you start with what Nancy asked, but instead of defining the variable containing the GeoJSON data inside your .html file, you "import" the data into your .html file by following this tutorial: http://giscollective.org/tutorials/web-mapping/leaflet-2/

I think this is what Kelsi is trying to do too. I copied the raw data from levees.json (on the St. Louis County JSON data website) to a local file on my computer named levees.js and the added "var levees =" to the beginning of the file and appended a semi-colon at the end. Then I added this line to my .html file just before or after a similar line where I import the leaflet.js file from its website:

This worked for my levees.js file on my computer in the same directory as my .html file. It also worked when I copied my leafletJS.html file and levees.js file to my GitHub page here: "http://fbaum.github.io/leafletJS.html" ( after going to this webpage, hit Ctrl-U to see its source).

Hope this helps.

planetarygeo commented 10 years ago

hmm, ok, it turns out my problem was not having both the geoJSON scripts and the html file in the same place (either on my computer or on my github.io site, seems like you should still be able to reference the geoJSON in another location but maybe I am doing that wrong :P.

fbaum commented 10 years ago

Maybe the Leaflet geoJSON layer/object doesn't like https vs just http. Instead of referencing your "levees.js" file on GitHub like this: https://raw.githubusercontent.com/planetarygeo/planetarygeo.github.io/master/levees.js ... try referencing it like this: http://planetarygeo.github.io/levees.js

blordcastillo commented 10 years ago

I'm am actually outside the GIS lab for office hours if anyone needs help. Will stay here until at least 6:30

blordcastillo commented 10 years ago

Bill's class is over and no one is here so I am going to head out for the night. Please post your issue here if you need help with the assignment.