Discussion:
[OpenLayers-Users] getfeatureinfo mapserver show only the atribut name
boho
2011-08-22 17:11:55 UTC
Permalink
is there anything that can help me display the data from. dbf with OpenLayers
getfeatureinfo function ..
I've tried it but it appeared only the name attribute
This is my OpenLayers code:
<script type="text/javascript">
function init(){
var lon = 99.09668;
var lat = 2.890000;

var zoom = 12;
var map = new OpenLayers.Map('map');
var layer = new
OpenLayers.Layer.WMS('Batas_Kab_region','http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/cobaLabel/batasKab.map&;',{layers:'Batas_Kab_region'});
var bank = new
OpenLayers.Layer.WMS('BANK','http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/cobaLabel/batasKab.map&;',{layers:'BANK'});
map.addLayer(layer,bank);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);


map.events.register('click', map, function (e) {
var url =
'http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/cobaLabel/batasKab.map&'
+ "?REQUEST=GetFeatureInfo"
+ "&EXCEPTIONS=application/vnd.ogc.se_xml"
+ "&BBOX=" + map.getExtent().toBBOX()
+ "&X=" + e.xy.x
+ "&Y=" + e.xy.y
+ "&INFO_FORMAT=text/html"
+ "&QUERY_LAYERS=Batas_Kab_region"
+ "&LAYERS=postgis:Batas_Kab_region"
+ "&FEATURE_COUNT=50"
+ "&SRS=EPSG:900913"
+ "&STYLES="
+ "&WIDTH=" + map.size.w
+ "&HEIGHT=" + map.size.h;
window.open(url,
"getfeatureinfo",
"location=0,status=0,scrollbars=1,width=600,height=150"
);
});

}

this my mapfile :
# Map file created from QGIS project file C:/Program Files/Quantum GIS
Enceladus/as'.qgs
# Edit this file to customize for your map interface
# (Created with PyQgis MapServer Export plugin)
MAP
NAME "QGIS-MAP"
# Map image size
SIZE 400 200
UNITS meters

EXTENT 96.802857 1.212928 102.390585 3.803407
FONTSET './fonts/fonts.txt'
SYMBOLSET './symbols/symbols.sym'
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
END

# Background color for the map canvas -- change as desired
IMAGECOLOR 255 255 255
IMAGEQUALITY 95
IMAGETYPE png

OUTPUTFORMAT
NAME png
DRIVER 'GD/PNG'
MIMETYPE 'image/png'
IMAGEMODE RGBA
EXTENSION 'png'
END
# Legend
LEGEND
IMAGECOLOR 255 255 255
STATUS ON
KEYSIZE 18 12
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 89
END
END

# Web interface definition. Only the template parameter
# is required to display a map. See MapServer documentation
WEB
# Set IMAGEPATH to the path where MapServer should
# write its output.
IMAGEPATH 'C:\ms4w\Apache\htdocs\cobaLabel\tmp\'

# Set IMAGEURL to the url that points to IMAGEPATH
# as defined in your web server configuration
IMAGEURL 'C:\ms4w\Apache\htdocs\cobaLabel\tmp\'

