Giter Club home page Giter Club logo

mapwrap's Introduction

Map Wrap - MapServer wrapper

A MapServer CGI wrapper that simplifies the URLs to your WMS services and provides the following features:

  • defaults SERVICE to WMS
  • defaults REQUEST to GetCapabilities
  • allows for projection optimized mapfiles
  • accepts both POST and GET requests
  • simple name alias for a map
  • ghetto list of available MapServer maps

Why is that useful?

I like simple URLs to remember and hiding my secrets. Users do not need to know, and I should have to remember, the path to my mapfiles. I hate having to specify ?SERVICE=WMS&REQUEST=GetCapabilities when doing my sanity check with curl.

INSTALL:

To use this handy wrapper script you have to setup a few things.

  • create an user friendly alias (for your users, not you)

See apache config section below for example

  • configure the FUN_PREFIX to the prefix you choose

FUN_PREFIX = "/map"

  • point the CONFIG_FILE at the correct location (defaults to ../conf.yml)

CONFIG_FILE = "/path/to/mapwrap/conf.yml"

  • Creat the config file (see below)

  • tail -f error.log and access.log, reload apache

  • Check the output of a GetCapabilities:

curl 'http://localhost/map/example' | less

Apache Configuration

The following can be slide into appropriate Apache config section or /etc/httpd/conf.d/mapwrap.conf for a global configuration:

<Directory "/path/to/mapwrap/cgi-bin">
  AllowOverride None
  Options ExecCGI  FollowSymLinks
  AddHandler cgi-script .rb
  Order allow,deny
  Allow from all
</Directory>
# The following is the FUN_PREFIX=/map
Alias /map /path/to/mapwrap/cgi-bin/mapwrap.rb

Configuration: conf.yml

Hopefully the only part you have to maintain after you've set things up correctly. To get started just do a somple cp conf.yml.default conf.yml

mapserv: /opt/mapping_tools/bin/mapserv.svn
envsh: /opt/mapping_tools/setup.sh
maps:
  bluemarble: /www/wms/apps/mapserver/maps/bluemarble.map
  example: /www/wms/apps/mapserver/maps/bluemarble.map
  spot_pan:
    default: /www/wms/apps/mapserver/maps/spot_pan.map
    900913: /www/wms/apps/mapserver/maps/spot_pan-900913.map

The mapserv and envsh options are optional. If you have a good CGI environment with mapserv and libraries available then delete those lines.

The maps section takes a name and a path to a mapfile. If you want to have an optimized mapfile for multiple pre-projected datasets then break it apart with a default line and a line for each EPSG code you've got.

Credit where credit is due

mapwrap's People

Contributors

dayne avatar spruceboy avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.