Class: RubyMapscript::Mapserver
- Inherits:
-
Object
- Object
- RubyMapscript::Mapserver
- Defined in:
- lib/ruby_mapscript/mapserver.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(mapfile) ⇒ Mapserver
constructor
A new instance of Mapserver.
Constructor Details
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ruby_mapscript/mapserver.rb', line 14 def call(env) req = Mapscript::OWSRequest.new %w(REQUEST_METHOD QUERY_STRING HTTP_COOKIE).each do |var| ENV[var] = env[var] end req.loadParams #Returns the number of name/value pairs collected. #Warning: most errors will result in a process exit! # redirect stdout & handle request Mapscript::msIO_installStdoutToBuffer() retval = @wms.OWSDispatch(req) #Returns MS_DONE (2) if there is no valid OWS request in the req object, # MS_SUCCESS (0) if an OWS request was successfully processed and # MS_FAILURE (1) if an OWS request was not successfully processed. content_type = Mapscript::msIO_stripStdoutBufferContentType() map_image = Mapscript::msIO_getStdoutBufferBytes() Mapscript::msIO_resetHandlers() [200, {'Content-Type' => content_type}, map_image] end |