REFINE QGIS MAPSERVER CONFIGURATION; HISTO PATCH
- Drop the crude Lighty configuration - Use Rewrite in Apache configuration and improve README - Add histogram patch, marked to be backported
This commit is contained in:
parent
cdf98c4b72
commit
100f02a117
36
qgis-1.7.0-histogram.patch
Normal file
36
qgis-1.7.0-histogram.patch
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
diff --git a/src/core/raster/qgsrasterlayer.cpp b/src/core/raster/qgsrasterlayer.cpp
|
||||||
|
index 32455e8..92c056c 100644
|
||||||
|
--- a/src/core/raster/qgsrasterlayer.cpp
|
||||||
|
+++ b/src/core/raster/qgsrasterlayer.cpp
|
||||||
|
@@ -2345,7 +2345,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider,
|
||||||
|
myRasterBandStats.bandName = mDataProvider->generateBandName( i );
|
||||||
|
myRasterBandStats.bandNumber = i;
|
||||||
|
myRasterBandStats.statsGathered = false;
|
||||||
|
- myRasterBandStats.histogramVector = new QgsRasterBandStats::HistogramVector();
|
||||||
|
+ myRasterBandStats.histogramVector->clear();
|
||||||
|
//Store the default color table
|
||||||
|
//readColorTable( i, &myRasterBandStats.colorTable );
|
||||||
|
QList<QgsColorRampShader::ColorRampItem> ct;
|
||||||
|
diff --git a/src/providers/gdal/qgsgdalprovider.cpp b/src/providers/gdal/qgsgdalprovider.cpp
|
||||||
|
index 51fb786..57d1851 100644
|
||||||
|
--- a/src/providers/gdal/qgsgdalprovider.cpp
|
||||||
|
+++ b/src/providers/gdal/qgsgdalprovider.cpp
|
||||||
|
@@ -1320,8 +1320,16 @@ void QgsGdalProvider::populateHistogram( int theBandNo, QgsRasterBandStats & t
|
||||||
|
|
||||||
|
for ( int myBin = 0; myBin < theBinCount; myBin++ )
|
||||||
|
{
|
||||||
|
- theBandStats.histogramVector->push_back( myHistogramArray[myBin] );
|
||||||
|
- QgsDebugMsg( "Added " + QString::number( myHistogramArray[myBin] ) + " to histogram vector" );
|
||||||
|
+ if ( myHistogramArray[myBin] < 0 ) //can't have less than 0 pixels of any value
|
||||||
|
+ {
|
||||||
|
+ theBandStats.histogramVector->push_back( 0 );
|
||||||
|
+ QgsDebugMsg( "Added 0 to histogram vector as freq was negative!" );
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ theBandStats.histogramVector->push_back( myHistogramArray[myBin] );
|
||||||
|
+ QgsDebugMsg( "Added " + QString::number( myHistogramArray[myBin] ) + " to histogram vector" );
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,35 +1,60 @@
|
||||||
QGIS Mapserver originally has two configuration files, located in the
|
==================================================
|
||||||
same directory as the FCGI binary:
|
QGIS Mapserver (might be renamed to "QGIS server")
|
||||||
|
==================================================
|
||||||
|
|
||||||
|
QGIS Mapserver allows you to publish your QGIS projects as Web Map
|
||||||
|
Services (WMS). Simply layout your map in QGIS. The WMS will look
|
||||||
|
exactly the same, because QGIS Mapserver uses the same libraries for
|
||||||
|
rendering, as the desktop application does.
|
||||||
|
|
||||||
|
A sample configuration file for Httpd is installed under
|
||||||
|
/etc/httpd/conf.d/qgis-mapserver.conf.
|
||||||
|
|
||||||
|
This configuration expects QGIS project files under /var/www/wms. To
|
||||||
|
use it, reload the Httpd configuration and place the files you want to
|
||||||
|
publish in this directory.
|
||||||
|
|
||||||
|
A getCapabilities request looks like this:
|
||||||
|
|
||||||
|
http://localhost/wms/my_qgis_project?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0
|
||||||
|
|
||||||
|
QGIS project is "/var/www/wms/my_qgis_project.qgs". The sample
|
||||||
|
configuration automatically adds the project file extension for you.
|
||||||
|
|
||||||
|
The actual data can stay where it is. Make sure QGIS Mapserver can
|
||||||
|
access the project file and don't forget to let Httpd reload its
|
||||||
|
configuration before sending your requests!
|
||||||
|
|
||||||
|
Please fill in the metadata tab for your QGIS project.
|
||||||
|
|
||||||
|
You can easily test your WMS by adding it as a WMS layer in QGIS.
|
||||||
|
|
||||||
|
==================================================
|
||||||
|
|
||||||
|
The traditional QGIS Mapserver configuration is less comfortable and
|
||||||
|
I don't encourage it, unless you have a good reason to use it:
|
||||||
|
|
||||||
|
This approach only allows for a single map service.
|
||||||
|
|
||||||
|
It uses two configuration files, that must be located in the same
|
||||||
|
directory as the FCGI binary:
|
||||||
|
|
||||||
- admin.sld
|
- admin.sld
|
||||||
- wms_metadata.xml
|
- wms_metadata.xml
|
||||||
|
|
||||||
The binary only accepts them, when they are located in the same directory.
|
|
||||||
|
|
||||||
"admin.sld" uses extended SLD syntax (Style Layer Descriptor) to
|
"admin.sld" uses extended SLD syntax (Style Layer Descriptor) to
|
||||||
describe symbolization of data. It's more comfortable though, to
|
describe symbolization of data.
|
||||||
layout your map in QGIS and just use a .qgs (QGIS project) to describe
|
|
||||||
your map. This approach also allows for multiple map services, because
|
|
||||||
the Mapserver accepts the path to a QGIS project as a HTTP Get
|
|
||||||
parameter.
|
|
||||||
|
|
||||||
A getCapabilities request looks like this, if you use the supplied
|
"wms_metadata.xml" supplies metadata for your WMS. You may also use this
|
||||||
sample configuration:
|
file with the kind of configuration mentioned on top. But if you want to
|
||||||
|
serve different projects, and metadata varies between them, that file
|
||||||
http://localhost/qgis/qgis_mapserv.fcgi?MAP=/var/www/html/my_first_map.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
|
won't work for you. Please see above for how to define project specific
|
||||||
|
metadata!
|
||||||
/var/www/html/my_first_map.qgs is the assumed location of your QGIS
|
|
||||||
project file. The actual data can stay where it is. Make sure QGIS
|
|
||||||
Mapserver can access the project file and don't forget to let Httpd
|
|
||||||
reload its configuration before sending your requests!
|
|
||||||
|
|
||||||
"wms_metadata.xml" supplies metadata for your WMS. If you serve different
|
|
||||||
projects, metadata may vary, so that file won't work for you. Try to fill
|
|
||||||
in on the metadata tab of your QGIS project. It is not that complete
|
|
||||||
though, but enhancement is planned, Marco Hugentobler said.
|
|
||||||
|
|
||||||
Both configuration files are included as documentation.
|
Both configuration files are included as documentation.
|
||||||
|
|
||||||
|
==================================================
|
||||||
|
|
||||||
Further information: http://karlinapp.ethz.ch/qgis_wms
|
Further information: http://karlinapp.ethz.ch/qgis_wms
|
||||||
|
|
||||||
Volker Fröhlich
|
Volker Fröhlich
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
|
# This configuration is intended as an example.
|
||||||
# Last Modified: 11-26-2005
|
# It is not meant for productive use.
|
||||||
#
|
|
||||||
# This file contains examples of entries that need
|
|
||||||
# to be incorporated into your Apache web server
|
|
||||||
# configuration file. Customize the paths, etc. as
|
|
||||||
# needed to fit your system.
|
|
||||||
|
|
||||||
ScriptAlias /qgis/ "/usr/libexec/qgis"
|
RewriteEngine on
|
||||||
|
RewriteRule ^/wms/(.+)$ /qgis/qgis_mapserv.fcgi?map=/var/www/wms/$1.qgs [QSA,PT]
|
||||||
|
|
||||||
|
ScriptAlias /qgis/ "/usr/libexec/qgis/"
|
||||||
|
|
||||||
<Directory "/usr/libexec/qgis/">
|
<Directory "/usr/libexec/qgis/">
|
||||||
Options ExecCGI
|
Options ExecCGI
|
||||||
AllowOverride None
|
Options FollowSymLinks
|
||||||
Order allow,deny
|
Order deny,allow
|
||||||
Allow from all
|
Deny from all
|
||||||
Order deny,allow
|
Allow from 127.0.0.1
|
||||||
Deny from all
|
|
||||||
Allow from 127.0.0.1
|
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
fastcgi.server = ( "/maps" =>
|
|
||||||
( "localhost" =>
|
|
||||||
(
|
|
||||||
"check-local" => "disable",
|
|
||||||
"bin-path" => "/usr/libexec/qgis/qgis_mapserv.fcgi",
|
|
||||||
"socket" => "/var/run/lighttpd/qgis-fastcgi.socket",
|
|
||||||
"max-load-per-proc" => 4,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
#"socket" => "/tmp/mapserver-fastcgi.socket",
|
|
43
qgis.spec
43
qgis.spec
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
Name: qgis
|
Name: qgis
|
||||||
Version: 1.7.0
|
Version: 1.7.0
|
||||||
Release: 1%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: A user friendly Open Source Geographic Information System
|
Summary: A user friendly Open Source Geographic Information System
|
||||||
|
|
||||||
Group: Applications/Engineering
|
Group: Applications/Engineering
|
||||||
|
@ -20,7 +20,6 @@ Source1: %{name}.desktop
|
||||||
|
|
||||||
# Sample configuration files for QGIS mapserver
|
# Sample configuration files for QGIS mapserver
|
||||||
Source2: %{name}-mapserver-httpd.conf
|
Source2: %{name}-mapserver-httpd.conf
|
||||||
Source3: %{name}-mapserver-lighttpd.conf
|
|
||||||
Source4: %{name}-mapserver-README.fedora
|
Source4: %{name}-mapserver-README.fedora
|
||||||
|
|
||||||
# MIME definitions
|
# MIME definitions
|
||||||
|
@ -33,6 +32,10 @@ Patch0: qgis-1.5.0-grass.patch
|
||||||
# Avoid segfault when geo-referencing
|
# Avoid segfault when geo-referencing
|
||||||
Patch1: %{name}-1.7.0-georef-crash.patch
|
Patch1: %{name}-1.7.0-georef-crash.patch
|
||||||
|
|
||||||
|
# https://github.com/qgis/Quantum-GIS/commit/834fc0b710171a80a29038f74ad2c603bf015424
|
||||||
|
# Remove potential memory leak and negative frequencies in histogram
|
||||||
|
Patch2: %{name}-1.7.0-histogram.patch
|
||||||
|
|
||||||
# Leaving it to make life easier for ELGIS, as long as they target RHEL 5
|
# Leaving it to make life easier for ELGIS, as long as they target RHEL 5
|
||||||
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||||
|
|
||||||
|
@ -142,14 +145,19 @@ The services are prepared as regular projects in QGIS. They're rendered using
|
||||||
the QGIS libraries. The server also supports SLD (Styled Layer Descriptor)
|
the QGIS libraries. The server also supports SLD (Styled Layer Descriptor)
|
||||||
for styling. Sample configurations for Httpd and Lighttpd are included.
|
for styling. Sample configurations for Httpd and Lighttpd are included.
|
||||||
|
|
||||||
|
Please refer to %{name}-mapserver-README.fedora for details!
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1 -b .grass
|
%patch0 -p1 -b .grass
|
||||||
%patch1 -p1 -b .georef
|
%patch1 -p1 -b .georef
|
||||||
|
%patch2 -p1 -b .histogram
|
||||||
|
|
||||||
|
#TODO: Update FSF address or ship a GPLv3+ license file
|
||||||
|
# http://hub.qgis.org/issues/3789
|
||||||
|
|
||||||
# Readme file for QGIS mapserver configuration and Lighttpd sample
|
# Readme file for QGIS mapserver configuration and Lighttpd sample
|
||||||
install -pm0644 %{SOURCE4} .
|
install -pm0644 %{SOURCE4} .
|
||||||
install -pm0644 %{SOURCE3} .
|
|
||||||
|
|
||||||
# Delete bundled libspatialite
|
# Delete bundled libspatialite
|
||||||
rm -rf src/core/spatialite
|
rm -rf src/core/spatialite
|
||||||
|
@ -183,8 +191,10 @@ rm -rf src/core/spatialite
|
||||||
#-D WITH_INTERNAL_QWTPOLAR:BOOL=FALSE \
|
#-D WITH_INTERNAL_QWTPOLAR:BOOL=FALSE \
|
||||||
|
|
||||||
# Parallel make leads to race conditions
|
# Parallel make leads to race conditions
|
||||||
#make %{?_smp_mflags}
|
# http://hub.qgis.org/issues/2880
|
||||||
make
|
#make
|
||||||
|
# Seems to be fine from version 1.7 on
|
||||||
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
@ -255,12 +265,21 @@ rm -rf %{buildroot}
|
||||||
|
|
||||||
%post
|
%post
|
||||||
/sbin/ldconfig
|
/sbin/ldconfig
|
||||||
|
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
|
||||||
update-mime-database %{_datadir}/mime &> /dev/null || :
|
update-mime-database %{_datadir}/mime &> /dev/null || :
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
/sbin/ldconfig
|
/sbin/ldconfig
|
||||||
|
if [ $1 -eq 0 ] ; then
|
||||||
|
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
|
||||||
|
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||||
|
fi
|
||||||
|
|
||||||
update-mime-database %{_datadir}/mime &> /dev/null || :
|
update-mime-database %{_datadir}/mime &> /dev/null || :
|
||||||
|
|
||||||
|
%posttrans
|
||||||
|
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||||
|
|
||||||
%if ! 0%{?rhel}
|
%if ! 0%{?rhel}
|
||||||
%post grass -p /sbin/ldconfig
|
%post grass -p /sbin/ldconfig
|
||||||
|
|
||||||
|
@ -272,7 +291,6 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
|
||||||
%postun python -p /sbin/ldconfig
|
%postun python -p /sbin/ldconfig
|
||||||
|
|
||||||
%files -f %{name}.lang
|
%files -f %{name}.lang
|
||||||
#TODO: Update FSF address or ship a GPLv3+ license file
|
|
||||||
#TODO: Encoding problem on the help page
|
#TODO: Encoding problem on the help page
|
||||||
# CONTRIBUTORS and AUTHORS are intended be viewed in the About-Box
|
# CONTRIBUTORS and AUTHORS are intended be viewed in the About-Box
|
||||||
%doc BUGS ChangeLog CODING COPYING Exception_to_GPL_for_Qt.txt PROVENANCE README
|
%doc BUGS ChangeLog CODING COPYING Exception_to_GPL_for_Qt.txt PROVENANCE README
|
||||||
|
@ -327,11 +345,22 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
|
||||||
|
|
||||||
%files mapserver
|
%files mapserver
|
||||||
%doc src/mapserver/admin.sld src/mapserver/wms_metadata.xml %{name}-mapserver-README.fedora
|
%doc src/mapserver/admin.sld src/mapserver/wms_metadata.xml %{name}-mapserver-README.fedora
|
||||||
%doc %{name}-mapserver-lighttpd.conf
|
|
||||||
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}-mapserver.conf
|
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}-mapserver.conf
|
||||||
%{_libexecdir}/%{name}
|
%{_libexecdir}/%{name}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jul 06 2011 Volker Fröhlich <volker27@gmx.at> - 1.7.0-3
|
||||||
|
- Withdraw immature Lighty configuration
|
||||||
|
- Update README and provide a better sample configuration,
|
||||||
|
that utilizes mod_rewrite
|
||||||
|
|
||||||
|
* Mon Jun 26 2011 Volker Fröhlich <volker27@gmx.at> - 1.7.0-2
|
||||||
|
- Add histogram patch
|
||||||
|
- Add scriplets to refresh icon cache
|
||||||
|
- Mention Fedora specific readme file in QGIS mapserver description
|
||||||
|
- Update the aforementioned file and the Apache configuration
|
||||||
|
with rewrite rules
|
||||||
|
|
||||||
* Mon Jun 26 2011 Volker Fröhlich <volker27@gmx.at> - 1.7.0-1
|
* Mon Jun 26 2011 Volker Fröhlich <volker27@gmx.at> - 1.7.0-1
|
||||||
- Update for 1.7
|
- Update for 1.7
|
||||||
- License is now GPLv3+ (Sqlanyconnect)
|
- License is now GPLv3+ (Sqlanyconnect)
|
||||||
|
|
Reference in New Issue
Block a user