This is the P2PU Archive. If you want the current site, go to www.p2pu.org!
You haven't posted any discussions yet.
What do I need to do to get the example in the walkthrough to work from my laptop (Ubuntu/LAMP)?
How do I get this example, http://workshops.opengeo.org/openlayers-intro/basics/map.html to work on jsFiddle?
-introvert
I just got the OpenGeo example working this morning. The original setup is zoomed too far out, I think
http://jsfiddle.net/UAxun/66/
Now, getting the walkthrough example working on your own server:
First, make sure you are importing the OpenLayers library in the section of your page, before any other JavaScript. This would be http://openlayers.org/api/OpenLayers.js
Put the map-creation JavaScript into a function, such as
<script type="text/javascript">
function makeMap(){
map = new OpenLayers.Map({div:"map-div"});
...
}</script>
Have that function run when all scripts have loaded, by changing <body> to <body onload="makeMap()">
Yes, I think I have imported the library. I tried your suggestion and played around with it but still nothing.
Ah, I got it.
If I could piggy back off of your question on examples not working. I got the OpenGeo example up and running http://jsfiddle.net/tyrockford/MLJdJ/12/ but am having problems with the Base layer switching http://workshops.opengeo.org/openlayers-intro/layers/proprietary.html . The OSM layer is fine but I can't seem to get the Bing layer working. The error message tells me that the library script is not included correctly. I checked the Bing Maps API http://msdn.microsoft.com/en-us/library/gg427624.aspx and the code that they use for javascript is not working. My guess is that I am not adding it correctly in the resources.
Any ideas on where I am going wrong?
Thanks.
The Bing / Virtual Earth example at that link is outdated. The new version of the Bing layer is described here:
http://openlayers.org/blog/2010/12/18/bing-tiles-for-openlayers/
You may prefer the older version because that doesn't require an API key. Make sure you added the script listed in step 2 on your OSGEO link. On jsFiddle, you add it using the Resources panel on the left side.