This is the P2PU Archive. If you want the current site, go to www.p2pu.org!

Online Maps with OpenLayers

Chat 17 Feb 2011: Squashing JavaScript Bugs, Grassroots Mapping, Loading maps through JSON or KML

Nick Doiron's picture
Sat, 2011-02-19 16:40
Shared Maps
<DoRight> This isn't exactly along the topic, but I did add a open map of Catacamas to a blog - http://ElCaminoAlHogar.blogspot.com/
<rrosso> ok, here's what I have so far (from OpenLayers walk-through): http://www.publicdatapublic.org/openlayers_exercise.html

 
OpenGeo.org Examples
<seanhorgan> The opengeo.org examples are pretty straight-forward
<ndoiron> http://workshops.opengeo.org/openlayers-intro/index.html

-
A JavaScript console is an extension that throws a red flag if the JavaScript on your page derails, and shows you where the problem is.
<ndoiron> Firefox 4, you can do Ctrl+Shift+K.  Less than that, http://getfirebug.com/
<seanhorgan> in the world of javascript programming/debugging, firebug is an essential tool to get very familiar with it
<seanhorgan> if you click on the little bug symbol on the bottom right of your firefox window, it should split the screen with the bottom half showing the firebug console
<ndoiron> click the Script tab, then the down arrow, to set JavaScript to Enabled
<seanhorgan> Google Chrome has a developer mode (ctrl-shift-j) that is similar

Grassroots Mapping : Who, What, When, Where, Why?

<ndoiron> went to open source conference at State Dept... they are quite interested in mapping
<DoRight> Get more resources for us?
<ndoiron> got to meet some of the people behind http://grassrootsmapping.org -- they go beyond satellite maps by flying balloons
<introvert> why?
<ndoiron> higher-resolution, more recent, and can be open-sourced
<ndoiron> they took great photos during the BP Oil Spill and now some of those are in Google Maps
 
<introvert> how old are the satellite images
<ndoiron> introvert: if you have Google Earth you can find exactly how old their images are... it can be a few years
 
<rrosso> huh, that's cool. do they use GPS hand-held devices, or rely just on their photographs?
<ndoiron> rrosso: they put thousands of photos online, and people vote on whether they're good quality... I will have to post a link to that
<ndoiron> then they use US gov or Google sat maps to line them up
<ndoiron> and "stitch" them together
<ndoiron> website to vote on photos http://mapmill.org/
<DoRight> Yeah, gorgeous fotos!
 
<DoRight> But if they use google data, does that keep it from being used in opensource?
<ndoiron> I agree, using Google would make it non-free.  But if they're in the US they can use some USGS satellite maps which are free

 
Script not working?
<introvert> Wow the text of the script is full of "Â  Â  Â  Â Â " on most lines along with the code.
<seanhorgan> could be a cut-n-paste problem from a rich-text editor (MS word, etc)
<introvert> it was cut and paste from jsFiddle to emacs and/or gedit
<introvert> cut and pasting into gedit and emacs both give me Âs
<seanhorgan> can you easily strip them out?
<ndoiron> I'm seeing online that it could be a UTF-8 issue
<seanhorgan> that's what I thought too...I've run into problems like that it was usually encoding
<rrosso> ok, introvert, I pasted a working local openlayers map into pastebin: http://pastebin.com/aaKUza23
<introvert> Phew, local now works for me!

 
Loading Maps through JSON or KML
<seanhorgan> I'm trying to host a page with a map that draws icons based on locations from a file
<seanhorgan> is it best to store the data in a json format?  
<seanhorgan> i don't have a concrete example for you (yet), but I'd like to iterate through an array of points and plot them on the map
<ndoiron> it does have GeoJSON for input.  Try that format or KML, which people can view in Google Earth
<seanhorgan> can OSM handle KML?
<ndoiron> OpenLayers yes
<seanhorgan> cool.  so I can probably use that GeoJSON as input then
<ndoiron> This looks like the example for you to try: http://openlayers.org/dev/examples/geojson.html
 

Get Icon URLs
<introvert> I have one last q- how do I get the filename for icons?
<ndoiron> I don't know if this works in your browser... right click and you should have 'Copy Image URL' or 'Copy Image Location'

 
Post your own files
<rrosso> is there a way/place for us to post files?
<ndoiron> on http://p2pu.org/webcraft/node/12927/document you can attach files when you post a document

 

Attachment: