[mapserver-users] maxscale (denom) with gml ?
bpicinbono at worldonline.fr
bpicinbono at worldonline.fr
Mon Dec 1 13:05:49 PST 2014
Many thanks for investigating;
please check below the relevant parts of the mapfile,
as well as the openlayers related code;
(the purpose is to display nooa gfs winds forecasts, "vents" means "winds" in
french);
some stuff like the SYMBOL part and the layer's STYLE part should not be
necessary anymore with gml output, as well as few other directives, clean up job
ahead..., but working, minus the maxscale (denom) directive which is not working
in this configuration;
I could manage the scale display control on the openlayers 3 side with an if
case based on the zoom level, but I would prefer mapserver mapfile to drive it;
Thanks again
Blaise
- - - - - - - - - -
--- mapfile ---
(called rg_noaa_vents_gml.map, called on the ol3 side)
MAP
NAME rg_noaa
STATUS ON
SIZE 600 600
EXTENT -180 -90 180 90
FONTSET "fonts/fonts.list"
UNITS DD
SHAPEPATH "data"
IMAGECOLOR 230 230 255
TEMPLATEPATTERN "rg_noaa"
IMAGETYPE PNG24
OUTPUTFORMAT
# image mapfile #
#TRANSPARENT ON
#IMAGEMODE RGB
#DRIVER GD/PNG
# gml mapfile #
NAME "gml"
DRIVER "TEMPLATE"
FORMATOPTION "FILE=rg_noaa_vent_gml.map"
END
PROJECTION
"init=epsg:4326"
END
WEB
HEADER templates/header_ol.html
TEMPLATE "set in index.html"
FOOTER templates/footer.html
MAXSCALE 200000000
IMAGEPATH "/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
"WMS_TITLE" "vrrroum_noaa"
"WMS_ONLINERESOURCE"
"http://localhost/cgi-bin/mapserv?map=/var/www/html/rg/blabla_02/noaa/rg_noaa_vents_gml.map"
"WMS_SRS" "EPSG:4326"
"WMS_ENABLE_REQUEST" "*"
#"WMS_FEATURE_INFO_MIME_TYPE" "text/html"
"wms_feature_info_mime_type" "text/gml"
"WFS_ONLINERESOURCE"
"http://ip-adress/cgi-bin/mapserv?map=/var/www/rg/blabla_02/noaa/rg_noaa_vents_gml.map&"
"WFS_ENABLE_REQUEST" "*"
"wfs_feature_info_mime_type" "text/gml"
END
END
SYMBOL
NAME "arrowfilled"
TYPE vector
FILLED true
#FILLED false
POINTS
1 0
-1 0
-1 7
-3 7
0 10
3 7
1 7
1 0
-1 0
END # POINTS
END # SYMBOL
LAYER ##### ##### ##### fv_168
NAME fv_168
GROUP v_168
TYPE POINT
STATUS ON
DATA fv_168
MAXSCALEDENOM 20000000
SIZEUNITS kilometers
METADATA
"WMS_TITLE" "v_168"
"WMS_SRS" "epsg:4326"
"wms_include_items" "all"
"gml_include_items" "all"
"WMS_ENABLE_REQUEST" "*"
"wfs_title" "v_168"
"wfs:srs" "EPSG:4326"
"gml_include_items" "all"
"gml_featureid" "ID"
"wfs_enable_request" "*"
END
CLASS
TEMPLATE "templates/vents.html"
STYLE
OPACITY 50
SYMBOL "arrowfilled"
SIZE [VITREP]
ANGLE [ANGLE]
WIDTH 2
COLOR 100 100 150
END
END
DUMP TRUE
HEADER "templates/vents_header_ol.html"
FOOTER "templates/vents_footer_ol.html"
TOLERANCE 20
END
END # Map File
- - - - - - - - - - - - - -
--- openlayers 3 ---
(extracts of the layer description)
var gmlSourceV_168 = new ol.source.ServerVector({
layer: 'v_168gml',
format: new ol.format.WFS({
featureNS: "http://mapserver.gis.umn.edu/mapserver",
featureType: 'fv_168'
}),
projection: 'EPSG:4326',
loader: function(extent, resolution, projection) {
$.ajax({
url:
'http://ip-adress/cgi-bin/mapserv?map=/var/www/html/rg/blabla_02/noaa/rg_noaa_vents_gml.map&service=WFS&'
+
'version=1.1.0&request=GetFeature&typename=fv_168&outputFormat=text/xml;
subtype=gml/3.1.1&' +
'&srsname=EPSG:4326&bbox=' + extent.join(',')
}).done(
function(response) {
gmlSourceV_168.addFeatures(gmlSourceV_168.readFeatures(response));
});
},
strategy: ol.loadingstrategy.bbox
});
var gmlLayerV_168 = new ol.layer.Vector({
title: '168gml',
type: 'base',
visible: false,
source: gmlSourceV_168,
style: (function() {
function ruleStyle(vitrep, angle, lon, lat) {
var ruleStyle = [new ol.style.Style({
image: new ol.style.Icon({
src: 'images/windarrow_42.png',
rotation: angle * 3.141592654 / 180
}),
})];
return ruleStyle;
}
return function(feature, resolution) {
var vitrep = feature.get('VITREP');
var angle = - feature.get('ANGLE');
var lon = feature.getX;
var lat = feature.Y;
return ruleStyle(vitrep, angle, lon, lat);
};
})()
});
On 12/01/2014 08:50 PM, Lime, Steve D (MNIT) wrote:
> How are you triggering the GML production in MapServer?
>
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of
bpicinbono at worldonline.fr
> Sent: Monday, December 01, 2014 11:01 AM
> To: mapserver-users at lists.osgeo.org
> Subject: [mapserver-users] maxscale (denom) with gml ?
>
> Dear list,
>
> I have a mapfile that control the display of some numerous data depending on
the
> scale:
> - dezooming max: not displaying the shapes;
> - at a particular zooming-in level: displaying the shapes;
>
> This is done with:
> MAXSCALE 200000000
> in the WEB section of the mapfile
>
> and with:
> MAXSCALEDENOM 20000000
> in the layer section of the mapfile
>
> This works fine rendering images with a basic cgi mapserver application or in
an opelayers 3 application.
>
> I am now trying to get the same behaviour in an openlayers 3 application but
rendering the shapes on client side through gml instead of server side image
rendering.
> Gml rendering works fine, but it seems that the MAXSCALE (DENOM) directive is
> omitted: the shapes display is no more turned off when dezooming a lot.
>
> Any clue to have this MAXSCALE ( DENOM ) working with gml display ?
> Thanks in advance
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
More information about the MapServer-users
mailing list