Differences between revisions 8 and 9
Revision 8 as of 2006-05-31 22:19:37
Size: 8035
Editor: lns-bzn-60-82-254-204-219
Comment: link to png source code changed
Revision 9 as of 2009-09-20 23:46:27
Size: 8063
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
 * [http://cvs.gis.umn.edu/dist/mapserver-4.6.1.tar.gz MapServer-4.6.1 source code]
 * [http://www.boutell.com/gd/http/gd-2.0.33.tar.gz GD-2.0.33 source code]
 * [http://www.gdal.org/dl/gdal-1.3.1.tar.gz GDAL-1.3.1 source code]
 * [http://download.savannah.gnu.org/releases/freetype/freetype-2.1.10.tar.gz Freetype-2.1.10 source code]
 * [http://www.ijg.org/files/jpegsrc.v6b.tar.gz Jpeg-6b source code]
 * [ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.10.tar.gz Png-1.2.10 source code]

Linux users can also use the [http://www.maptools.org/fgs/ fgs] package provided by [http://www.maptools.org].

Windows users can use the [http://www.maptools.org/ms4w/ ms4w] package provided by [http://www.maptools.org].

Mac OS users will find help [http://www.kyngchaos.com/macosx/mapservinstall.php here].
 * [[http://cvs.gis.umn.edu/dist/mapserver-4.6.1.tar.gz|MapServer-4.6.1 source code]]
 * [[http://www.boutell.com/gd/http/gd-2.0.33.tar.gz|GD-2.0.33 source code]]
 * [[http://www.gdal.org/dl/gdal-1.3.1.tar.gz|GDAL-1.3.1 source code]]
 * [[http://download.savannah.gnu.org/releases/freetype/freetype-2.1.10.tar.gz|Freetype-2.1.10 source code]]
 * [[http://www.ijg.org/files/jpegsrc.v6b.tar.gz|Jpeg-6b source code]]
 * [[ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.10.tar.gz|Png-1.2.10 source code]]

Linux users can also use the [[http://www.maptools.org/fgs/|fgs]] package provided by [[http://www.maptools.org]].

Windows users can use the [[http://www.maptools.org/ms4w/|ms4w]] package provided by [[http://www.maptools.org]].

Mac OS users will find help [[http://www.kyngchaos.com/macosx/mapservinstall.php|here]].
Line 27: Line 27:
The MapServer [http://maps.dnr.state.mn.us/mapserver_demos/workshop.zip demo] includes some sample geographic data. The MapServer [[http://maps.dnr.state.mn.us/mapserver_demos/workshop.zip|demo]] includes some sample geographic data.
Line 207: Line 207:
[http://wiki.apache.org/portals/Jetspeed2/QuickstartForTheImpatient QuickStartForTheImpatient] [[http://wiki.apache.org/portals/Jetspeed2/QuickstartForTheImpatient|QuickStartForTheImpatient]]
Line 213: Line 213:
[http://mapserver.gis.umn.edu/ MapServer Homepage] [[http://mapserver.gis.umn.edu/|MapServer Homepage]]

Requirements

A MapServer portlet requires the following elements:

MapServer Software

MapServer (Open source with a simplified BSD license) is a C program therfore you must obtain the proper version for your target operating system. Linux and Unix users will find that downloading the source and compiling it is the simplest alternative. Listed here are links to MapServer source and its required dependencies. Build each of these packages using the ./configure, make, and sudo make install commands. Building MapServer will tell you which dependencies are missing on your system.

Linux users can also use the fgs package provided by http://www.maptools.org.

Windows users can use the ms4w package provided by http://www.maptools.org.

Mac OS users will find help here.

Geographic Data

The MapServer demo includes some sample geographic data.

MapServer Configuration

MapServer is configured using a MapFile. The demo configuration file is itasca.map.

Apache Portal Bridge for MapServer

A contribution to the Apache Portal Bridges project yeilded a component capable of executing the MapServer program. This bridge uses the portlet initalization parameters to determine the inital map. MapScript for Java JNI is on the roadmap.

Jetspeed Configuration

Running a MapServer portlet requires modification to the chosen portlet web application.

Add MapServer Bridge to project.xml

<project>
    <extend>${basedir}/../../project.xml</extend>
    <pomVersion>3</pomVersion>
    <artifactId>map-portlet</artifactId>
    <name>MapServer Portlet Demo</name>
    <package>org.apache.portals.webapp.example</package>
    <description>MapServer Portlet Demo</description>
    <shortDescription>MapServer Portlet Demo</shortDescription>

    <repository>
        <connection>scm:svn:http://svn.apache.org/repos/asf/portals/bridges/trunk/applications/map-portlet</connection>
        <developerConnection>
            scm:svn:https://svn.apache.org/repos/asf/portals/bridges/trunk/applications/map-portlet
        </developerConnection>
        <url>http://svn.apache.org/viewcvs.cgi/portals/bridges/trunk/applications/map-portlet/</url>
    </repository>

    <dependencies>
        <dependency>
            <id>portlet-api</id>
            <version>1.0</version>
            <properties>
                <war.bundle>false</war.bundle>
            </properties>
        </dependency>
        <dependency>
          <id>org.apache.portals.bridges:portals-bridges-mapserver</id>
            <version>${portals.bridges.mapserver.version}</version>
            <properties>
                <war.bundle>true</war.bundle>
            </properties>
        </dependency>
    </dependencies>

</project>

Install the MapServer demo and data

Copy the MapServer demo to your web application source.

cd $JETSPEED2_SRC/applications/demo/src/webapp
unzip workshop.zip

NOTE: Some simple modification need to be made to the default itasca.map file.

Change this:

  TEMPLATEPATTERN "itasca"

To This:

  #TEMPLATEPATTERN "itasca"

Change this:

    HEADER templates/header.html
    FOOTER templates/footer.html

To This:

    #HEADER templates/header.html
    TEMPLATE "itasca_basic.html"
    #FOOTER templates/footer.html

And the itasca_basic.html page should only contain a fragment of html. Keep all content from <form> to </form> and delete the rest of the template.

Add a fragment to an existing psml

Or create a new one.

<page id="mapserver">
  <defaults
     skin="orange"
     layout-decorator="tigris"
     portlet-decorator="gray-gradient"
  />
  <title>MapServer Demo</title>
  <metadata name="title" xml:lang="ja">MapServer デモ</metadata>
  <metadata name="title" xml:lang="es">Demo de portlets de MapServer</metadata>
  <metadata name="short-title" xml:lang="es">Demo MapServer</metadata>
  <metadata name="title" xml:lang="hu">MapServer hírolvasó</metadata>
  <metadata name="title" xml:lang="zh">MapServer 示例</metadata>
  <fragment id="mapserver-1" type="layout" name="jetspeed-layouts::VelocityTwoColumns">
    <fragment id="mapserver-101" type="portlet" name="demo::MapServerDemoPortlet">
      <property layout="TwoColumns" name="row" value="0" />
      <property layout="TwoColumns" name="column" value="0" />
    </fragment>
  </fragment>

  <security-constraints>
    <security-constraints-ref>public-view</security-constraints-ref>
  </security-constraints>
</page>

Add portlet definition to portlet.xml

Configure the parameters MapServBinary, MapFile, and Program according to your installation.

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app id="msportlet" version="1.0">
    <portlet id="MapServerDemoPortlet">
        <init-param>
          <name>MapServBinary</name>
          <value>/home/opensource/soft/bin/httpd/cgi-bin/mapserv</value>
        </init-param>
        <init-param>
          <name>Layers</name>
          <value>lakespy2</value>
        </init-param>
        <init-param>
          <name>ZoomDirection</name>
          <value>1</value>
        </init-param>
        <init-param>
          <name>ZoomSize</name>
          <value>2</value>
        </init-param>
        <init-param>
          <name>MapFile</name>
          <value>/home/opensource/soft/bin/apache-tomcat-5.5.12/webapps/demo/workshop/itasca.map</value>
        </init-param>
        <init-param>
          <name>Program</name>
          <value>/jetspeed/portal/map.psml</value>
        </init-param>
        <init-param>
          <name>RootURL</name>
          <value>/demo/workshop</value>
        </init-param>
        <init-param>
          <name>MapWebImagePath</name>
          <value>/home/opensource/soft/bin/apache-tomcat-5.5.12/webapps/demo/workshop/tmp/</value>
        </init-param>
        <init-param>
          <name>MapWebImageURL</name>
          <value>/demo/workshop/tmp/</value>
        </init-param>
        <init-param>
          <name>MapWebTemplate</name>
          <value>templates/itasca_basic.html</value>
        </init-param>
        <portlet-name>MapServerDemoPortlet</portlet-name>
        <display-name>MapServer Demo Portlet</display-name>
        <portlet-class>org.apache.portals.bridges.mapserver.MapServerPortlet</portlet-class>
        <expiration-cache>-1</expiration-cache>
        <supports>
            <mime-type>text/html</mime-type>
            <portlet-mode>VIEW</portlet-mode>
        </supports>
        <portlet-info>
            <title>Map Server Portlet</title>
            <short-title>MapServer Portlet Demo</short-title>
        </portlet-info>
    </portlet>
</portlet-app>

Rebuild and deploy Jetspeed

QuickStartForTheImpatient

References

See the Jira issue to integrate this into the Jetspeed2 source (http://issues.apache.org/jira/browse/JS2-410).

MapServer Homepage

MapServerPortlet (last edited 2009-09-20 23:46:27 by localhost)