On Dec 30, 2010, at 12:47 PM, ext ulao wrote:
>
> So I here the vector layers now support images. I know this is a different
> way of doing it but why wont my image show?
>
> Map.addMarker = function ( pts, iconSize, iconURL, desc/*not used*/ ,
> layer)
> {
>
> var markerStyle = OpenLayers.Util.extend({},
> OpenLayers.Feature.Vector.style['default','select']);
> markerStyle.graphicWidth = iconSize;
> markerStyle.graphicHeight = iconSize;
> markerStyle.graphicOpacity = 1;
> markerStyle.externalGraphic =
> 'icons/marker.png';
> markerStyle.graphicTitle = desc;
> var points = new Array(new OpenLayers.Geometry.Point(ProjLatLon(
> pts.lat, pts.lon).lon, ProjLatLon( pts.lat, pts.lon).lat ))
> var obj = new OpenLayers.Geometry.LineString(points);
> var newFeature = new OpenLayers.Feature.Vector( obj , null,
> markerStyle );
> layer.addFeatures(newFeature)
> //while (! checkLoaded(newFeature.id) ) {} //hold
> off till loaded.
> //newFeature.layer.drawFeature(newFeature);//may
> help
> return newFeature;
> }
>
> I tried to hard code the image (see bold), but my image does not show? Do I
> need to use full paths now?
Linestrings won't draw as images. (How would that work? Did you expect the
image to be drawn along the line string?) Instead, just drop the linstring, and
use the geometry.point as the first argument to the constructor of your
Feature.
-- CHris
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/vector-layer-wont-show-my-images-tp5877228p5877228.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users