Upgrade Ubuntu Dapper TO Edgy

First thing i would suggest is backup all your important data and start upgrade process and you can use any one of the method to udgrade to ubuntu edgy eft.

We can Use Two methods to upgrade Ubuntu Dapper to Edgy

1) Using GUI

2) Using apt-get

Upgrading Ubuntu Dapper to Ubuntu Edgy

Method 1

Using GUI

If you want to upgrade using GUI use the following command

gksu “update-manager -c ”

“-c” switch tells it to look for upgrades at all.You should see the following screen here Now you can see 6.10 is available for upgrade click on upgrade

Now you can see the following screen with the no.of packages available for download here click on start upgrade

Here it starts preparing the upgrade

You can see in this screen downloading required packages is in progress

Installing all the required packages in progress

After installing these packes you should see the following screen and here you need to click on restart and it will reboot your machine to take your new ubuntu 6.10 installation to effect all changes.

You can check the ubuntu version installed using the following command

sudo lsb_release -a

Output Looks like below

Distributor ID: Ubuntu
Description: Ubuntu edgy
Release: 6.10
Codename: edgy

Method 2

Using apt-get

Edit your /etc/apt/sources.list as root. Change every occurrence of dapper to edgy.

Use any prefered editor. If you have a CD-ROM line in your file, then remove it.

sudo vi /etc/apt/sources.list

or

use the following Simple command

sudo sed -e ’s/sdapper/ edgy/g’ -i /etc/apt/sources.list

Now you need to update the source list using the following command

sudo apt-get update

Upgrade using the following command

sudo apt-get dist-upgrade

Double check your process was finished properly using the following commd

sudo apt-get -f install

sudo dpkg --configure -a

Now you need to Reboot your machine to take your new ubuntu 6.10 installation to effect all changes.

I hope you will enjoy your new Ubuntu Edgy Eft

Share on Facebook
Posted in Ubuntu | Tagged , , , , | Leave a comment

http://www.bkurniawan.com

Kunjungi web baru saya di http://www.bkurniawan.com

Share on Facebook
Posted in My Live | Leave a comment

php code : generate excel using mysql and php

 just put the header in your php code

<?php
header(“Content-Type: application/vnd.ms-excel”);
header(“Expires: 0″);
header(“Cache-Control: must-revalidate, post-check=0, pre-check=0″);
header(“content-disposition: attachment;filename=form_k01.xls”);

// Make a MySQL Connection
mysql_connect(“172.27.1.245″, “root”, “”) or die(mysql_error());
mysql_select_db(“lp2tk”) or die(mysql_error());

// Get all the data from the “example” table
$result = mysql_query(“SELECT * FROM dat_k01_detail where id_dat=”.$_GET['id_dat'])
or die(mysql_error());

echo “<table border=’1′>”;
echo “<TR><TH rowspan=3>NO.</TH><TH rowspan=3>JABATAN PENGAWAS<BR> KETENAGAKERJAAN</TH><TH colspan=14>JUMLAH</TH><TH rowspan=3>KETERANGAN</TH></TR>
<TR><TH rowspan=2>UMUM</TH><TH colspan=11>SPESIALIS</TH><TH rowspan=2>PPNS</TH><TH rowspan=2>JUMLAH</TH></TR>
<TR><TH>1</TH><TH>2</TH><TH>3</TH><TH>4</TH><TH>5</TH><TH>6</TH><TH>7</TH><TH>8</TH><TH>9</TH><TH>10</TH><TH>11</TH></TR>”;

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo “<tr><td>”;
echo $row['nomor'];
echo “</td><td>”;
echo $row['jabatan'];
echo “</td><td>”;
echo $row['umum'];
echo “</td><td>”;
echo $row['sp1'];
echo “</td><td>”;
echo $row['sp2'];
echo “</td><td>”;
echo $row['sp3'];
echo “</td><td>”;
echo $row['sp4'];
echo “</td><td>”;
echo $row['sp5'];
echo “</td><td>”;
echo $row['sp6'];
echo “</td><td>”;
echo $row['sp7'];
echo “</td><td>”;
echo $row['sp8'];
echo “</td><td>”;
echo $row['sp9'];
echo “</td><td>”;
echo $row['sp10'];
echo “</td><td>”;
echo $row['sp11'];
echo “</td><td>”;
echo $row['ppns'];
echo “</td><td>”;
echo $row['jumlah'];
echo “</td><td>”;
echo $row['keterangan'];
echo “</td></tr>”;

}
/*
$sum = mysql_query(“SELECT SUM(umum) AS sum_umum,SUM(sp1) AS sum_1,SUM(sp2) AS sum_2,SUM(sp3) AS sum_3,SUM(sp4) AS sum_4,SUM(sp5) AS sum_5,SUM(sp6) AS sum_6,SUM(sp7) AS sum_7,SUM(sp8) AS sum_8,SUM(sp9) AS sum_9,SUM(sp10) AS sum_10,SUM(sp11) AS sum_11,SUM(ppns) AS sum_ppns,SUM(jumlah) AS sum_jumlah FROM dat_k01_detail”);

while($row = mysql_fetch_array( $sum )) {
echo “<tr><td>”;
echo “”;
echo “</td><td>”;
echo “Jumlah”;
echo “</td><td>”;
echo $row['sum_umum'];
echo “</td><td>”;
echo $row['sum_1'];
echo “</td><td>”;
echo $row['sum_2'];
echo “</td><td>”;
echo $row['sum_3'];
echo “</td><td>”;
echo $row['sum_4'];
echo “</td><td>”;
echo $row['sum_5'];
echo “</td><td>”;
echo $row['sum_6'];
echo “</td><td>”;
echo $row['sum_7'];
echo “</td><td>”;
echo $row['sum_8'];
echo “</td><td>”;
echo $row['sum_9'];
echo “</td><td>”;
echo $row['sum_10'];
echo “</td><td>”;
echo $row['sum_11'];
echo “</td><td>”;
echo $row['sum_ppns'];
echo “</td><td>”;
echo $row['sum_jumlah'];
echo “</td><td>”;
echo “”;
echo “</td></tr>”;
}
*/
echo “</table>”;
?>

clip_4.png

