Geo-OGC-Service
view release on metacpan or search on metacpan
lib/Geo/OGC/Service.pm view on Meta::CPAN
A Geo::OGC::Service object creates a specialized service object as a
result of a web service request. The specialized service object is a
hash reference blessed into an appropriate class (the class is deduced
from GET parameter, POSTed service name, or from the script name in
the case of RESTful services). The new object contains keys env,
request, plugin, config, service, and optionally posted, filter, and
parameters.
=over
=item env
The PSGI $env.
=item request
A Plack::Request object constructed from the $env;
=item plugin
The plugin object given as an argument to Geo::OGC::Service in its
constructor as a top level attribute or as a service specific
attribute.
=item config
The constructed configuration for the web service.
=item service
The name of the requested service.
=item parameters
A hash made from Plack::Request->parameters (thus removing its multi
value nature). The keys are all converted to lower case and the values
are decoded to Perl's internal format assuming they are in the
encoding defined $request->content_encoding (or UTF-8).
=item posted
A XML::LibXML documentElement of the POSTed XML. The XML is decoded
into Perl's internal format.
=item filter
A XML::LibXML documentElement contructed from a filter GET
parameter. The XML is decoded into Perl's internal format.
=back
=head2 SERVICE CONFIGURATION
Setting up a PSGI service consists typically of three things:
1) write a service.psgi file (see above) and put it somewhere like
/var/www/service/service.psgi
2) Set up starman service and add to its init-file line something like
exec starman --daemonize --error-log /var/log/starman/log --l localhost:5000 /var/www/service/service.psgi
3) Add a proxy service to your httpd configuration. For Apache it
would be something like this:
<Location /Service>
ProxyPass http://localhost:5000
ProxyPassReverse http://localhost:5000
</Location>
Setting up a geospatial web service through this module requires a
configuration file, for example
/var/www/etc/service.conf
(make sure this file is not served by your httpd)
The configuration must be in JSON format. I.e., something like
{
Common: {
"CORS": {
"Allow-Origin" : "*",
"Allow-Headers" : "Content-Type, X-Requested-With"
},
"Content-Type": "text/xml; charset=utf-8",
"TARGET_NAMESPACE": "http://ogr.maptools.org/"
},
WFS: {
"resource": "http://$HTTP_HOST/WFS",
"version": "1.1.0",
"TARGET_NAMESPACE": "http://ogr.maptools.org/",
"PREFIX": "ogr",
"Transaction": "Insert,Update,Delete",
"FeatureTypeList": [
{
}
]
},
"WMS": {
"resource": "http://$HTTP_HOST/WMS"
},
"TMS": {
"resource": "http://$HTTP_HOST/TMS"
},
"WMTS": {
"resource": "http://$HTTP_HOST/WMTS"
},
"TileSets": [
],
"BoundingBox3857": {
"SRS": "EPSG:3857",
"minx": 2399767,
"miny": 8645741,
"maxx": 2473612,
"maxy": 8688005
}
}
The keys and structure of this file depend on the type of the
service(s) you are setting up. "CORS" is the only one that is
( run in 3.146 seconds using v1.01-cache-2.11-cpan-e93a5daba3e )