Ticket #710 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

Install instructions unclear

Reported by: openlayers Owned by: crschmidt
Priority: minor Milestone: 2.4 Release
Component: documentation Version: 2.4 RC3
Keywords: pullup Cc:
State:

Description

Maybe I'm a newb, but I can't get a local install to work.

The instructions I am using are the current svn instructions, as of r3156 trunk/openlayers/readme.txt:

---------------------
Installing OpenLayers
---------------------

You can use OpenLayers as-is by copying build/OpenLayers.js and the
entire lib/ directory up to your webserver, putting them in the same
directory. To include the OpenLayers library in your web page, use:

  <script type="text/javascript" src="OpenLayers.js" />

If you want to use the multiple-file version of OpenLayers (for, say,
debugging or development purposes), copy the lib/ directory up to your
webserver in the same directory you put the img/ folder. Then add
the following to your web page instead:

  <script type="text/javascript" src="lib/OpenLayers.js" />

I was testing openlayers, using the example in lite.html, and as documented in MappingYourData. It all works very well, and I have a decent map design. I want to move it to an internal web server, but when I follow the above instructions, I am unable to get it to install.

Steps to reproduce:

  1. svn co openlayers...
  2. cd openlayers/build
  3. ./build.py
  4. cp OpenLayers.js ~/html/
  5. cp -R ../lib ~/html/lib
  6. Modify the js include
    1. from <script src="http://openlayers.org/dev/lib/OpenLayers.js"></script>
    2. to <script src="/OpenLayers.js"></script>
    3. then <script src="<?php if($_SERVER['HTTPS']) {print 'https://';} else {print 'http://';};print $_SERVER['SERVER_NAME'];?>/OpenLayers.js"></script>
    4. then <script src="<?php if($_SERVER['HTTPS']) {print 'https://';} else {print 'http://';};print $_SERVER['SERVER_NAME'];?>/lib/OpenLayers.js"></script>
    5. then <script type="text/javascript" src="<?php if($_SERVER['HTTPS']) {print 'https://';} else {print 'http://';};print $_SERVER['SERVER_NAME'];?>/lib/OpenLayers.js"></script>

In all cases, it loads the WMS file, but the map paraphernalia and widgets do not draw. They are either broken links, or missing, and the coordinate of the mouse is reported in the top left.

Hmmm...

At this point, I think I've done everything required, but obviously I haven't. That's what leads me to believe the docs are the problem.

Attachments

OpenLayersBug710.jpg Download (94.9 KB) - added by openlayers 6 years ago.
What it looks like when it fails.

Change History

Changed 6 years ago by openlayers

What it looks like when it fails.

  Changed 6 years ago by openlayers

For what it's worth, I later copied the theme subdirectory over, which didn't change anything.

I also added the stylesheet directly into my html with <link rel="stylesheet" type="text/css" href="/theme/default/style.css" /> , but that didn't help, either.

I'm stumped.

follow-up: ↓ 3   Changed 6 years ago by crschmidt

There are two subdirectories you need:

theme/ img/

If you're using the single file version, these must be in the same directory as OpenLayers.js. If you're using the multiple file version (lib/OpenLayers.js), these should be one level up:

lib/OpenLayers.js lib/OpenLayers/*.js img/ theme/

Hopefully this helps move one step farther.

The <link rel="stylesheet"> is automatic, so you shouldn't need to do it manually, and <script src="/OpenLayers.js"></script> should work.

in reply to: ↑ 2 ; follow-up: ↓ 5   Changed 6 years ago by openlayers

Replying to crschmidt:

There are two subdirectories you need: theme/ img/ If you're using the single file version, these must be in the same directory as OpenLayers.js.

I want to use the single-file version. I am trying to optimize for load speed at the client.

Well, starting from a fresh directory, but still using the SVN checkout mentioned above...

$ pwd
/var/www/html/maps

$cp ~/openlayers/build/OpenLayers.js ./
$cp -R ~/openlayers/theme ./
$cp -R ~/openlayers/img ./

$grep OpenLayers.js testme.php
   <script src="/maps/OpenLayers.js"></script>

And it works - thank you. I will put an extra comment in below to replace the misleading directions I originally cited. If you want it as a patch, I have subscribed to the dev list now, so you'll see me in there. Post a request. Frankly, I think you'll be faster to copy and paste :-).

  Changed 6 years ago by openlayers

Replacement instructions:

---------------------
Installing OpenLayers
---------------------

You can use OpenLayers as-is by copying build/OpenLayers.js and the
entire theme/ and img/ directories up to your webserver, putting them 
in the same directory. The files can be in subdirectories on your website, or right in the root of the site, as in these examples. To include the OpenLayers library in your web page from the root of the site, use:

  <script type="text/javascript" src="/OpenLayers.js" />

As an example, using bash (with the release files in ~/openlayers ):
$ cd /var/www/html
$ cp ~/openlayers/build/OpenLayers.js ./
$ cp -R ~/openlayers/theme ./
$ cp -R ~/openlayers/img ./

If you want to use the multiple-file version of OpenLayers (for, say,
debugging or development purposes), copy the lib/ directory up to your
webserver in the same directory you put the img/ folder. Then add
the following to your web page instead:

  <script type="text/javascript" src="/lib/OpenLayers.js" />

As an example, using bash (with the release files in ~/openlayers ):
$ cd /var/www/html
$ cp -R ~/openlayers/lib ./
$ cp -R ~/openlayers/theme ./
$ cp -R ~/openlayers/img ./


in reply to: ↑ 3   Changed 6 years ago by openlayers

  • owner set to crschmidt

Replying to openlayers:

Replying to crschmidt:

As an aside, my page load times with all local files, not the remote multifile system, have gone from 15-20 seconds to 2. That may or may not include all the wms activity, which is all local, on the webserver machine.

Thanks for the help - I'll leave the bug for you to close, so that the doc changes can be included, if they are wanted.

  Changed 6 years ago by crschmidt

  • keywords pullup added; install removed
  • version changed from SVN to 2.4 RC3
  • milestone set to 2.4 Release

  Changed 6 years ago by crschmidt

  • status changed from new to closed
  • resolution set to fixed

2.4RC4

Note: See TracTickets for help on using tickets.