Share on Facebook
Posted in php | 3 Comments

Me

My Photo

[rockyou id=61800255&w=426&h=320]

Share on Facebook
Posted in My Live | Tagged , | Leave a comment

CartoWeb Installation

1.1. CartoWeb Installation

1.1.1. Prerequisite for Installing CartoWeb

CartoWeb depends on several software components for its proper working. Some are required and others are optional, depending on what you intend to do.

Note

Windows users can ignore this chapter and go directly to Section 1.1.2, “CartoWeb Download”

The required software are:

A Web Server

Such as Apache http://httpd.apache.org

PHP >= 5.0.3

See http://www.php.net for more informations. You will need to have some features available in PHP:

  • Gettext (optional): You need the Gettext module if you want to enable the Internationalization in CartoWeb. See Chapter 16, Internationalization for configuration.

    Note

    If you are using the demo, you need to have Gettext support installed, as it uses Gettext by default.

    If you are using Cygwin, simply install the gettext-devel package.

  • SOAP (optional if using direct mode only): You need the SOAP module if you want to use CartoWeb as a Webservice or with separated CartoClient and CartoServer. This is related to the cartoserverDirectAccess parameter described in Section 4.2, “ client.ini

Note

If you are using Windows, simply use the Windows Installer Section 1.1.2, “CartoWeb Download”. If you absolutely want to install PHP manually, see Appendix B, Apache & Mapserver Windows Manual Installation.

MapServer PHP/MapScript (from MapServer >= 4.4)

See http://www.maptools.org/php_mapscript/ for more information and installation instructions.

Note

If you are using Debian, and you need to install MapServer, you can have a look at Appendix A, Mapserver Debian Installation

Note

If you are using Windows, simply use the Windows Installer Section 1.1.2, “CartoWeb Download”. If you absolutely want to install MapServer manually, see Appendix B, Apache & Mapserver Windows Manual Installation.

PostgreSQL with PostGIS Support (Optional)

If you want spatial database support in CartoWeb you will need to install PostGIS of the PostgreSQL database. See http://postgis.refractions.net/ for more information.

1.1.2. CartoWeb Download

There are two ways to get CartoWeb:

  1. Complete package from the official website: 

    • Download CartoWeb package from http://cartoweb.org/downloads.html. It is recommended that you download the version with demo for a better user experience.
    • Uncompress the archive somewhere in your path accessible by your web server.
  2. From CVS: Get the current development version via CVS using the following command:
    cvs -d :pserver:anonymous@dev.camptocamp.com:/var/lib/cvs/public co cartoweb3

    From CVS with cw3setup.php: If you already have the cw3setup.php file, which comes along the CartoWeb package or CVS source, you can fetch CartoWeb from CVS and set up it at once. See Section 1.1.3.2.6, “Install or Reinstall CartoWeb from CVS and Set Up It at Once” for more details.

Once you have CartoWeb, point your web browser to the file located in htdocs/info.php, and check that the PHP information page displays correctly (meaning PHP is correctly setup) and that you have do not have a WARNING message at the top of the page about MapScript failing to load. If it is not the case, CartoWeb will not run correctly. You should install and set up PHP and PHP/MapScript correctly. See Section 1.1.1, “Prerequisite for Installing CartoWeb”.

Having Gettext installed is recommended if you wish to use the multilingual features of CartoWeb.

1.1.3. Command Line Installation

CartoWeb installer is cw3setup.php, located in the root directory of the application.

You can run this file with the --help parameter to see the available options. For instance:

<PHP-INTERPRETER> cw3setup.php --help

where <PHP-INTERPRETER> is the location of your php interpreter. On Windows, it can be c:wampphpphp.exe or on Unix /usr/lib/cgi-bin/php.

1.1.3.1. List of Available Options

Usage: cw3setup.php ACTION [OPTION_1] ... [OPTION_N]

Possible actions:

 --help, or -h              Display this help and exit.
 --version or -v            Output version information and exit.
 --install                  Install CartoWeb.
 --fetch-demo               Fetch the demo data from cartoweb.org, and extract
                            it in the demo project if not already there.
 --clean                    Clean generated files and caches.

List of options:

 --debug                    Turn on output debugging.

 --writableowner OWNER      The user who should have write permissions for
                            generated files.

 --cvs-root                 CVS Root directory to use when fetching
                            CartoWeb/project out of CVS.
 --fetch-from-cvs           Fetch CartoWeb from CVS and install it in the
                            current directory, or in the directory given by
                            the --install-location parameter.
                            NOTE: You must be located where cartoweb3 directory
                            will be created, not inside like other commands.
 --cartoweb-cvs-option OPTIONS  A string which will be given to the cvs checkout
                            command of cartoweb (not projects!).
                            For instance, to fetch a specific branch,
                            use '-r MY_BRANCH'. Or for a specific date,
                            use '-D "2005-09-05 11:00"'.
 --fetch-from-dir DIRECTORY Copy CartoWeb from the specified directory into the
                            current directory, or in the directory given by the
                            --install-location parameter.
                            NOTE 1: You must be located where cartoweb3
                            directory will be created, not inside like other
                            commands.
                            NOTE 2: You may either use a path relative to the
                            target cartoweb3 directory or an absolute path.
 --install-location         Directory where to install CartoWeb
                            (when using --fetch-from-cvs/dir options).

 --delete-existing          Overwrite existing directories if any.
 --no-symlinks              Do not use symbolic links, even if your operating
                            system supports them.

 --config-from-file FILE    Location of a configuration file for automatic
                            variable replacement in .in files.
                            NOTE: You may either use a path relative to the
                            target cartoweb3 directory or an absolute path.
--config-from-project PROJECT Read the configuration file containing variables
                            to replace in .in files from the specified project.

 --fetch-project-cvs PROJECT Fetch the given project from CVS (see --cvs-root
                            option). To fetch several projects at a time,
                            specify this option as many times as necessary.
 --fetch-project-dir DIRECTORY Fetch the given project from a directory. To
                            fetch several projects at a time, specify this
                            option as many times as necessary.
 --project PROJECT          Installation is launched only for given project. To
                            install several projects at a time, specify this
                            option as many times as necessary.

 --default-project PROJECT  Default project to use.
 --base-url BASEURL         URL where you can find client.php.
 --profile PROFILENAME      The profile to use (development/production/custom).
                            NOTE: default is 'development'
 --clean-views              Clean views (must be used with --clean).
 --clean-accounting         Clean accounting (must be used with --clean).
 --keep-directories         Do not remove the generated directories during
                            cleaning (must be used with --clean).
 --keep-permissions         Do not alter the permissions of writable directories.