# WMS server settings
METADATA
'wms_title' 'QGIS-MAP'
'wms_onlineresource'
'http:/localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/cobaLabel/batasKab.map'
"wms_srs" "EPSG:42304 EPSG:42101 EPSG:4269 EPSG:4326"
"wms_abstract" "This demonstration server was setup by DM Solutions
Group (http://www.dmsolutions.ca/) and is powered by the UMN MapServer
(http://mapserver.gis.umn.edu/). This server uses Canadian source data
(c)2000, Government of Canada with permission from Natural Resources Canada
from NRCan's GeoGratis
web site (http://geogratis.cgdi.gc.ca/)."

"wms_feature_info_mime_type" "text/html"

'wms_include_items' 'all'

END

#Scale range at which web interface will operate
# Template and header/footer settings
# Only the template parameter is required to display a map. See
MapServer documentation
TEMPLATE 'http://localhost/cobaLabel/template/template.html'
END

LAYER
NAME 'Batas_Kab_region'
TYPE POLYGON
DUMP true
LABELITEM "KECAMATAN"
TEMPLATE 'http://localhost/cobaLabel/template/template.html'
EXTENT 96.802857 1.212928 102.390585 3.803407
DATA 'C:/ms4w/Apache/htdocs/siantar/Batas_Kab_region.shp|layerid=0'
METADATA
'wms_title' 'Batas_Kab_region'
"wms_dataurl_format" "text/HTML"
"gml_include_items" "all"
"gml_exclude_items" ""
"ows_include_items" "all"
"ows_exclude_items" ""
"wms_exceptions_format" "application/vnd.ogc.se_xml"
'wms_srs' 'EPSG:4326'
END
STATUS ON
TRANSPARENCY 100
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
END
CLASS
NAME 'Batas_Kab_region'
STYLE
SYMBOL 0
SIZE 7.0
OUTLINECOLOR 0 0 0
COLOR 78 109 18
END
LABEL
FONT vera
TYPE truetype
SIZE 12
COLOR 0 0 0
ANGLE 0
BUFFER 1
POSITION cc
FORCE true
ANTIALIAS true
PARTIALS true
END
END
END



END

and this my template web :

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;http://www.w3.org/TR/html4/transitional.dtd&quot;;&gt;
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
<title>GetFeatureInfo example</title>
</head>
<body>
<table>
<tr>
<th>KECAMATAN:</th>
</tr>

The body template file;


<tr>
<td>[KECAMATAN]</td>
</tr>

and the Footer template file;



</table>
</body>
</html>


pleasee somebody help me....

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-the-atribut-name-tp6712417p6712417.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
boho
2011-08-22 17:54:59 UTC
Permalink
i've try
info = new OpenLayers.Control.WMSGetFeatureInfo({
url:
'http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/cobaLabel/batasKab.map',
title: 'Identify features by clicking',
queryVisible: true,
eventListeners: {
getfeatureinfo: function(event) {
map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true
));
}
}
});
but it's still show the atribut name...
this is so frustated....

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-the-atribut-name-tp6712417p6712567.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Arnd Wippermann
2011-08-22 21:59:25 UTC
Permalink
Hi,

In your body template you need for every field, you want to show, an entry:
<tr><td>Field1</td><td>[Field1]</td></tr>
<tr><td>Field2</td><td>[Field2]</td></tr>
<tr><td>Field3</td><td>[Field3]</td></tr>
...

Arnd

-----Ursprüngliche Nachricht-----
Von: openlayers-users-***@lists.osgeo.org
[mailto:openlayers-users-***@lists.osgeo.org] Im Auftrag von boho
Gesendet: Montag, 22. August 2011 19:12
An: ***@openlayers.org
Betreff: [OpenLayers-Users] getfeatureinfo mapserver show only the
atributname

is there anything that can help me display the data from. dbf with
OpenLayers getfeatureinfo function ..
I've tried it but it appeared only the name attribute This is my OpenLayers
code:
<script type="text/javascript">
function init(){
var lon = 99.09668;
var lat = 2.890000;

var zoom = 12;
var map = new OpenLayers.Map('map');
var layer = new
OpenLayers.Layer.WMS('Batas_Kab_region','http://localhost/cgi-bin/mapserv.ex
e?map=C:/ms4w/Apache/htdocs/cobaLabel/batasKab.map&;',{layers:'Batas_Kab_reg
ion'});
var bank = new
OpenLayers.Layer.WMS('BANK','http://localhost/cgi-bin/mapserv.exe?map=C:/ms4
w/Apache/htdocs/cobaLabel/batasKab.map&;',{layers:'BANK'});
map.addLayer(layer,bank);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);


map.events.register('click', map, function (e) {
var url =
'http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/cobaLabel/ba
tasKab.map&'
+ "?REQUEST=GetFeatureInfo"
+ "&EXCEPTIONS=application/vnd.ogc.se_xml"
+ "&BBOX=" + map.getExtent().toBBOX()
+ "&X=" + e.xy.x
+ "&Y=" + e.xy.y
+ "&INFO_FORMAT=text/html"
+ "&QUERY_LAYERS=Batas_Kab_region"
+ "&LAYERS=postgis:Batas_Kab_region"
+ "&FEATURE_COUNT=50"
+ "&SRS=EPSG:900913"
+ "&STYLES="
+ "&WIDTH=" + map.size.w
+ "&HEIGHT=" + map.size.h;
window.open(url,
"getfeatureinfo",
"location=0,status=0,scrollbars=1,width=600,height=150"
);
});

}

this my mapfile :
# Map file created from QGIS project file C:/Program Files/Quantum GIS
Enceladus/as'.qgs # Edit this file to customize for your map interface #
(Created with PyQgis MapServer Export plugin) MAP
NAME "QGIS-MAP"
# Map image size
SIZE 400 200
UNITS meters

EXTENT 96.802857 1.212928 102.390585 3.803407
FONTSET './fonts/fonts.txt'
SYMBOLSET './symbols/symbols.sym'
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
END

# Background color for the map canvas -- change as desired
IMAGECOLOR 255 255 255
IMAGEQUALITY 95
IMAGETYPE png

OUTPUTFORMAT
NAME png
DRIVER 'GD/PNG'
MIMETYPE 'image/png'
IMAGEMODE RGBA
EXTENSION 'png'
END
# Legend
LEGEND
IMAGECOLOR 255 255 255
STATUS ON
KEYSIZE 18 12
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 89
END
END

# Web interface definition. Only the template parameter
# is required to display a map. See MapServer documentation
WEB
# Set IMAGEPATH to the path where MapServer should
# write its output.
IMAGEPATH 'C:\ms4w\Apache\htdocs\cobaLabel\tmp\'

# Set IMAGEURL to the url that points to IMAGEPATH
# as defined in your web server configuration
IMAGEURL 'C:\ms4w\Apache\htdocs\cobaLabel\tmp\'

# WMS server settings
METADATA
'wms_title' 'QGIS-MAP'
'wms_onlineresource'
'http:/localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/cobaLabel/bat
asKab.map'
"wms_srs" "EPSG:42304 EPSG:42101 EPSG:4269 EPSG:4326"
"wms_abstract" "This demonstration server was setup by DM
Solutions
Group (http://www.dmsolutions.ca/) and is powered by the UMN MapServer
(http://mapserver.gis.umn.edu/). This server uses Canadian source data
(c)2000, Government of Canada with permission from Natural Resources Canada
from NRCan's GeoGratis web site (http://geogratis.cgdi.gc.ca/)."

"wms_feature_info_mime_type" "text/html"

'wms_include_items' 'all'

END

#Scale range at which web interface will operate
# Template and header/footer settings
# Only the template parameter is required to display a map. See
MapServer documentation
TEMPLATE 'http://localhost/cobaLabel/template/template.html'
END

LAYER
NAME 'Batas_Kab_region'
TYPE POLYGON
DUMP true
LABELITEM "KECAMATAN"
TEMPLATE 'http://localhost/cobaLabel/template/template.html'
EXTENT 96.802857 1.212928 102.390585 3.803407
DATA 'C:/ms4w/Apache/htdocs/siantar/Batas_Kab_region.shp|layerid=0'
METADATA
'wms_title' 'Batas_Kab_region'
"wms_dataurl_format" "text/HTML"
"gml_include_items" "all"
"gml_exclude_items" ""
"ows_include_items" "all"
"ows_exclude_items" ""
"wms_exceptions_format" "application/vnd.ogc.se_xml"
'wms_srs' 'EPSG:4326'
END
STATUS ON
TRANSPARENCY 100
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
END
CLASS
NAME 'Batas_Kab_region'
STYLE
SYMBOL 0
SIZE 7.0
OUTLINECOLOR 0 0 0
COLOR 78 109 18
END
LABEL
FONT vera
TYPE truetype
SIZE 12
COLOR 0 0 0
ANGLE 0
BUFFER 1
POSITION cc
FORCE true
ANTIALIAS true
PARTIALS true
END
END
END



END

and this my template web :

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;http://www.w3.org/TR/html4/transitional.dtd&quot;;&gt;
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
<title>GetFeatureInfo example</title>
</head>
<body>
<table>
<tr>
<th>KECAMATAN:</th>
</tr>

The body template file;


<tr>
<td>[KECAMATAN]</td>
</tr>

and the Footer template file;



</table>
</body>
</html>


pleasee somebody help me....

--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-th
e-atribut-name-tp6712417p6712417.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Jean-François Gigand
2011-08-23 13:18:11 UTC
Permalink
Hi,

- In your mapfile, try setting "ows_enable_request" to "*".

- instead of "postgis:Batas_Kab_region", I guess you should just
specify "Batas_Kab_region"

- you should add EPSG:900913 to the list of wms_srs

- there is a control in OpenLayers that do the job :
OpenLayers.Control.WMSGetFeatureInfo
It would be interesting for you to use it.

- try settings a log file for MapServer, you may have some useful
information there

If you still have the problem, can you give what is returned by the server?


Jean-François Gigand - Geonef
Paris, France - http://geonef.fr/
Post by Arnd Wippermann
Hi,
<tr><td>Field1</td><td>[Field1]</td></tr>
<tr><td>Field2</td><td>[Field2]</td></tr>
<tr><td>Field3</td><td>[Field3]</td></tr>
...
Arnd
-----Ursprüngliche Nachricht-----
Gesendet: Montag, 22. August 2011 19:12
Betreff: [OpenLayers-Users] getfeatureinfo mapserver show only the
atributname
is there anything that can help me display the data from. dbf with
OpenLayers getfeatureinfo function ..
I've tried it but it appeared only the name attribute This is my OpenLayers
<script type="text/javascript">
       function init(){
               var lon = 99.09668;
                               var lat = 2.890000;
                               var zoom = 12;
               var map = new OpenLayers.Map('map');
               var layer = new
OpenLayers.Layer.WMS('Batas_Kab_region','http://localhost/cgi-bin/mapserv.ex
e?map=C:/ms4w/Apache/htdocs/cobaLabel/batasKab.map&;',{layers:'Batas_Kab_reg
ion'});
               var bank = new
OpenLayers.Layer.WMS('BANK','http://localhost/cgi-bin/mapserv.exe?map=C:/ms4
w/Apache/htdocs/cobaLabel/batasKab.map&;',{layers:'BANK'});
               map.addLayer(layer,bank);
               map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
               map.events.register('click', map, function (e) {
   var url =
'http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/cobaLabel/ba
tasKab.map&'
     + "?REQUEST=GetFeatureInfo"
     + "&EXCEPTIONS=application/vnd.ogc.se_xml"
     + "&BBOX=" + map.getExtent().toBBOX()
     + "&X=" + e.xy.x
     + "&Y=" + e.xy.y
     + "&INFO_FORMAT=text/html"
     + "&QUERY_LAYERS=Batas_Kab_region"
     + "&LAYERS=postgis:Batas_Kab_region"
     + "&FEATURE_COUNT=50"
     + "&SRS=EPSG:900913"
     + "&STYLES="
     + "&WIDTH=" + map.size.w
     + "&HEIGHT=" + map.size.h;
   window.open(url,
     "getfeatureinfo",
     "location=0,status=0,scrollbars=1,width=600,height=150"
   );
 });
}
# Map file created from QGIS project file C:/Program Files/Quantum GIS
Enceladus/as'.qgs # Edit this file to customize for your map interface #
(Created with PyQgis MapServer Export plugin) MAP
 NAME "QGIS-MAP"
 # Map image size
 SIZE 400 200
 UNITS meters
   EXTENT 96.802857 1.212928 102.390585 3.803407
 FONTSET './fonts/fonts.txt'
 SYMBOLSET './symbols/symbols.sym'
 PROJECTION
   'proj=longlat'
   'ellps=WGS84'
   'datum=WGS84'
   'no_defs'
 END
 # Background color for the map canvas -- change as desired
 IMAGECOLOR 255 255 255
 IMAGEQUALITY 95
 IMAGETYPE png
 OUTPUTFORMAT
   NAME png
   DRIVER 'GD/PNG'
   MIMETYPE 'image/png'
   IMAGEMODE RGBA
   EXTENSION 'png'
 END
 # Legend
 LEGEND
     IMAGECOLOR 255 255 255
   STATUS ON
   KEYSIZE 18 12
   LABEL
     TYPE BITMAP
     SIZE MEDIUM
     COLOR 0 0 89
   END
 END
 # Web interface definition. Only the template parameter
 # is required to display a map. See MapServer documentation
 WEB
   # Set IMAGEPATH to the path where MapServer should
   # write its output.
   IMAGEPATH 'C:\ms4w\Apache\htdocs\cobaLabel\tmp\'
   # Set IMAGEURL to the url that points to IMAGEPATH
   # as defined in your web server configuration
   IMAGEURL 'C:\ms4w\Apache\htdocs\cobaLabel\tmp\'
   # WMS server settings
   METADATA
     'wms_title'           'QGIS-MAP'
     'wms_onlineresource'
'http:/localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/cobaLabel/bat
asKab.map'
     "wms_srs"   "EPSG:42304 EPSG:42101 EPSG:4269 EPSG:4326"
       "wms_abstract"      "This demonstration server was setup by DM
Solutions
Group (http://www.dmsolutions.ca/) and is powered by the UMN MapServer
(http://mapserver.gis.umn.edu/).  This server uses Canadian source data
(c)2000, Government of Canada with permission from Natural Resources Canada
from NRCan's GeoGratis web site (http://geogratis.cgdi.gc.ca/)."
"wms_feature_info_mime_type" "text/html"
'wms_include_items'  'all'
   END
   #Scale range at which web interface will operate
   # Template and header/footer settings
   # Only the template parameter is required to display a map. See
MapServer documentation
   TEMPLATE 'http://localhost/cobaLabel/template/template.html'
 END
 LAYER
   NAME 'Batas_Kab_region'
   TYPE POLYGON
   DUMP true
       LABELITEM "KECAMATAN"
   TEMPLATE 'http://localhost/cobaLabel/template/template.html'
   EXTENT 96.802857 1.212928 102.390585 3.803407
   DATA 'C:/ms4w/Apache/htdocs/siantar/Batas_Kab_region.shp|layerid=0'
   METADATA
     'wms_title' 'Batas_Kab_region'
    "wms_dataurl_format" "text/HTML"
   "gml_include_items"     "all"
   "gml_exclude_items"     ""
   "ows_include_items"     "all"
   "ows_exclude_items"     ""
   "wms_exceptions_format" "application/vnd.ogc.se_xml"
 'wms_srs'             'EPSG:4326'
   END
   STATUS ON
   TRANSPARENCY 100
   PROJECTION
   'proj=longlat'
   'ellps=WGS84'
   'datum=WGS84'
   'no_defs'
   END
   CLASS
      NAME 'Batas_Kab_region'
      STYLE
        SYMBOL 0
        SIZE 7.0
        OUTLINECOLOR 0 0 0
        COLOR 78 109 18
      END
    LABEL
     FONT vera
     TYPE truetype
     SIZE 12
     COLOR 0 0 0
     ANGLE 0
     BUFFER 1
     POSITION cc
     FORCE true
     ANTIALIAS true
     PARTIALS true
    END
   END
 END
END
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
<html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
   <title>GetFeatureInfo example</title>
 </head>
<body>
<table>
<tr>
<th>KECAMATAN:</th>
</tr>
The body template file;
<tr>
<td>[KECAMATAN]</td>
</tr>
and the Footer template file;
</table>
</body>
</html>
pleasee somebody help me....
--
http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-th
e-atribut-name-tp6712417p6712417.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
boho
2011-08-23 14:28:00 UTC
Permalink
thanks jean, i've finally solved it by add
'wms_title' 'Batas_Kab_region'
"wms_dataurl_format" "text/HTML"
"gml_include_items" "all"
"gml_exclude_items" ""
"ows_include_items" "all"
"ows_exclude_items" ""
"wms_exceptions_format" "application/vnd.ogc.se_xml"
'wms_srs' 'EPSG:4326'
in my layer metadata.

regards...
:)

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-the-atribut-name-tp6712417p6716396.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
boho
2011-08-23 14:36:07 UTC
Permalink
thanks jean, i've finally solved it by add
'wms_title' 'Batas_Kab_region'
"wms_dataurl_format" "text/HTML"
"gml_include_items" "all"
"gml_exclude_items" ""
"ows_include_items" "all"
"ows_exclude_items" ""
"wms_exceptions_format" "application/vnd.ogc.se_xml"
'wms_srs' 'EPSG:4326'
in my layer metadata.

and this is my openlayers script :
info = new OpenLayers.Control.WMSGetFeatureInfo({
url:
'http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/petaPAD/batasKab.map&',
layers: [layer],
infoFormat: "text/plain",
title: 'Identify features by clicking',
queryVisible: true,
eventListeners: {
getfeatureinfo: function(event) {

map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true
));
}
}
});
map.addControl(info);
info.activate();
this will return GetFeatureInfo results: Layer 'Batas_Kab_region' Feature
18: KAB_KOTA = 'Simalungun' KECAMATAN = 'Simalungun' HL = '' when i click
the layer.

my shape has 3 atribute name KECAMATAN ,KAB_KOTA and HL, how if i just want
to get the KECAMATAN data with getfeatureinfo openlayers??

btw, sorry if my english is not good..


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-the-atribut-name-tp6712417p6716424.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Jean-François Gigand
2011-08-23 22:27:55 UTC
Permalink
What attributes are exposed can be specified in the metadata
attributes of the layer.

Check out : http://mapserver.org/ogc/wms_server.html


Jean-François Gigand - Geonef
Paris, France - http://geonef.fr/
Post by boho
thanks jean, i've finally solved it by add
'wms_title' 'Batas_Kab_region'
 "wms_dataurl_format" "text/HTML"
   "gml_include_items"     "all"
  "gml_exclude_items"     ""
   "ows_include_items"     "all"
   "ows_exclude_items"     ""
   "wms_exceptions_format" "application/vnd.ogc.se_xml"
 'wms_srs'             'EPSG:4326'
in my layer metadata.
info = new OpenLayers.Control.WMSGetFeatureInfo({
'http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/petaPAD/batasKab.map&',
layers: [layer],
                infoFormat: "text/plain",
       title: 'Identify features by clicking',
       queryVisible: true,
       eventListeners: {
               getfeatureinfo: function(event) {
               map.addPopup(new OpenLayers.Popup.FramedCloud(
                               "chicken",
                               map.getLonLatFromPixel(event.xy),
                               null,
                               event.text,
                               null,
                               true
                       ));
               }
       }
});
map.addControl(info);
info.activate();
this will return GetFeatureInfo results: Layer 'Batas_Kab_region' Feature
18: KAB_KOTA = 'Simalungun' KECAMATAN = 'Simalungun' HL = ''  when i click
the layer.
my shape has 3 atribute name KECAMATAN ,KAB_KOTA and HL, how if i just want
to get the KECAMATAN data with getfeatureinfo openlayers??
btw, sorry if my english is not good..
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-the-atribut-name-tp6712417p6716424.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
boho
2011-08-23 23:55:49 UTC
Permalink
thx jean..
now i can specify the atribut by change
"gml_include_items" "all"
"gml_groups" "display"
"gml_display_group" "Name_e,Name_f"
in my mapfile

my last answer is, whe i click the layer popup openlayers show
"GetFeatureInfo results: Layer 'Batas_Kab_region' Feature 17: KAB_KOTA =
'Pematang Siantar' KECAMATAN = 'Pematang Siantar' "

how can i modify this, so popup only show the result, example "KECAMATAN =
'Pematang Siantar'"
i mean without "GetFeatureInfo results: Layer 'Batas_Kab_region' Feature
17:"

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-the-atribut-name-tp6712417p6718338.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Jean-François Gigand
2011-08-24 18:30:01 UTC
Permalink
When you say "popup", you mean an OpenLayers popup shown above the
map, or a popup window?

In any case, is the content formatted by MapServer or OpenLayers?
- If MapServer, check the documentation about templates, to customize it
- If OpenLayers, then I don't know, it depends on the way you create the popup

If you don't know the answer to that question, check the response to
the WMSGetFeature request: is it HTML / plain text, or structured
(XML/GML/JSON/...) ?


Jean-François Gigand - Geonef
Paris, France - http://geonef.fr/
Post by boho
thx jean..
now i can specify the atribut by change
"gml_include_items" "all"
"gml_groups"        "display"
"gml_display_group" "Name_e,Name_f"
in my mapfile
my last answer is, whe i click the layer popup openlayers show
"GetFeatureInfo results: Layer 'Batas_Kab_region' Feature 17: KAB_KOTA =
'Pematang Siantar' KECAMATAN = 'Pematang Siantar' "
how can i modify this, so popup only show the result, example "KECAMATAN =
'Pematang Siantar'"
i mean without  "GetFeatureInfo results: Layer 'Batas_Kab_region' Feature
17:"
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-the-atribut-name-tp6712417p6718338.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
boho
2011-08-31 09:48:56 UTC
Permalink
hi jean
i use openlayers popup,

info format i use text/plain, when i try change the info format with
text/html it show "msWMSFeatureInfo(): WMS server error. Unsupported
INFO_FORMAT value (text/html)."

please can you help me,,,,

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-the-atribut-name-tp6712417p6745825.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Bart van den Eijnden
2011-08-31 09:50:49 UTC
Permalink
Hi,

MapServer needs to be configured with HTML templates, please ask on the Mapserver users list or check their documentation.

This is not an OpenLayers question.

Bart
--
Bart van den Eijnden
OSGIS - http://osgis.nl
Post by boho
hi jean
i use openlayers popup,
info format i use text/plain, when i try change the info format with
text/html it show "msWMSFeatureInfo(): WMS server error. Unsupported
INFO_FORMAT value (text/html)."
please can you help me,,,,
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getfeatureinfo-mapserver-show-only-the-atribut-name-tp6712417p6745825.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Loading...