[OpenLayers-Users] getfeatureinfo mapserver show only the atribut
name
boho
fnaci4775 at gmail.com
Mon Aug 22 13:11:55 EDT 2011
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 :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/transitional.dtd";>
<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.
More information about the Users
mailing list