1.1.3.2. Examples of Use

1.1.3.2.1. Basic Setup

To perform a basic setup of CartoWeb, such as if you want to run the demo project, type:

<PHP-INTERPRETER> cw3setup.php --install --base-url 

http://www.example.com/cartoweb

In this example, http://www.example.com/cartoweb is the address which corresponds to the cartoweb3/htdocs directory. You should find client.php if you type this URL.

1.1.3.2.2. Installing a Project from a Directory
<PHP-INTERPRETER> cw3setup.php --install --fetch-project-dir
            /home/foo/my_project --base-url http://www.example.com/cartoweb

1.1.3.2.3. Updating CartoWeb after Modifications

When you modify or add new content/features to CartoWeb, you need to update it. This will set relative links or copy new/modified resources files (templates, images, new plugins, …)

<PHP-INTERPRETER> cw3setup.php --install --base-url 

http://www.example.com/cartoweb

Same as Section 1.1.3.2.1, “Basic Setup”. Existing files are not overwritten.

1.1.3.2.4. Cleaning Generated Files (Map, PDF, Temporary Files and Smarty Cache)
<PHP-INTERPRETER> cw3setup.php --clean

1.1.3.2.5. Fetching the Demo Data
<PHP-INTERPRETER> cw3setup.php --fetch-demo

1.1.3.2.6. Install or Reinstall CartoWeb from CVS and Set Up It at Once

1.1.3.2.6.1. Install
<PHP-INTERPRETER> cw3setup.php --install --cvs-root
              :pserver:anonymous@dev.camptocamp.com:/var/lib/cvs/public
              --fetch-from-cvs --base-url http://www.example.com/cartoweb

Note

Do no execute this command from the cartoweb3 folder! Because this will fetch the whole cartoweb3 hierarchy from cvs, including the cartoweb3 folder. If you executed this from the cartoweb3 folder you would end up with something like cartoweb3/cartoweb3/.... Instead, copy the cw3setup.php in the parent directory, delete (or backup) the cartoweb3 folder and execute the command.

1.1.3.2.6.2. Reinstall
<PHP-INTERPRETER> cw3setup.php --install --cvs-root
              :pserver:anonymous@dev.camptocamp.com:/var/lib/cvs/public
              --fetch-from-cvs --delete-existing
              --base-url http://www.example.com/cartoweb

Warning

This command will automatically delete the existing cartoweb3/ folder! Be sure to backup the files and projects you wish to keep.

Note

See note on Section 1.1.3.2.6.1, “Install”. Notice here the –delete-existing parameter. Needed here because cartoweb3/ already exists. Without it the cw3setup script issues a warning and stops.

1.1.3.2.7. Update CartoWeb from CVS

To keep your CartoWeb up-to-date with the development version, simply type the following command in the CartoWeb root folder:

cvs -d :pserver:anonymous@dev.camptocamp.com:/var/lib/cvs/public update

Warning

This may have some serious effects on your existing developments, it is recommended you backup the CartoWeb root folder and all subforders before execution.

1.1.4. Windows Installation

1.1.4.1. Windows Install with Win32 Installer (Recommended)

Warning

Do not forget to restart your web server (WAMP > Services > Restart Apache) after installing CartoWeb!

Once it is installed, you can modify CartoWeb setup with the command-line script cw3setup.php (Section 1.1.3, “Command Line Installation”) from either a DOS or a Cygwin prompt. See Section 1.1.4.3, “CartoWeb Setup” for more info about how to use those interfaces.

1.1.4.2. Windows Manual Install

Instructions for Apache/PHP and MapServer installation are given in Appendix B, Apache & Mapserver Windows Manual Installation

Then download CartoWeb as described above (Section 1.1.2, “CartoWeb Download”).

Eventually set CartoWeb up with the command-line script cw3setup.php (Section 1.1.3, “Command Line Installation”) from either a DOS or a Cygwin prompt. See Section 1.1.4.3, “CartoWeb Setup” for more info about how to use those interfaces.

1.1.4.3. CartoWeb Setup

1.1.4.3.1. CartoWeb Setup with DOS

Open a command prompt (Start menu > Run > “cmd”) and go to the CartoWeb root:

cd C:wampwwwcartoweb3

Then see Section 1.1.3.2.1, “Basic Setup”

Note

To enable you to execute PHP scripts easily (like php cw3setup.php --someparameters instead of C:wampphp.exe cw3setup.php --someparameters), set the path to the PHP binary in your PATH environment variable (control panel > system > Advanced > Environment Variables. If there is no PATH variable, add a new one. If a PATH variable is already present, you can add the path to php.exe at the end of the existing path values, but add a “;” inbetween: path1;path2;path3):

C:wampphp;

The example above is true if the PHP binary are installed in C:wampphp.

Note

If you are using the demo, you need to have Gettext support installed, as it uses Gettext by default. If you used the win32 installer, Gettext is already installed, otherwise you must install it manually. You can get a version of Gettext for Windows there http://gnuwin32.sourceforge.net/packages/gettext.htm. Also set the path to the Gettext binary in your PATH environment variable.

C:Program FilesGnuWin32bin;

The example above is true if the Gettext binaries are installed in C:Program FilesGnuWin32bin. This is needed by the po2mo.php script to merge and compile the languages translation files.

Note

If you intend to use CVS in command line, you need to install a CVS client. Use WinCVS or TortoiseCVS, both are free Open Source clients. You must add the path to the CVS binary in your PATH environment variable.

C:Program FilesTortoiseCVS;

The example above is true if you installed TortoiseCVS in C:Program FilesTortoiseCVS.

1.1.4.3.2. CartoWeb Setup with Cygwin

Open a Cygwin window and go to the CartoWeb root:

