<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=937594618-08062009><FONT face=Arial
color=#0000ff size=2>Hi Jan,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=937594618-08062009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=937594618-08062009><FONT face=Arial
color=#0000ff size=2>It seems, that your code GPX.js (<FONT
face="Times New Roman" color=#000000 size=3>OpenLayers.Layer.GPX</FONT>) miss
something like</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=937594618-08062009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=937594618-08062009><FONT face=Arial
color=#0000ff size=2>
this.events.triggerEvent("loadend");<BR></FONT></SPAN><SPAN
class=937594618-08062009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=937594618-08062009><FONT face=Arial
color=#0000ff size=2>you should have mentioned, that you use own code for <FONT
face="Times New Roman" color=#000000
size=3>OpenLayers.Layer.GPX.</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=937594618-08062009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=937594618-08062009><FONT face=Arial
color=#0000ff size=2>Arnd</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=937594618-08062009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr align=left><FONT face=Tahoma size=2><B>Von:</B>
users-bounces@openlayers.org [mailto:users-bounces@openlayers.org] <B>Im Auftrag
von </B>Jan Martin<BR><B>Gesendet:</B> Montag, 8. Juni 2009 19:15<BR><B>An:</B>
Vivien Deparday<BR><B>Cc:</B> users@openlayers.org<BR><B>Betreff:</B> Re:
[OpenLayers-Users] Going nuts: getDataExtent<BR></FONT><BR></DIV>
<DIV></DIV>Hi Vivien,<BR>hi all,<BR><BR>unfortunately it did not
work.<BR><BR>Changed file here:<BR><A
href="http://mybestprojects.com/data/test2/tracks_layers.html">http://mybestprojects.com/data/test2/tracks_layers.html</A><BR><BR>I
also would prefer the "try to register the same function but before adding the
layer" method, and NOT "within the constructor".<BR><BR>Thanks,<BR>Jan<BR><BR>
<DIV class=gmail_quote>On Mon, Jun 8, 2009 at 5:47 PM, Vivien Deparday <SPAN
dir=ltr><<A
href="mailto:vivien.deparday@gmail.com">vivien.deparday@gmail.com</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">I
think it's because you register your function on the event loadend but the
layer is already added and the event loadend has already been fired. So, try
to register the same function but before adding the layer. You can even do it
within the constructor with the option eventListeners. I guess it would look
like something like this but I'm not sure as I never used the gpx
format.<BR><BR>var lgpx = new OpenLayers.Layer.GPX("20090606175533.gpx",
"separated/20090606175533.gpx", "#FF0000",{eventListeners: {'loadend':
function(){this.zoomToExtent(lgpx.getDataExtent()) }}});<BR><BR>Let me know if
it helps.<BR><BR>Vivien Deparday<BR><BR>Jan Martin wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV></DIV>
<DIV class=h5>Hi all,<BR><BR>I am going nuts over not beeing able to figure
out how to make getDataExtent work for me.<BR><BR>This is my page NOT
working yet:<BR><A
href="http://mybestprojects.com/data/test/tracks_layers.html"
target=_blank>http://mybestprojects.com/data/test/tracks_layers.html</A><BR><BR>I
try to model after<BR><A href="http://oms.wff.ch/ol_track.htm"
target=_blank>http://oms.wff.ch/ol_track.htm</A> (tracks work fine, just
zoom in on the red point manually.)<BR>and<BR><A
href="http://nuug.no/kart.shtml" target=_blank>http://nuug.no/kart.shtml</A>
(automatic zoom by getDataExtent not working for me.)<BR><BR>Code in
question might be:<BR> if( ! map.getCenter()
){<BR> lgpx.events.register('loadend',
map, function(){this.zoomToExtent(lgpx.getDataExtent())});<BR>
map.setCenter(null, null);<BR><BR><BR>
}<BR> or check out whole page source at <A
href="http://mybestprojects.com/data/test/tracks_layers.html"
target=_blank>http://mybestprojects.com/data/test/tracks_layers.html</A><BR><BR>What's
wrong?<BR><BR>Thanks,<BR>Jan<BR><BR><BR></DIV></DIV>------------------------------------------------------------------------<BR><BR>_______________________________________________<BR>Users
mailing list<BR><A href="mailto:Users@openlayers.org"
target=_blank>Users@openlayers.org</A><BR><A
href="http://openlayers.org/mailman/listinfo/users"
target=_blank>http://openlayers.org/mailman/listinfo/users</A><BR> <BR></BLOCKQUOTE><BR></BLOCKQUOTE></DIV><BR></BODY></HTML>