Hi, <br><br>1 question : is "vectorLayer" a OL vector layer? i don't see the code where you create that layer. <br><br>Cheers<br><br>Paul D. <br><br><br><div class="gmail_quote">On Sat, Nov 21, 2009 at 12:30 AM, Nolte, Tim <span dir="ltr"><<a href="mailto:Tim.Nolte@ipcswirelessinc.com">Tim.Nolte@ipcswirelessinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">OK Guys,<br>
<br>
So I've been banging my head against the wall trying to figure out how<br>
to get a geocoded point to display as a vector star on the map. I've got<br>
things working to the point of getting my lat/long and zooming the map<br>
to the extents that the point falls in. The part that I just can't seem<br>
to get working, no matter what combination I try, is taking my lat/long<br>
and sticking a point(star) on the map. I'm including my code so you can<br>
see where I'm at. You'll notice that in some cases I've got some<br>
hard-coded items, this is just due to my custom widget not really being<br>
general purpose anyways. Any tips here would be hugely appreciated.<br>
Thanks!<br>
<br>
function GetParent() {<br>
if (parent.Fusion) {<br>
return parent;<br>
} else if (parent.parent.Fusion) {<br>
return parent.parent;<br>
}<br>
return null;<br>
}<br>
<br>
function getMapAddress() {<br>
return<br>
GetParent().Fusion.applicationDefinition.widgetSets[0].widgetTagsByName.<br>
menuMapAddress;<br>
}<br>
<br>
function createPoint(nLat, nLon, sLabel) {<br>
var OpenLayers = GetParent().OpenLayers;<br>
var mapWidget = getMapAddress().getMapWidget();<br>
var json = getMapAddress().extension;<br>
<br>
// calculate & zoom to new extents<br>
var ur = new Object;<br>
var ll = new Object;<br>
ur.x = nLon;<br>
ll.x = nLon;<br>
ur.y = nLat;<br>
ll.y = nLat;<br>
<br>
// create one default layer, unless other widgets have created<br>
it<br>
var vectorLayer = mapWidget.oMapOL.getLayersByName('Geocoded<br>
Points');<br>
var mapServerLayer =<br>
mapWidget.oMapOL.getLayersByName('ipcs_cell_sites');<br>
<br>
if (vectorLayer) { mapWidget.oMapOL.removeLayer(vectorLayer,<br>
false); }<br>
vectorLayer = new OpenLayers.Layer.Vector('Geocoded Points', {<br>
styleMap: new OpenLayers.StyleMap({'default':{<br>
strokeColor: "#00FF00",<br>
strokeOpacity: 1,<br>
strokeWidth: 3,<br>
fillColor: "#000000",<br>
fillOpacity: 0.5,<br>
pointRadius: 6,<br>
pointerEvents: "visiblePainted",<br>
label : "${label}",<br>
<br>
fontColor: "#000000",<br>
fontSize: "7px",<br>
fontFamily: "Arial",<br>
fontWeight: "bold",<br>
labelAlign: "rt",<br>
labelXOffset: "${xOffset}",<br>
labelYOffset: "${yOffset}"<br>
}})<br>
});<br>
<br>
// create a point feature<br>
var point = new OpenLayers.Geometry.Point(nLon, nLat);<br>
var pointFeature = new OpenLayers.Feature.Vector(point);<br>
pointFeature.attributes = {<br>
label: sLabel,<br>
// positive value moves the label to the right<br>
xOffset: 50,<br>
// negative value moves the label down<br>
yOffset: 0<br>
};<br>
<br>
mapWidget.oMapOL.addLayer(vectorLayer);<br>
vectorLayer.maxScale = mapServerLayer.maxScale;<br>
vectorLayer.numZoomLevels = mapServerLayer.numZoomLevels;<br>
vectorLayer.addFeatures([pointFeature]);<br>
<br>
var zoomFactor = json.Factor ? json.Factor[0] : 2;<br>
var margin = .0125;<br>
var zoom_size = zoomFactor * margin / 2;<br>
//var zoom_size = zoomFactor * Math.max( Math.abs(ur.x - ll.x),<br>
Math.abs(ur.y - ll.y)) / 2;<br>
var cX = (ur.x + ll.x)/2;<br>
var cY = (ur.y + ll.y)/2;<br>
ll.x = cX - zoom_size;<br>
ur.x = cX + zoom_size;<br>
ll.y = cY - zoom_size;<br>
ur.y = cY + zoom_size;<br>
mapWidget.oMapOL.zoomToExtent(new<br>
OpenLayers.Bounds(ll.x,ll.y,ur.x,ur.y));<br>
mapWidget._oCurrentExtents = mapWidget.oMapOL.getExtent();<br>
}<br>
<br>
----<br>
Timothy J Nolte - <a href="mailto:tnolte@ilpcs.com">tnolte@ilpcs.com</a><br>
Network Planning Engineer<br>
<br>
iPCS Wireless, Inc.<br>
4717 Broadmoor Ave, Suite G<br>
Kentwood, MI 49512<br>
<br>
Office: 616-656-5163<br>
PCS: 616-706-2438<br>
Fax: 616-554-6484<br>
Web: <a href="http://www.ipcswirelessinc.com" target="_blank">www.ipcswirelessinc.com</a><br>
<br>
_______________________________________________<br>
fusion-dev mailing list<br>
<a href="mailto:fusion-dev@lists.osgeo.org">fusion-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/fusion-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/fusion-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br> Paul Deschamps<br> Applications Specialist<br> DM Solutions Group Inc.<br><br> Office: (613) 565-5056 x28<br> <a href="mailto:pdeschamps@dmsolutions.ca">pdeschamps@dmsolutions.ca</a><br>
<a href="http://www.dmsolutions.ca">http://www.dmsolutions.ca</a><br> <a href="http://research.dmsolutions.ca">http://research.dmsolutions.ca</a><br> <br><br>