cd C:
cd wamp/www/cartoweb3/

Then see Section 1.1.3.2.1, “Basic Setup”

Note

You can download Cygwin here Cygwin . When you install Cygwin, be sure to select the packages tar (or unzip) and cvs. You can also install the gettext-devel package, so you wont need to get an external gettext installation later. If you have already installed Cygwin, type the following command to see what package are currently installed.

cygcheck -c

If the packages mentioned above are not present, run Cygwin setup again and add the missing packages.

Note

To enable you to execute PHP scripts easily, set the path to the PHP binary in your .bashrc (in C:cygwinhomeAdministrator by default):

export PATH=$PATH:/cygdrive/c/wamp/php

The example above is true if the PHP binary are installed in c:wampphp.

If you do not want to install the cvs and gettext Cygwin package, you need to add also the path to the external CVS and gettext binaries.

export PATH=$PATH:/cygdrive/c/program Files/GnuWin32/bin
export PATH=$PATH:/cygdrive/c/program Files/TortoiseCVS

See the note in Section 1.1.4.3.1, “CartoWeb Setup with DOS”

1.2. Demos

1.2.1. Introduction

A few demos are embedded in CartoWeb to demonstrate the range of functionalities that CartoWeb offers and give users examples on how to implement them:

  • demoCW3: this is an overview of the standard functionalities that are somehow visible for an end-user in CartoWeb,
  • demoPlugins: it shows the new functionalities that are available in latest CartoWeb versions,
  • demoEdit: a simple demonstration of the geographical objects edition and persistent storage tools.

Demo data are freely downloadable. Next section explains how to install them. Configuration and programming details are then described.

1.2.2. Installation

Before installing these demos, you need to have a working CartoWeb installation. You can refer to the previous chapters how to install it.

To install the demoCW3 project, you need to gather the data by launching the cw3setup.php with the –fetch-demo option.

On the other hand, the demoPlugins project uses plugins that work with databases. Consequently some databases settings and configuration are required. We describe here how to install these databases and how to use cw3setup.php.

Step by step guide:

  1. Install PostgreSQL with PostGIS support.  Prerequisite: Postgresql >= 8.0

    Note

    If you are on Debian, you can have a look at Appendix A, Mapserver Debian Installation

  2. Create a PostgreSQL database using the following command: 
    $ createdb demo_plugins
  3. Integrate PostGIS functionalities in this database.  Typically, you can type:
    $ createlang plpgsql demo_plugins
    $ psql -d demo_plugins -f lwpostgis.sql
    $ psql -d demo_plugins -f spatial_ref_sys.sql

    Note

    psql is a terminal-based front-end for PostgreSQL. It enables you to type in queries interactively, issue them to PostgreSQL, and see the query results. Don’t forget to specify its location on your system to use it. If the lwpostgis.sql and spatial_ref_sys.sql files aren’t in the current directory, you have to specify their path.

  4. Create tables used by the locate plugin to allow you to do a recenter on features by searching their names.  To do so, you should export the free downloadable layers airport, agglo, district and town in PostgreSQL/PostGIS tables by typing the following command:
    $ shp2pgsql -I aerofacp.shp airport > /tmp/airport.sql
    $ psql -d demo_plugins -f /tmp/airport.sql
    
    $ shp2pgsql -I builtupa.shp agglo > /tmp/agglo.sql
    $ psql -d demo_plugins -f /tmp/agglo.sql
    
    $ shp2pgsql -I polbnda.shp district > /tmp/district.sql
    $ psql -d demo_plugins -f /tmp/district.sql
    
    $ shp2pgsql -I mispopp.shp town > /tmp/town.sql
    $ psql -d demo_plugins -f /tmp/town.sql

    Note

    shp2pgsql is a command-line program that exports a shapefile into SQL commands. Don’t forget to specify its location on your system to use it. You have to specify the path to the shapefiles if they aren’t in the current directory.

  5. Execute cw3setup.php file, with the –fetch-demo option to download geographical data.
  6. cw3setup.php Options.  To finish demoPlugins installation, you will need to launch the cw3setup.php with the –config-from-file parameter pointing to a property file containing database configuration informations. Such a file is provided in the cartoweb3/projects/demoPlugins/demo.properties file. You need to edit this file and change the parameter to match your environment. In particular the DB_HOST, DB_USER, DB_PASSWD and DB_PORT options need to match your database access configuration. DB_LOCATE_NAME must be set to the name of the database for the locate plugin. This file contains comments about the description of each variables. Here’s an example how to call the cw3setup.php script with the –config-from-file option.
    php cw3setup.php --install --base-url http://www.example.com/cartoweb
                    --config-from-file projects/demoPlugins/demo.properties

Note

Routing fonctionnalities are also integrated in this demo. But they need a more advanced configuration and the Pgdijkstra module installed in the database, so they aren’t integrated in the basic installation. The steps to integrate routing fonctionnalities and create database tables are described in next section.

1.2.3. Routing specific installation

  • Install the Pgdijkstra PostgreSQL module. 

    Note

    To do so,

  • Execute the dijkstra.sql file to install the functions in your database by typing: 
    $ psql -d demo_plugins -f dijkstra.sql
  • If you have PostGIS installed, you should launch dijkstra_postgis.sql
    $ psql -d demo_plugins -f dijkstra_postgis.sql
  • Import Europe road geodata in PostGIS, create its graph structure and configure plugin routing database.  To do so, simply execute the demo_routing.sql file, located in the <CARTOWEB_HOME>/projects/demoPlugins/server_conf/sql directory.

    Note

    These steps are detailed in the next section.

  • Edit the cartoweb3/projects/demoPlugins/demo.properties file.  and uncomment the line beginning with ;ROUTING_PLUGINS
  • Execute cw3setup.php file, with the –config-from-file option as described in the previous steps.

1.2.4. Locate Plugin specific installation

This plugin allows user to search features by their names, and recenter on them.

By typing the first letters of a name, user is given a list of corresponding names. Clicking on one of them recenters the map on it.

Note

In the locate.ini, you also need to specify the layers on which you want to do a search by name and the sql statements to request the database.

Tip

Ensure that the tables have the correct privileges (GRANT SELECT) in the database.

