[OpenLayers-Dev] Problem with popup in MapServer layer
florencia.bujan
florita026 at gmail.com
Wed Oct 20 12:24:10 EDT 2010
Hi,
I am from Uruguay and sorry because my english is very poor.
I have a problem with a popup. I want to show a information from postgis
database (geodatabase) when the user mouse over a line in a mapserver layer
(in this case line layer).
I am investigate a lot of days and I work with a lot of examples, but I
can't do that.
This is possible? Can you help me?...
I don't know if I am in the correct way but the last example is these (I'm
base on this example:
http://dev4.mapgears.com/bdga/options-by-zoom-and-highlight-bdga.html)
Thanks a lot!!
Regards,
Florencia
***** .MAP CODE ******
MAP
NAME GISADP
SIZE 700 700
STATUS ON
EXTENT -63.4393 -33.974 -48.1827 -32.0861
FONTSET "misc/fonts/fonts.txt"
SYMBOLSET "misc/symbols/symbols.sym"
IMAGECOLOR 255 255 255
UNITS dd
WEB
METADATA
"wms_title" "ADP - Sistema de Información
Geográfica"
"wms_onlineresource"
"http://192.168.1.154/cgi-bin/mapserv.exe?map=../htdocs/Florencia/GISManager/flor.map&"
"wms_srs" "EPSG:4326"
"wms_transparent" "true"
"labelcache_map_edge_buffer" "-10"
"wfs_namespace_prefix" "feature"
"wfs_namespace_uri"
"http://192.168.1.154/"
END
END
PROJECTION
"init=EPSG:4326"
END
LAYER
CONNECTIONTYPE postgis
NAME "Terrazas"
STATUS ON
CONNECTION "user=** password=** dbname=** host=**"
DATA "the_geom from (SELECT l.* from terrazas l, campos c
WHERE c.id=l.idcampo) as terrazas using unique gid using SRID=-1"
TYPE LINE
CLASS
NAME "Terrazas"
STYLE
SIZE 4
COLOR 0 192 255
SYMBOL "BigLine"
END
END
TOLERANCE 20
END
END
******* OPENLAYERS CODE in init function **************
OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '2';
var oRegStyleMap = new OpenLayers.StyleMap({
strokeColor: "black",
strokeWidth: 2,
strokeOpacity: 1,
fillOpacity: 0.8
});
var aRegColor = {
'01': {fillColor:"purple" },
'02': {fillColor:"blue" },
'03': {fillColor:"yellow" },
'04': {fillColor:"red" },
'05': {fillColor:"#ffa500" }, //orange
'06': {fillColor:"red" },
'07': {fillColor:"purple" },
'08': {fillColor:"blue" },
'09': {fillColor:"green" },
'10': {fillColor:"#ffa500" },
'11': {fillColor:"#ffa500" },
'12': {fillColor:"green" },
'13': {fillColor:"purple" },
'14': {fillColor:"#ffa500" },
'15': {fillColor:"yellow" },
'16': {fillColor:"green" },
'17': {fillColor:"blue" }
};
oRegStyleMap.addUniqueValueRules("default", "res_co_reg", aRegColor);
var szBDGAMapPath = "../htdocs/GISManager/flor.map";
var szHost = "http://localhost/";
var szMSURL = szHost+"cgi-bin/mapserv.exe";
oMap = new OpenLayers.Map( 'map');
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: 'basic'} );
oMap.addLayers([wms]);
oMap.setCenter(new OpenLayers.LonLat(-57.5, -34), 9);
var layerLocal = new OpenLayers.Layer.MapServer("Terrazas",
stringMapa,
{layers:'Terrazas', format:'image/png'},
{isBaseLayer:false, visibility:true, opacity:0.5,
transparent:true, displayInLayerSwitcher: false }
);
//oMap.addLayer(layerLocal);
olWFSReg = new OpenLayers.Layer.Vector("GISADP", {
styleMap: oRegStyleMap,
strategies: [
new OpenLayers.Strategy.OptionsByZoom({
optionsByZoom: {
0: {featureType: "Terrazas"},
1: {featureType: "Terrazas"},
2: {featureType: "Terrazas"},
3: {featureType: "Terrazas"}
},
defaultOptions: {featureType: "Terrazas"}
}),
new OpenLayers.Strategy.BBOX()
],
protocol: new OpenLayers.Protocol.WFS({
version: "1.0.0",
url: stringMapa,
featureType: "Terrazas",
srsName: "EPSG:4326",
featureNS: "http://localhost/",
geometryName: "the_geom",
schema:
szMSURL+"?service=WFS&version=1.0.0&request=DescribeFeatureType&TypeName=Terrazas"
})
});
oMap.addLayers([ olWFSReg ]);
var highlighter = new OpenLayers.Control.HighlightFeature({
layer: olWFSReg,
displayPopup: true,
popupOffset: {
'left': 45,
'right': 0,
'top': 5
},
popupTitle: "Province information",
popupSize: new OpenLayers.Size(200,225),
style:{
strokeColor: "black",
strokeWidth: 2,
strokeOpacity: 0.8,
fillOpacity: 0.5,
fillColor: "black"
}
});
oMap.addControl(highlighter);
highlighter.activate();
oMap.addControl(new OpenLayers.Control.Navigation());
oMap.addControl(new OpenLayers.Control.Scale($('scale')));
oMap.addControl(new OpenLayers.Control.LayerSwitcher());
oMap.addControl(new OpenLayers.Control.PanZoomBar());
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Problem-with-popup-in-MapServer-layer-tp5655613p5655613.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.
More information about the Dev
mailing list