<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3603" name=GENERATOR>
<DIV dir=ltr align=left><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2>Hello Jian,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2>I was able to finally get the application running. I
ran across a posting that had the "featureNS" statement I've inserted
below</FONT></SPAN><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2>:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2> var polygonLayer = new
OpenLayers.Layer.WFS(
"HOMELOT",<BR>
"<A href="http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apache/htdocs/homeinfo_wfs_attr.map" target="_top" rel="nofollow">http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apache/htdocs/homeinfo_wfs_attr.map</A>&",
<BR> {typename:
'taxlots',<BR> featureNS: "<A href="http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apache/htdocs/homeinfo_wfs_attr.map" target="_top" rel="nofollow">http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apache/htdocs/homeinfo_wfs_attr.map</A>",<BR> typename:
'ms:taxlots'},<BR> {extractAttributes:true, visibility:
false}); //, style:
OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default'])});<BR> </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2>I think the trick was having the typename: 'ms:taxlots'
parameter (taxlots is the name of my layer).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2>Once I did that I can see the WFS layer display, I can
click on the tax lot polygon and the framedcloud popup does pop up and the
attributes are displayed. And the tax lot polygon is highlighted.
The next problem now is that the WFS layer displays REAL slow. Anything
over 20 - 30 records takes too long. I've been doing more reading on that
and I'm wondering if WFS is just that way. So in the meantime I've
switched back to using a WMS layer and the getfeatureinfo method of displaying a
popup.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=844062415-09102009><FONT face=Arial color=#0000ff size=2><BR>Cress</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Jian Zhou (via Nabble)
[mailto:<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3795376&i=0" target="_top" rel="nofollow">[hidden email]</a>] <BR><B>Sent:</B> Friday,
October 09, 2009 2:41 AM<BR><B>To:</B> BATES Cress A (Lane
Cty)<BR><B>Subject:</B> Re: [OpenLayers-Users] WFS Popup Attributes
undefined<BR></FONT><BR></DIV>
<DIV></DIV>I have the same questiong like you. So your OpenLayers application is
running and all layers are displayed fine? <BR>What's the output after clicking
on an object?Can you see the popup fine? <BR>Regards <BR>
<BLOCKQUOTE class="quote light-black dark-border-color">
<DIV class="quote light-border-color">
<DIV class=quote-author style="FONT-WEIGHT: bold">Cress B. wrote:</DIV>
<DIV class="quote-message shrinkable-quote">I'm fairly new to OpenLayers and
have been trying to get the attributes from my WFS mapfile to display in a
popup window. I would like the user to be able to click on a polygon and
have the attributes display as a list in a popup. I've started with the
select-feature-openpoup.html example and have inserted by own WFS mapfile.
I can load my polygon shapefile as a WFS service and see them load as
orange polygons - although they load REAL slow. When I activate the
popup option and click on a polygon the popup window comes up and the polygon
is highlighted in blue. The popup is returning the area of the polygon
as part of the 'feature.geometry.getArea()' parameter; but the other
attributes in my shapefile are "undefined" in the popup. I've hacked
away for several days, reading almost all the posts dealing with popup, WFS,
attributes... and still can't figure out what I'm doing wrong. So I'm
not sure if my WFS mapfile is wonky or if my script in OpenLayers is missing
something. <BR><BR>Below is my Mapfile: <BR><BR><BR>MAP <BR> NAME
'TAXLOT' <BR> STATUS
ON <BR> IMAGETYPE PNG24 <BR>
TRANSPARENT ON <BR> EXTENT
4239905 896089 4247235 902911 <BR> SIZE
1000 800 <BR> IMAGECOLOR 152 252 210 <BR>
UNITS Feet <BR> SHAPEPATH "/ms4w/apps/tutorial/data"
<BR> FONTSET
"/ms4w/apps/tutorial/fonts/fonts.list" <BR> SYMBOLSET
"/ms4w/apps/tutorial/symbols/symbols35.sym" <BR> WEB
<BR> IMAGEPATH "/ms4w/tmp/ms_tmp/" <BR> IMAGEURL
"/ms_tmp/" <BR> METADATA
<BR> "wfs_title"
"TAXLOT" <BR>
"wfs_onlineresource" "<A href="http://localhost/cgi_bin/mapserv.exe?&" target=_top rel="nofollow">http://localhost/cgi_bin/mapserv.exe?&</A>"
#map=homeinfo_wfs.map&" <BR>
"wms_srs" "EPSG:32127"
<BR> END #end metadata <BR>
END #end web <BR> PROJECTION <BR>
"init=epsg:32127" <BR> END #end projection <BR>
<BR> LAYER # Taxlots polygon layer begins here <BR> NAME
"taxlots" <BR>
CONNECTIONTYPE WFS <BR> METADATA <BR>
"wfs_typename" "taxlots" <BR>
"wfs_request_method" "GET" <BR>
"gml_featureid" "FID" <BR>
"gml_include_items" "all" <BR>
"queryable" "true" <BR> END <BR>
DATA 'HomeTaxlots' <BR> TYPE
POLYGON <BR> STATUS
ON <BR> PROJECTION <BR>
"init=epsg:32127" <BR>
END <BR> DUMP
TRUE <BR> TEMPLATE
/ms4w/apps/template/foo.html <BR> CLASS <BR>
NAME "lots" <BR> STYLE <BR>
COLOR 155 155 255 <BR>
OUTLINECOLOR 0 15 27 <BR>
END <BR> TEMPLATE "ttt_query.html"
<BR> END <BR> END # Taxlots polygon layer ends here <BR>END
# All map files must come to an end just as all other things must come to...
<BR><BR>And this is the OpenLayers script piece for the popup: <BR><BR>
<script type="text/javascript"> <BR>
var map, drawControls, selectControl, selectedFeature; <BR>
var lon = 4243545; <BR> var lat =
900150; <BR> var zoom = 0; <BR>
var map, test_wfs, layer; <BR>
<BR>
<BR> function onPopupClose(evt) { <BR>
selectControl.unselect(selectedFeature);
<BR> } <BR> function
onFeatureSelect(feature) { <BR>
selectedFeature = feature; <BR>
var maplot = selectedFeature.attributes['MAPLOT'];
<BR>
var lot
= selectedFeature.attributes['LOT']; <BR>
var acres = selectedFeature.attributes['ACRES'];
<BR>
var
taxcode = selectedFeature.attributes['TAXCODE']; <BR>
popup = new OpenLayers.Popup.FramedCloud("info",
<BR>
feature.geometry.getBounds().getCenterLonLat(), <BR>
null, <BR>
"<div style='font-size:.8em'>TaxLot: " + maplot
+"<br />Lot: " + lot+"<br />Acres: " +acres +"<br/>Taxcode:
" +taxcode+"<br/>Area: " + feature.geometry.getArea()+"</div>",
<BR>
null,
true,onPopupClose); <BR>
feature.popup = popup; <BR>
map.addPopup(popup); <BR> } <BR>
<BR>
function onFeatureUnselect(feature) { <BR>
map.removePopup(feature.popup); <BR>
feature.popup.destroy(); <BR>
feature.popup = null; <BR> }
<BR> function init(){ <BR>
<BR>
var options = { <BR>
projection: new OpenLayers.Projection("EPSG:32127"),
<BR> displayProjection:
new OpenLayers.Projection("epsg:32127"), <BR>
units: "feet", <BR>
maxResolution: "auto", <BR>
allOverlays: true, <BR>
maxExtent: new OpenLayers.Bounds(4239905, 895089, <BR>
4247235, 906500) <BR> };
<BR>
<BR> map = new
OpenLayers.Map("map",options <BR>
); <BR> var
polygonLayer = new OpenLayers.Layer.WFS( "TAXLOT", <BR>
"<A href="http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apache/htdocs/homeinfo_wfs_good.map&" target=_top rel="nofollow">http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apache/htdocs/homeinfo_wfs_good.map&</A>",
<BR>
{typename: 'taxlots'});
<BR><BR> //var polygonLayer = new
OpenLayers.Layer.Vector("Polygon Layer"); <BR><BR>
map.addLayers([polygonLayer]); <BR>
<BR>
map.addControl(new
OpenLayers.Control.LayerSwitcher()); <BR>
map.addControl(new OpenLayers.Control.MousePosition()); <BR>
<BR>
selectControl = new OpenLayers.Control.SelectFeature(polygonLayer,
<BR> {onSelect:
onFeatureSelect, onUnselect: onFeatureUnselect}); <BR>
drawControls = { <BR>
polygon: new OpenLayers.Control.DrawFeature(polygonLayer,
<BR>
OpenLayers.Handler.Polygon), <BR>
select: selectControl <BR>
}; <BR>
<BR> for(var key in
drawControls) { <BR>
map.addControl(drawControls[key]); <BR>
} <BR><BR> <BR>
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
<BR><BR> } <BR><BR>
function toggleControl(element) { <BR>
for(key in drawControls) { <BR>
var control = drawControls[key]; <BR>
if(element.value == key &&
element.checked) { <BR>
control.activate(); <BR>
} else { <BR>
control.deactivate(); <BR>
} <BR>
} <BR> } </DIV></DIV></BLOCKQUOTE><IMG class=smiley src="http://n2.nabble.com/images/smiley/anim_handshake.gif" NOSEND="1"><IMG class=smiley src="http://n2.nabble.com/images/smiley/anim_handshake.gif" NOSEND="1"><IMG class=smiley src="http://n2.nabble.com/images/smiley/anim_handshake.gif" NOSEND="1">
<br><hr align="left" width="300">
View this message in context: <a href="http://n2.nabble.com/WFS-Popup-Attributes-undefined-tp3778098p3795376.html">RE: [OpenLayers-Users] WFS Popup Attributes undefined</a><br>
Sent from the <a href="http://n2.nabble.com/OpenLayers-Users-f1822463.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br>