1.2.5. Plugins extensions further information

The aim of this part is to give you further informations on creation of demoPlugins and demoEdit plugins extensions. If you create a new plugin or adapt an existing one, we guess it will be helpful to take these plugins extensions for example or use one of these two resources:

1.2.5.1. demoRouting Extension

The routing module is a set of functions that compute a shortest path from a set of edges and vertices. Some functions are provided for importing data from geometric tables, and for generating results as geometries.

Note

For more information on these functions, you can have a look to the routing module README file http://www.cartoweb.org/downloads/pgdijkstra/README.txt.

This section explains the main steps to integrate the routing fonctionnalities in a custom application. We describe the steps followed to install the routing demo. To make short, we used an Europe roads shapefile, imported it in PostGIS, generated the graph tables and configured files to suggest a search of the shortest path between two European towns.

1.2.5.1.1. Europe Road Geodata Importation in PostGIS
$ shp2pgsql -I roadl.shp roads_europe > /tmp/roadl.sql
$ psql -d demo_plugins -f /tmp/roadl.sql
# Only lauch the following commmands if you did not import the town table already
$ shp2pgsql -I mispopp.shp town > /tmp/town.sql
$ psql -d demo_plugins -f /tmp/town.sql

1.2.5.1.2. Graph Importation

The first step is to add needed columns to the table roads_europe. To do so, you can type:

$ ALTER TABLE roads_europe ADD COLUMN source_id int;
$ ALTER TABLE roads_europe ADD COLUMN target_id int;
$ ALTER TABLE roads_europe ADD COLUMN edge_id int;
-- next line is to work around a pgdijkstra bug in update_cost_from_distance (fixed in latest CVS)
$ ALTER TABLE roads_europe RENAME id TO id_old;

You can then fill the columns source_id and target_id with the “assign_vertex_id” function.

$ SELECT assign_vertex_id('roads_europe', 1);

Here is the content of the roads_europe table:

$ SELECT gid, source_id, target_id, edge_id, AStext(the_geom) FROM roads_europe limit 3;

  gid  | source_id | target_id | edge_id |                              AStext
-------+-----------+-----------+---------+----------------------------------------------
 13115 |     11051 |     11099 |      14 | MULTILINESTRING((1062096.06 4861316.234,...))
 12869 |     10918 |     10916 |     267 | MULTILINESTRING((250681.597 4779596.532,...))
 12868 |     10918 |     10913 |     268 | MULTILINESTRING((250681.597 4779596.532,...))
(3 lignes)

But if the data quality is poor, you need to delete the duplicates edges (they have the same source-target pairs of vertices). For example, to check that you have duplicated edges, you can type:

$ SELECT * FROM (SELECT source_id, target_id, count(*) AS c FROM roads_europe group by
source_id, target_id order by c)
AS foo where foo.c = 2;

If there is duplicated edges, to delete one of two rows, you can type:

$ CREATE TABLE doublons AS SELECT * FROM roads_europe WHERE gid  in
(SELECT gid FROM (SELECT DISTINCT on (source_id, target_id) source_id, gid
FROM roads_europe) AS doublon);
$ DELETE FROM roads_europe;
$ INSERT INTO roads_europe (SELECT * FROM doublons);
$ DROP TABLE doublons;

The following step is to create and fill the edges and vertices tables of the resulting graph. To do so, you can use “create_graph_tables” function.

$ SELECT create_graph_tables('roads_europe', 'int4');
SELECT * FROM roads_europe_edges LIMIT 3;
 id | source | target | cost | reverse_cost
----+--------+--------+------+--------------
  1 |      1 |      2 |      |
  2 |      3 |      3 |      |
  4 |      2 |      2 |      |
(3 rows)

We can see that it contains NULL values for the cost column. The function update_cost_from_distance can update the cost column with the distance of the lines contained in the geometry table, attached to each edge:

$ SELECT update_cost_from_distance('roads_europe');

The costs are now:

 id | source | target |       cost       | reverse_cost
----+--------+--------+------------------+--------------
  1 |      1 |      2 | 6857.46585793103 |
  2 |      3 |      4 | 37349.9592156392 |
  3 |      5 |      6 | 14040.5673116933 |
(3 lignes)

Then you need to add the column which will contain the town labels, which will be shown in the drop-down list for selecting the two points of a path.

The label information is contained in the roads table which was originally imported using the shp2pgsql utility. The following commands will create a temporary table, fill it with the town information, and then update the vertices table. The towns contained in the shapefile may not be on the exact same point that the intersections of the roads. Thus, all intersections which are in a distance less that 2000 meters are associated to the town label. This distance may be adjusted according to the dataset you are using.

$ CREATE TABLE roads_source_town AS
   SELECT DISTINCT t.txt, source_id, distance(PointN(r.the_geom, 1), t.the_geom) AS d
     FROM roads_europe r, town t, roads_europe_vertices
     WHERE t.txt != 'UNK' AND distance(PointN(r.the_geom, 1), t.the_geom) < 2000
      AND geom_id = source_id ORDER BY t.txt, d;
$ CREATE TABLE roads_source_town_uniq AS
   SELECT * FROM roads_source_town a WHERE a.txt IN
     (SELECT b.txt FROM roads_source_town b where a.txt = b.txt LIMIT 1)
     AND a.d IN (SELECT b.d FROM roads_source_town b WHERE a.txt = b.txt LIMIT 1);
$ ALTER TABLE  roads_europe_vertices ADD COLUMN txt character varying(50);
$ SELECT AddGeometryColumn('','roads_europe_vertices','the_geom','-1','POINT',2);
$ UPDATE roads_europe_vertices SET txt = (SELECT DISTINCT txt
   FROM roads_source_town_uniq
    WHERE roads_europe_vertices.geom_id = roads_source_town_uniq.source_id);
-- clean the temporary tables
$ DROP TABLE roads_source_town;
$ DROP TABLE roads_source_town_uniq;

The last step is to fill the geometry column of the vertices table:

$ CREATE TABLE roads_europe_vertices_geom AS
    SELECT v.id, v.geom_id, v.txt,startPoint(geometryn(r.the_geom, 1)) AS
      the_geom FROM roads_europe r LEFT JOIN roads_europe_vertices v ON v.geom_id = r.source_id;
