A Rails app to create legend resources for existing ArcGIS Server map services
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/backends
.gitignore
.rvmrc
Gemfile
Gemfile.lock
README
amazon_s3.yml
config.ru
gstore.yml
index.html
legend_resource.rb

README

legend_resource - a Rails 3 app that creates legends for ArcGIS Server map services

The idea behind legend_resource is to create a no-config option for creating legend
images for ArcGIS Server services.  This uses the arcserver.rb and gstore gems.

# Installation

1) Fork/clone this github repo
2) cd into legend_resource dir
3) bundle install (If you get a message about Bundler versions, use gem install bundler --pre)
4) Deploy or start the server (rackup)

# Config options.
There is a Google Storage backend. To use it:
1) Change gstore.yml and modify the access/secret key and bucket information.
2) Uncomment the line in config.ru that sets the filehandler

There is an S3 Backend. To use it:
1) Change amazon_s3.yml and modify the access/secret key and bucket information.
2) Uncomment the line in config.ru that sets the filehandler

(I know this isn't very Ruby way-ish, but I am still learning....)

By default, the sinatra app just uses the File module to write images to the file system.

# Windows users
If you are on Windows, your life is a bit harder (for various reasons ;))  You'll have to manually install
the rmagick gem...go here to find out how http://rmagick.rubyforge.org/install-faq.html#win

# Usage
Presuming your app is running at http://localhost:3000 and you want a legend for a 
map service running at http://server.arcgisonline.com/ArcGIS/services/Demographics/ESRI_Diversity_US_2D/MapServer

## Getting a Legend
- Issue an HTTP GET to http://localhost:3000/legend/server.arcgisonline.com/Demographics/ESRI_Diversity_US_2D
--This will create a PNG image of the legend.  NOTE:  All subsequent calls to this URL will return the cached
image. 

## Deleting a Legend
- Issue an HTTP DELETE to http://localhost:3000/legend/server.arcgisonline.com/Demographics/ESRI_Diversity_US_2D
-- This will delete the cached image.  The next HTTP GET to this URL will create a new one.  I use curl for this

That's it for now.  It didn't make sense to me to add PUT or POST actions to the resource, since it generates the
legend.  Maybe a future version will allow you to PUT a legend for a service...

Glenn