Mobile Maps
Home - Download
Developers - News
Services - Contacts

Mobilemaps Nearby-Engine: Lbs Installation


  1. Pre-requisites
  2. Install lbs script and setup lbs database
  3. Import placenames
  4. Import geocoding database
  5. Spider Web pages
  6. Index spidered data
  7. Setup mapserver
  8. Setup sox
  9. Setup configuration file
  10. Insert HTML to access the nearby engine
  11. Optional NearbyAds advertising setup
  1. Pre-requisites
  2. a. Supported Operating Systems include Linux, Unix, and Windows. These installation instructions assume a default Linux/Unix system, but provide Windows instructions where possible.

    b. Apache (or other web server) installed - see

    c. Perl installed, this should already be installed on most Unix systems, but if it is not then see; or for Windows users.

    d. Mysql database installed:

    Mysql (MySQL-Max 4.x) can be downloaded from

    After installing the software you need to set a root password:

    $ mysqladmin -u root password my_password

    where "my_password" should be a password you choose for your database.


  3. Install lbs script and setup lbs database
  4. a. Unpack lbs.tar.gz into /cgi-bin (or if using mod_perl, the /perl directory)

    $ gzip -d lbs.tar.gz
    $ tar -xvf lbs.tar

    b. You should create a new database within MySQL called "mobilemaps" with the following command-line:

    $ mysqladmin -u root -p create mobilemaps

    c. Configure database connection file, 'mobilemaps.conf'. First move into the lbs directory from the cgi-bin directory, then create a new copy of mobilemaps.conf:

    $ cd lbs
    $ cp mobilemaps.conf.sample mobilemaps.conf

    Then edit the new mobilemaps.conf file to connect to your database - for example, use 'root' as the user, and the password you used when setting the root password in the MySQL installation phase in section 1.b above.

    d. Install external Perl modules. The simplest way is to use the following script in the lbs directory, which automatically downloads and installs all the required modules from the CPAN repository (see for more information.) It is recommended to run this script as root.

    $ perl

    If this is the first time you have used CPAN, then entering 'No' at the initial CPAN configuration prompt can be a good idea, because the defaults are usually adequate.

    If this fails to work for some reason (If you are using Windows with ActiveState's Perl you should investigate the program called "ppm", and run: "ppm install dbi", "ppm install dbd-mysql", "ppm install tk") then you must install the individual modules and bundles, (available to download on MIME::Base64, URI, Digest::MD5, Bundle::libnet, HTML::Parser, Bundle::LWP, Data::ShowTable, DBI, Bundle::DBD::mysql, Bundle::Tk Enter each name separately into the search interface on, download each file, gzip -d file.tar.gz, tar -xvf file.tar, then follow the INSTALL instructions (typically: perl Makefile.PL; make; make test; make install)

    The library Bundle::DBD::mysql does not always install with the CPAN script, because its tests fail against a password configured MySQL database, and should be installed manually. If you have exited from the script, then go into your .cpan/build directory (e.g. /root/.CPAN/build/) and into the Msql-Mysql-modules-[xxxx] directory. Then run "perl Makefile.PL", follow the instructions (install MySQL DBD only, enter your real user/pass for the tests); make; make test; make install.

    e. Run the install script to setup database tables

    $ perl

    f. Put mobilemaps pictures into the webserver path

    $ cd /var/www/html #(or your webserver's html document directory)
    $ mkdir pics
    $ cp /var/www/cgi-bin/lbs/pics/* pics #(copy pics from the install directory)

    g. Ensure the "lbs" script is executable. From the cgi-bin directory enter:

    $ chmod 755 lbs/lbs


  5. Import placenames
  6. Download the "placenames.txt.gz" file (or "" file for Windows) and unzip it into a temporary directory such as /tmp.

    $ gzip -d /tmp/placenames.txt.gz

    Start up the Mysql client, and import the placenames into the database:

    $ mysql -u root -p
    > load data local infile '/tmp/placenames.txt' into table placenames;

    To limit the placename set to just the area you have chosen your Mobilemaps nearby engine to cover, you should find the latitude and longitude coordinates of a square box surrounding your area. Paper atlases can be surprisingly good ways of finding this information, while web map servers unfortunately rarely provide coordinates. You should have four values: North, South, West, and East for each side of the box. Now, within the mysql client, delete the placenames that are outside your box:

    > delete from placenames where ((latitude < [South]) or (latitude > [North])) and ((longitude < [West]) or (longitude > [East]));

    [Note: The five digit numbers at the beginning of the placenames are USA zip codes.]


  7. Import geocoding database
  8. Please refer to the Geo-data Installation document *Section 1. US Geocoding Database for setting up a street-level US geocode database.


  9. Spider Web pages
  10. a. Install Mobilemaps Spider. If this has not already been done, download the Mobilemaps Spider from, and follow the spider installation instructions here.

    b. A convenient step is to import a "seed" file of URL's from a source such as the Open Directory Project ( Download the file "content.rdf" (large) into the /spider directory, and then edit the script "" in the /spider directory to change the variable $place='your_place_of_interest' (e.g. a US state like 'California', or a whole country like 'New Zealand'.) Run:


    to generate a text file of Open Directory Project URLs that match your area. Next start up the Mysql client:

    $mysql -u root -p
    > use spider;
    > load data infile '[root of your spider directory]/spider/your_place.txt' into table spider_url;

    c. Run the Mobilemaps Spider

    $ perl

    Further instructions are available in the /spider/README file.

    d. Export spidered data, once you are satisfied with data quantity

    (i) Calculate relevance - this script operates on the spider database to perform a relevance calculation, prior to the actual export.

    $ perl -w

    (ii) Export data from spider

    $ perl -w (or click on the export button in spider gui)


  11. Index spidered data
  12. Move the exported data from the spider into the lbs directory, and run the indexing script.

    $ mv export.txt [web root]/cgi-bin/lbs/
    $ cd [web root]/cgi-bin/lbs/
    $ perl -w

    As well as indexing, the exported data, the indexing script also geocodes the spidered addresses. As of 2002-10-22, Geocoding has been designed to identify USA streets only, so elsewhere in the world you will have to code your own (except note that UK postcodes are recognised by the Spider, providing a satisfactory UK solution). Sadly the geocoding data is only free, to our knowledge, in the USA, and expensive elsewhere. Gecoding databases should consist of a list of postcodes or addresses with latitude and longitude coordinates in decimal degrees. Information on setting up USA geocoding databases are in section Import geocoding database above.


  13. Setup mapserver
  14. Please refer to the Mapserver Installation document for MapServer software and HCSLMAP script installation guidelines, and the Geo-data Installation document *Section 2. Street Level Maps, for instructions on setting up a large US street-level data set.


  15. Setup sox
  16. * World placenames & UK placenames & US Zipcodes

    cd sox
    chmod 700 make
    chmod 755 sox
    chmod 755 soxinputmap

    Uses data files: worlduk0.c

    * To generate your own list of placenames for sox, see details in the Sox Installation document.


  17. Setup configuration file
  18. Edit the mobilemaps.conf file and change any of the path variables to suit your system. These only need to be changed if you have modified the default location of any of the scripts.


  19. Insert HTML to access the nearby engine
  20. Insert the following HTML into a Web page to access your Mobilemaps nearby engine:



  21. Optional NearbyAds setup
  22. If you have decided to take advantage of the Mobilemaps NearbyAds service, which is free to join and offers a high percentage of advert click revenue, follow these steps:

    a. Sign-up for a portal account at the portals advertising page

    You will be given an Advertising ID on sign-up.

    b. To ensure that advertising clicks are credited to your account, you should add your Advertising ID to your mobilemaps.conf as follows:


    And check that the advertising flag is turned on, which looks like:


    You should also start the gstart-robot daemon,, which polls the list of location adverts regularly to keep your copy of them up to date:

    $ cd [web root]/cgi-bin/lbs/
    $ ./


Home | Download | Developers | News | Services | Contacts is Copyright 2003 High Country Software Ltd.