$ INSERT INTO roads_europe_vertices_geom
    SELECT v.id, v.geom_id, v.txt, endPoint(geometryn(r.the_geom, 1)) AS the_geom
      FROM roads_europe r LEFT JOIN roads_europe_vertices v ON v.geom_id = r.target_id;
$ DELETE FROM roads_europe_vertices;
$ INSERT INTO roads_europe_vertices SELECT DISTINCT ON (id) * FROM roads_europe_vertices_geom;
$ DROP TABLE roads_europe_vertices_geom;

Now, all is set up correctly for using the shortest path function on these data. But to include the routing fonctionnalities in a custom project, we also must respect some rules dictated by the routing plugin.

1.2.5.1.3. Routing Plugin Database Configuration

The two things to do are to:

  • create the routing results table. In this example the table is routing_results.
    $ CREATE TABLE routing_results (
        results_id integer,
        "timestamp" bigint,
        gid integer
      );
    $ SELECT AddGeometryColumn('','routing_results','the_geom','-1',
    'MULTILINESTRING',2);
  • create the ‘routing_results_seq’ sequence.
    $ CREATE SEQUENCE routing_results_seq
        INCREMENT 1
        MINVALUE 1
        MAXVALUE 9223372036854775807
        START 1
        CACHE 1;

1.2.5.1.4. Mapfile Configuration

In the mapfile, you must include the routing layer, its connection to the database, a symbology for the route and a first route using a unique identifier. The data parameter will be overwritten by the routing plugin to draw the route chosen by the end-user. Example:

LAYER
  NAME "graph"
  TYPE LINE
  TRANSPARENCY 80
  CONNECTIONTYPE postgis
    CONNECTION "user=@DB_USER@ password=@DB_PASSWD@ host=@DB_HOST@ dbname=@DB_NAME@"
    DATA "the_geom from (SELECT the_geom from routing_results) as foo using unique
    gid using srid=-1"
  TEMPLATE "t"
  CLASS
    NAME "0"
    STYLE
      SYMBOL "circle"
      SIZE 10
      COLOR 90 27 191
    END
  END
END

1.2.5.1.5. General Configuration

For the demo, we suggest that you select your route by starting from a town until an other town. This is possible because for each object of a european-towns layer, we have identified the nearest object of the roads_europe_vertices table. That is why in the demoRouting configuration there is a client-side configuration. Normally, in the plugin routing, client-side only allows you to type an id of object, from which to start and an other to finish the route. No configuration is needed. So, if you use demoRouting extension, you must specify client-side, the:

  • postgresRoutingVerticesTable: vertices table
  • stepName: vertices table col containing informations you want to propose a choice on
  • dsn: the connexion string to the database

Anyway, server-side, you must specify :

  • the routing table (postgresRoutingTable option),
  • the routing layer in the mapfile (postgresRoutingResultsLayer option),
  • the results routing table (postgresRoutingResultsTable),
  • the connexion string to the database (dsn option).
Share on Facebook
Posted in Cartoweb | Leave a comment

Create new projects in Cartoweb 3.3.0

Development Interface –> Cartoclient

Cartoweb3 Demo –> Cartoweb 3 Demonstration

1. Masuk ke dalam folder Projects di

c:wampwwwcartoweb3projects

rename sampleProjects or etc menjadi newProjects (coba)

* Edit client.ini –> mapId = coba

* Buka folder server_conf dan rename folder sampleProjects menjadi coba

2. Jalankan cmd, install newProjects

c:wampwwwcartoweb3> php cw3setup.php –install –base-url http://localhost/cartoweb3/htdocs/ –profile development –projects coba

3. Edit mapfile di serv_conf – coba

coba.map, coba.ini, layers.ini

4. Copy location.ini dari sampleFiles ke serv_conf/coba

5. Tambahkan coba.php di c:wampwwwcartoweb3htdocs

5. Done, tambahkan saja plugins jika ingin

Share on Facebook
Posted in Cartoweb | Leave a comment

p.mapper 3.1 beta-4

Upgrade Information for p.mapper versions

Upgrade 3.0 -> 3.1

PHP version

p.mapper 3.1 only runs fully on PHP 5.x with XML support because the attribute search requires PHP5 XML functions.

Attribute search

Define attribute search via /config/…/search.xml

<searchlist version="1.0">
    <searchitem name="cities" description="City">

        <layer type="shape" name="cities">

            <field type="s" name="CITY_NAME" description="City"  wildcard="0" />

        </layer>

    </searchitem>

</searchlist>

Create new <searchitem> for every layer you want to search.Parameters:

<searchitem>
  name: unique identifier, typically the same as layer name
  description: name visible in GUI
<layer>
  type: data source type, "shape" or "postgis"
  name: layer name in map file
<field>
  type: "s" for string field, "n" for numeric field
  name: field name in dataset
  description: name visible in GUI
  wildcard: "0": search always uses a 'non-exact' pattern matching;
            "1": requires that the user explicitly adds "*" for wildcards to his search string

config.ini

new config tags (if not set, default values are taken):

  • pm_search_configfile
  • autoIdentifyGroups
  • catInfoLink/grpInfoLink
  • catWithCheckbox
  • debugLevel
  • See the p.mapper manual for details.

php_config.php

Additionally to toolbars, now also DHTML menus are supported. The definition is done via the menu1 array. Multiple menus are possible. Menus are created in the map.phtml via the function call writemenu($menu1, "menu1", "Tools")

js_config.php

various JS specific settings are added. See the file itself and the descriptions of the parameters there.

Share on Facebook
Posted in pmapper | 13 Comments

Getting Started with MapGuide Version 1.1.x

 

Getting MapGuide Up and Running

To get MapGuide Open Source up and running on your system, follow these five steps:

1. Download and install the MapGuide Server and MapGuide Web Server Extensions.
For Windows visit the downloads page and download MgServerSetup-1.1.0.exe and MgWebServerExtensionsSetup-1.1.0.exe. Then follow the steps in the Installing MapGuide on Windows document to install the software.For Linux visit the MapGuide Open Source downloads page and the Feature Data Objects downloads page and download mapguideopensource-1.1.0.tar.gz, mapguideaptinstaller-1.1.0.tar.gz, and the FDO 3.2.0 tar.gz files. Then follow the steps in the Building MapGuide on Linux document to configure, make, and install the software.

