[OpenLayers-Dev] Noob Needs Marker/Icon Help

Eric Theise erictheise at gmail.com
Fri Dec 9 14:59:18 EST 2011


Hi Arnie,

On Fri, Dec 9, 2011 at 8:17 AM, Arnie Shore <ashore3 at verizon.net> wrote:
> I'll truly appreciate anyone's taking some time to look at
>   http://www.saefern.org/_osm/test.php
>
> and tell me what I'm doing wrong.  AS

I don't know why this should be, but if you break your addMarker
operations into two steps, it'll work.  By that I mean, turn

  markers.addMarker(new OpenLayers.Marker(my_lonlatproj ( -76.5, 39.0)),icon);
  markers.addMarker(new OpenLayers.Marker(my_lonlatproj ( -76.7,
39.0)),icon.clone());

into

  m = new OpenLayers.Marker(my_lonlatproj ( -76.5, 39.0), icon);
  markers.addMarker(m);
  n = new OpenLayers.Marker(my_lonlatproj ( -76.7, 39.0), icon.clone());
  markers.addMarker(n);

I've typically done this in a loop, using icon.clone() every time, and
it doesn't look quite so stupid in that context.

Hope that helps.

--Eric


More information about the Dev mailing list