2. Download and extract the sample application.
Visit the downloads page and download phpviewersample-1.1.zip. On Windows extract the files to C:Program FilesMapGuideOpenSourceWebServerExtensionswww. On Linux extract the files to /usr/local/mapguideopensource/webserverextensions/www. Note that in both cases it should create a folder called phpviewersample under www.
3. Download the sample data.
Visit the downloads page and download the resource package Sheboygan.mgp. On Windows copy the file to C:Program FilesMapGuideOpenSourceServerPackages. On Linux copy the file to /usr/local/mapguideopensource/server/packages.
4. Load the sample data using the Site Administrator application.
Open a web browser to the following URL: http://localhost:8008/mapguide/mapadmin/login.php. Login using the user id “Administrator” and the default password “admin”. When you see the Manage Servers page appear, select “Load Packages” in the left navigation bar. Select the radio button next to Sheboygan.mgp and click “Load Package”.
5. Launch the sample application.
Finally open a web browser to the following URL: http://localhost:8008/mapguide/phpviewersample/ajaxtiledviewersample.php to launch the sample application.

At this point you should have MapGuide Open Source up and running. To find out more read the rest of this guide, look through the FAQ, and visit the documentation page to view the developer documetation.

 

Components of the MapGuide Platform

The MapGuide Open Source platform consists of components that run in one of three tiers, as shown below. These components can all run on a single computer or may be distributed across multiple computers as shown in the diagram.

MapGuide Platform Components

MapGuide Server

The MapGuide Server hosts the MapGuide Open Source services and responds to requests from client applications through TCP/IP protocol. The server provides seven services : Site Service, Resource Service, Drawing Service, Feature Service, Mapping Service, Rendering Service, and Tile Service. If you are using a single server, that server performs all of these services. If you have more than one server, the site server always runs the first four services which handle data access and manage the resources for the site. The Mapping and Rendering services can be split off and allocated to other support servers. The MapGuide Server runs on either Microsoft Windows or Linux.

MapGuide Web Server Extensions

The MapGuide Web Server Extensions are internal components that have no UI but are accessed through the MapGuide Web API. The Web Extensions include a MapAgent CGI/Fast-CGI module that exposes the services offered by the MapGuide Server to client applications over the Internet or an intranet using the HTTP protocol. The MapGuide Web API supports three development languages/environments: ASP.NET, Java/JSP, and PHP. The MapGuide Web Server Extensions run on either Microsoft Windows or Linux and work with either the Apache Web Server or Microsoft IIS.

MapGuide Viewer

MapGuide Open Source offers two viewer technologies: a DWF™-based viewer and an AJAX-based viewer. Both viewer technologies offer a common user interface and expose a JavaScript API. That API is common between the two viewers, which allows applications to be written that will work equally well with either viewer.

  • DWF Viewer – The DWF Viewer embeds the downloadable Autodesk DWF Viewer which is based on a Microsoft ActiveX Control with full support for the Autodesk DWF format. This viewer works in Microsoft Internet Explorer only.
  • AJAX Viewer – The AJAX Viewer is a pure DHTML viewer based on AJAX technology that does not require any downloadable plug-ins. This viewer works in Microsoft Internet Explorer, Mozilla Firefox, and Safari.

Autodesk MapGuide™ Studio

MapGuide Studio is a commercial authoring tool for MapGuide Open Source offered by Autodesk. MapGuide Studio handles all aspects of preparing maps and geospatial data for use with MapGuide Open Source. Modeled after popular web development tools, Studio provides a unified environment that enables you to rapidly create spatial applications using an intuitive and familiar interface. MapGuide Studio runs only on Microsoft Windows. More information about MapGuide Studio and a downloadable trial version is available at: www.autodesk.com/mapguidestudio.

MapGuide Web Studio

MapGuide Web Studio is a web-based authoring tool for defining data source, layer and map resources. MapGuide Web Studio is an AJAX application that works across platforms and with multiple web browsers including FireFox, Safari, and Internet Explorer. Unlike MapGuide Studio, it is not a separate product component, but it is installed as a part of the MapGuide Web Server Extensions.

MapGuide Site Administrator

The MapGuide Site Administrator is an application for managing your site and its servers. This application uses a web-based interface that you can access from any web browser. To start the program, open a browser and enter: http://servername:port/mapguide/mapadmin/login.php, using the name of the site server and port that you specified during installation. You use the MapGuide Site Administrator to add and remove servers, take servers offline for maintenance, modify the configuration of a server, assign services to the servers, and monitor the status of any server. The MapGuide Site Administrator is not a separate product component, but it is installed as a part of the MapGuide Web Server Extensions.

Feature Data Objects

The Feature Data Objects (FDO) API is a set of commands for manipulating, defining, and analyzing geospatial information. MapGuide Open Source uses FDO to access data in a variety of geospatial data sources. An FDO Provider is a specific implementation of the FDO API. It is the software component that provides access to data in a particular data format or data store. FDO is a seperate open source project available from fdo.osgeo.org.

Share on Facebook
Posted in MapGuide OpenSource | 10 Comments

WFS Servers Mapfile

 This is WFS mapfile to put the data on GIS Client Software. e.g : MapServer
NAME DEMO
STATUS ON
SIZE 400 300
SYMBOLSET ../etc/symbols.sym
## ESPG:42304 extents:
EXTENT -2200000 -712631 3072800 3840000
## EPSG:42101 extents
#EXTENT -2200000 -2000000 3072800 2000000
UNITS METERS
SHAPEPATH “../data”
IMAGECOLOR 255 255 255
FONTSET ../etc/fonts.txt

#
# Start of web interface definition
#
WEB
# MINSCALE 2000000
# MAXSCALE 50000000
#
# On Windows systems, /tmp and /tmp/ms_tmp/ should be created at the root
# of the drive where the .MAP file resides.
#
IMAGEPATH “/ms4w/tmp/ms_tmp/”
IMAGEURL “/ms_tmp/”
# LOG “/tmp/gmap.log”
METADATA
“wfs_title” “GMap WFS Demo Server”
“wfs_srs” “EPSG:42304 EPSG:42101 EPSG:4269 EPSG:4326″ ## Recommended
END
END

PROJECTION
“init=epsg:42304″
END

#
# Start of reference map
#
REFERENCE
IMAGE images/keymap.png
#EPSG:42304 extents
EXTENT -2200000 -712631 3072800 3840000
#EPSG:42101 extents
# EXTENT -2200000 -2000000 3072800 2000000
STATUS ON
COLOR -1 -1 -1
OUTLINECOLOR 255 0 0
SIZE 120 90
END

#
# Start of legend
#
LEGEND
KEYSIZE 18 12
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 89
END
STATUS ON
END

#
# Start of scalebar
#
SCALEBAR
IMAGECOLOR 255 255 255
LABEL
COLOR 0 0 0
SIZE SMALL
END
SIZE 200 5
COLOR 255 255 255
BACKGROUNDCOLOR 0 0 0
OUTLINECOLOR 0 0 0
UNITS kilometers
INTERVALS 5
STATUS ON
END

QUERYMAP
STYLE HILITE
COLOR 255 0 0
END

#
# Start of layer definitions
#

LAYER
NAME park
METADATA
“wfs_title” “park”
“gml_featureid” “PARK_ID” ## REQUIRED
“gml_include_items” “all” ## Optional (serves all attributes for layer)
END
TYPE POLYGON
STATUS OFF
DATA park
PROJECTION
“init=epsg:42304″
END
## DUMP TRUE required for layer to be usable as WFS
DUMP TRUE
CLASS
NAME “park”
COLOR 200 255 0
OUTLINECOLOR 120 120 120
TEMPLATE “ttt_query.html”
END
TOLERANCE 5
END # Layer

LAYER
NAME popplace
METADATA
“wfs_title” “Cities”
“gml_featureid” “POPPLACE_I” ## REQUIRED
“gml_include_items” “all” ## Optional (serves all attributes for layer)
END
TYPE POINT
STATUS ON
DATA popplace
PROJECTION
“init=epsg:42304″
END
## DUMP TRUE required for layer to be usable as WFS
DUMP TRUE

CLASSITEM “Capital”
CLASS
EXPRESSION “1″
TEMPLATE “ttt_query.html”
SYMBOL 2
SIZE 8

NAME “Cities”
LABEL
COLOR 255 0 0
FONT fritqat-italic
TYPE truetype
SIZE 8
POSITION AUTO
PARTIALS FALSE
OUTLINECOLOR 255 255 255
END
COLOR 0 0 0
END
CLASS
EXPRESSION /2|3/
TEMPLATE “ttt_query.html”
SYMBOL 7
SIZE 6
NAME “Cities”
LABEL
COLOR 0 0 0
FONT fritqat
TYPE truetype
SIZE 8
POSITION AUTO
PARTIALS FALSE
OUTLINECOLOR 255 255 255
END
COLOR 0 0 0
END
TOLERANCE 5
END # Layer

END # Map File

Share on Facebook
Posted in MapServer | 2 Comments

Install pmapper

Quick install instructions for p.mapper 3.0

For more detailed documentation see the p.mapper manual

PHP Settings

PHP/MapScript Library and WebServer

Install the PHP/MapScript library in the appropriate place and configure your webserver to parse *.php and *.phtml files with PHP. Name the PHP/Mapscript extension accoring to the mapserver version, like php_mapscript_48.so (or php_mapscript_48.dll on Windows) for MapServer 4.8 See the documentation for PHP/MapScript and MapServer for details.

LIBICONV

PHP needs to be compiled with support of the ICONV library. This should be the default on Windows and Unix versions of PHP

PHP.INI

Under section [PHP] for Error handling and logging set

error_reporting = E_ALL & ~E_NOTICE

log_errors = On

error_log = ...: Set a valid file name writable by the webserver user. IMPORTANT!!!

See the PHP Manual for more details. In section [PHP] under the paragraph Paths and Directories set:

enable_dl = On

alternatively: load the Mapscript extension via the php.ini. This is also the required method on Windows both for IIS and Apache running PHP as module. The application uses PHP sessions to store user settings during the session. Modify the php.ini file to the following settings below section [Session]:

session.save_path = ... : Set a valid path writable by the webserver user

session.use_trans_sid = 0 : set to 0 in order to be compliant with W3C XHTML Strict

session.auto_start = 0

Note that for p.mapper 1 you have to set session.use_trans_sid to 1

Application settings

config/config.ini The main configuration for p.mapper is set under the subdirectory config in the file config.ini. Adapt following mandatory settings to your environment:

msVersion: e.g. for php_mapscript_48.so set to 48, for php_mapscript_4.10.0.dll set to 4.10.0

This setting can only be skipped if the php_mapscript extension is loaded via the php.ini (see above). mapFile: Map file location; 2 possibilities:

1) use absolute path to map file in file system (use slashes instead of backslashes) 2) filename only, if map file is under the directory specified at ‘pm_config_location’ (NEW in p.mapper 2.1.0)

allGroups: a comma-separated list of layers/groups available in the application
useCategories: if set to 1 the thematic categories and the assigned layers/groups

               have to be defined in "php_config.php"

General rule: if a layer belongs to a group, use the group name, otherwise use the layer name

Other settings

Directory /images/legend/

This directory has to be writeable for the user that runs the web server (used for automatic update of legend icons). On a Debian system for example, this could be achieved with the command

chown -R www-data /var/www/pmapper_demo/images/legend/

On Windows and IIS set the directory security properties to ‘Modify’ for user IUSR_hostname

Demo data

You can download the demo dataset (demodata.zip) and test p.mapper with the supplied map file pmapper_demo.map.

Map file

in pmapper_demo.map adapt settings for

MAP

  SHAPEPATH

  (FONTSET)

  (SYMBOLSET)WEB

  IMAGEPATH

  IMAGEURL

Start p.mapper

Starting p.mapper can be done via the map.phtml file or a link from index.html.

Share on Facebook
Posted in pmapper | 2 Comments