Hi, I am starting to use Mapstraction with the openlayers provider, and I am not sure how to retrieve the current center of a map in a cross-provider way. i.e. currently when calling map.getCenter(), the result returned is the openlayers internal one, not the long/lat used when calling setCenter(). Is that the expected behaviour? Regards, Philippe -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100113/a2beecf9/attachment.htm>
Hi Philippe, Which version of Mapstraction are you using? getCenter() will return a new LatLonPoint object with the latidute and longitude of the current center of the OpenLayers map. It won''t be the same object you passed into setCenter() if that''s what you mean. Derek 2010/1/13 Philippe Duval <phil.duval at gmail.com>> Hi, > > I am starting to use Mapstraction with the openlayers provider, and I am > not sure how to retrieve the current center of a map in a cross-provider > way. > i.e. currently when calling map.getCenter(), the result returned is the > openlayers internal one, not the long/lat used when calling setCenter(). > > Is that the expected behaviour? > > Regards, > > Philippe > > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > >-- Derek Fowler m. +44 (0) 7966 512 369 e. dezfowler at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100113/45f3ecca/attachment.htm>
(reposted to list, sorry about that.) Hi Derek, answers inline. 2010/1/13 Derek Fowler <dezfowler at gmail.com> Which version of Mapstraction are you using? trunk from a few hours ago(revision 69). I''m not fully certain what exact version this is.> getCenter() will return a new LatLonPoint object with the latidute and > longitude of the current center of the OpenLayers map. It won''t be the same > object you passed into setCenter() if that''s what you mean. > >Yes. but my problem is that when calling setCenter(), one passes a mxn.LatLonPoint. the lat,lon values are something like -6.1335428, 53.2909 for example for around Dublin,Ireland. However when calling getCenter(), the returned values (for the openlayers provider) is of the form (7036844.09047, -683700.10569162). I have tried to use LatLonPoint.fromProprietary(), but I am not sure how to actually call this. I hope this is a bit clearer now, Regards, Philippe -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100113/bfafc443/attachment.htm>
That looks like it''s returning easting and northings rather than lat lon - may be a bug. 2010/1/13 Philippe Duval <phil.duval at gmail.com>> (reposted to list, sorry about that.) > > Hi Derek, > answers inline. > > 2010/1/13 Derek Fowler <dezfowler at gmail.com> > > Which version of Mapstraction are you using? > > > trunk from a few hours ago(revision 69). I''m not fully certain what exact > version this is. > > >> getCenter() will return a new LatLonPoint object with the latidute and >> longitude of the current center of the OpenLayers map. It won''t be the same >> object you passed into setCenter() if that''s what you mean. >> >> > Yes. but my problem is that when calling setCenter(), one passes a > mxn.LatLonPoint. the lat,lon values are something like -6.1335428, 53.2909 > for example for around Dublin,Ireland. > However when calling getCenter(), the returned values (for the openlayers > provider) is of the form (7036844.09047, -683700.10569162). > > I have tried to use LatLonPoint.fromProprietary(), but I am not sure how to > actually call this. > > I hope this is a bit clearer now, > > Regards, > > Philippe > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > >-- Derek Fowler m. +44 (0) 7966 512 369 e. dezfowler at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100113/393c49af/attachment.htm>
I''m seeing this, too, Philippe. You can see it in action at the Mapstraction Sandbox: http://mapstraction.appspot.com/#openlayers Try adding this line to the bottom: alert(mapstraction.getCenter()); It looks like lat/long values need to be adjusted, but the constants inside the fromProprietary in mxn.openlayers.core.js don''t even appear to do the trick. It looks like ajturner took the first crack at this provider. Any ideas, Andrew? --Ad --- Adam DuVander I like maps: http://mapscripting.com I like simple: http://adamduvander.com On Jan 13, 2010, at 8:45 AM, Philippe Duval wrote:> (reposted to list, sorry about that.) > > Hi Derek, > answers inline. > > 2010/1/13 Derek Fowler <dezfowler at gmail.com> > > Which version of Mapstraction are you using? > > trunk from a few hours ago(revision 69). I''m not fully certain what > exact version this is. > > getCenter() will return a new LatLonPoint object with the latidute > and longitude of the current center of the OpenLayers map. It won''t > be the same object you passed into setCenter() if that''s what you > mean. > > > Yes. but my problem is that when calling setCenter(), one passes a > mxn.LatLonPoint. the lat,lon values are something like -6.1335428, > 53.2909 for example for around Dublin,Ireland. > However when calling getCenter(), the returned values (for the > openlayers provider) is of the form (7036844.09047, -683700.10569162). > > I have tried to use LatLonPoint.fromProprietary(), but I am not sure > how to actually call this. > > I hope this is a bit clearer now, > > Regards, > > Philippe > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com
Ok, when calling the fromProprietary method (hacked here, I''m not yet very sure how one is supposed to call it properly), the converted values are correct. so I''ll try to prepare a patch for the openlayers getCenter(). Thanks all for the quick replies. Regards, Philippe 2010/1/13 Adam DuVander <mapstraction at duvander.com>> I''m seeing this, too, Philippe. You can see it in action at the > Mapstraction Sandbox: > http://mapstraction.appspot.com/#openlayers > > Try adding this line to the bottom: > alert(mapstraction.getCenter()); > > It looks like lat/long values need to be adjusted, but the constants inside > the fromProprietary in mxn.openlayers.core.js don''t even appear to do the > trick. > > It looks like ajturner took the first crack at this provider. Any ideas, > Andrew? > > --Ad > --- > Adam DuVander > I like maps: http://mapscripting.com > I like simple: http://adamduvander.com > > > On Jan 13, 2010, at 8:45 AM, Philippe Duval wrote: > > (reposted to list, sorry about that.) >> >> Hi Derek, >> answers inline. >> >> 2010/1/13 Derek Fowler <dezfowler at gmail.com> >> >> Which version of Mapstraction are you using? >> >> trunk from a few hours ago(revision 69). I''m not fully certain what exact >> version this is. >> >> getCenter() will return a new LatLonPoint object with the latidute and >> longitude of the current center of the OpenLayers map. It won''t be the same >> object you passed into setCenter() if that''s what you mean. >> >> >> Yes. but my problem is that when calling setCenter(), one passes a >> mxn.LatLonPoint. the lat,lon values are something like -6.1335428, 53.2909 >> for example for around Dublin,Ireland. >> However when calling getCenter(), the returned values (for the openlayers >> provider) is of the form (7036844.09047, -683700.10569162). >> >> I have tried to use LatLonPoint.fromProprietary(), but I am not sure how >> to actually call this. >> >> I hope this is a bit clearer now, >> >> Regards, >> >> Philippe >> _______________________________________________ >> Mapstraction mailing list >> Mapstraction at lists.mapstraction.com >> http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >> > >-- QMS Software Ltd. <http://www.qms-software.com> Tel: +353-1-2178640, Fax: +353-1-2178691 1 Blackrock Business Park Blackrock, Co. Dublin, Ireland. Registered in Ireland No: 255153 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100113/29e16c7e/attachment-0001.htm>
Hi, Sorry for my repeated questions, but I''m unclear as to how to proceed. The toProprietary and fromProprietary methods on the LatLonPoint are added as proxy methods withthe parameter bWithApiArg set to true. (see mxn.core.js line 1255). I am quite unfamiliar with this, but as far as I can make out, it means that an api argument needs to be passed to the method calls. However, the fromProprietary() implementations do not expect this api argument, and as a result don''t get the olPoint parameter correctly. Is that a bug? or am I completely misunderstanding the usage of this method? Regards, Philippe 2010/1/13 Philippe Duval <phil.duval at gmail.com>> Ok, when calling the fromProprietary method (hacked here, I''m not yet very > sure how one is supposed to call it properly), the converted values are > correct. > so I''ll try to prepare a patch for the openlayers getCenter(). > > Thanks all for the quick replies. > > Regards, > > Philippe > 2010/1/13 Adam DuVander <mapstraction at duvander.com> > > I''m seeing this, too, Philippe. You can see it in action at the >> Mapstraction Sandbox: >> http://mapstraction.appspot.com/#openlayers >> >> Try adding this line to the bottom: >> alert(mapstraction.getCenter()); >> >> It looks like lat/long values need to be adjusted, but the constants >> inside the fromProprietary in mxn.openlayers.core.js don''t even appear to do >> the trick. >> >> It looks like ajturner took the first crack at this provider. Any ideas, >> Andrew? >> >> --Ad >> --- >> Adam DuVander >> I like maps: http://mapscripting.com >> I like simple: http://adamduvander.com >> >> >> On Jan 13, 2010, at 8:45 AM, Philippe Duval wrote: >> >> (reposted to list, sorry about that.) >>> >>> Hi Derek, >>> answers inline. >>> >>> 2010/1/13 Derek Fowler <dezfowler at gmail.com> >>> >>> Which version of Mapstraction are you using? >>> >>> trunk from a few hours ago(revision 69). I''m not fully certain what exact >>> version this is. >>> >>> getCenter() will return a new LatLonPoint object with the latidute and >>> longitude of the current center of the OpenLayers map. It won''t be the same >>> object you passed into setCenter() if that''s what you mean. >>> >>> >>> Yes. but my problem is that when calling setCenter(), one passes a >>> mxn.LatLonPoint. the lat,lon values are something like -6.1335428, 53.2909 >>> for example for around Dublin,Ireland. >>> However when calling getCenter(), the returned values (for the openlayers >>> provider) is of the form (7036844.09047, -683700.10569162). >>> >>> I have tried to use LatLonPoint.fromProprietary(), but I am not sure how >>> to actually call this. >>> >>> I hope this is a bit clearer now, >>> >>> Regards, >>> >>> Philippe >>> _______________________________________________ >>> Mapstraction mailing list >>> Mapstraction at lists.mapstraction.com >>> http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >>> >> >> > > > -- > QMS Software Ltd. > <http://www.qms-software.com> > Tel: +353-1-2178640, Fax: +353-1-2178691 > 1 Blackrock Business Park > Blackrock, Co. Dublin, Ireland. > Registered in Ireland No: 255153 >-- QMS Software Ltd. <http://www.qms-software.com> Tel: +353-1-2178640, Fax: +353-1-2178691 1 Blackrock Business Park Blackrock, Co. Dublin, Ireland. Registered in Ireland No: 255153 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100113/0c2c8a71/attachment.htm>
I''ve just committed a fix for this issue so if you do either an SVN Update or just download the files from Google Code again it should be working as expected. The proxy method which is added to the core LatLonPoint class expects the Mapstraction API ID for the relevant provider as it''s first parameter. This enables the call to be routed in to the correct implementation i.e. the one in mxn.openlayers.core.js. Having said that you are correct in that there was a bug in that code - it should have been stripping off the API ID parameter before passing the call on to the provider method. Derek 2010/1/13 Philippe Duval <phil.duval at gmail.com>> Hi, > > Sorry for my repeated questions, but I''m unclear as to how to proceed. > The toProprietary and fromProprietary methods on the LatLonPoint are added > as proxy methods withthe parameter bWithApiArg set to true. (see mxn.core.js > line 1255). > I am quite unfamiliar with this, but as far as I can make out, it means > that an api argument needs to be passed to the method calls. > However, the fromProprietary() implementations do not expect this api > argument, and as a result don''t get the olPoint parameter correctly. > > Is that a bug? or am I completely misunderstanding the usage of this > method? > > Regards, > > Philippe > > > > > 2010/1/13 Philippe Duval <phil.duval at gmail.com> > >> Ok, when calling the fromProprietary method (hacked here, I''m not yet very >> sure how one is supposed to call it properly), the converted values are >> correct. >> >> so I''ll try to prepare a patch for the openlayers getCenter(). >> >> Thanks all for the quick replies. >> >> Regards, >> >> Philippe >> 2010/1/13 Adam DuVander <mapstraction at duvander.com> >> >> I''m seeing this, too, Philippe. You can see it in action at the >>> Mapstraction Sandbox: >>> http://mapstraction.appspot.com/#openlayers >>> >>> Try adding this line to the bottom: >>> alert(mapstraction.getCenter()); >>> >>> It looks like lat/long values need to be adjusted, but the constants >>> inside the fromProprietary in mxn.openlayers.core.js don''t even appear to do >>> the trick. >>> >>> It looks like ajturner took the first crack at this provider. Any ideas, >>> Andrew? >>> >>> --Ad >>> --- >>> Adam DuVander >>> I like maps: http://mapscripting.com >>> I like simple: http://adamduvander.com >>> >>> >>> On Jan 13, 2010, at 8:45 AM, Philippe Duval wrote: >>> >>> (reposted to list, sorry about that.) >>>> >>>> Hi Derek, >>>> answers inline. >>>> >>>> 2010/1/13 Derek Fowler <dezfowler at gmail.com> >>>> >>>> Which version of Mapstraction are you using? >>>> >>>> trunk from a few hours ago(revision 69). I''m not fully certain what >>>> exact version this is. >>>> >>>> getCenter() will return a new LatLonPoint object with the latidute and >>>> longitude of the current center of the OpenLayers map. It won''t be the same >>>> object you passed into setCenter() if that''s what you mean. >>>> >>>> >>>> Yes. but my problem is that when calling setCenter(), one passes a >>>> mxn.LatLonPoint. the lat,lon values are something like -6.1335428, 53.2909 >>>> for example for around Dublin,Ireland. >>>> However when calling getCenter(), the returned values (for the >>>> openlayers provider) is of the form (7036844.09047, -683700.10569162). >>>> >>>> I have tried to use LatLonPoint.fromProprietary(), but I am not sure how >>>> to actually call this. >>>> >>>> I hope this is a bit clearer now, >>>> >>>> Regards, >>>> >>>> Philippe >>>> _______________________________________________ >>>> Mapstraction mailing list >>>> Mapstraction at lists.mapstraction.com >>>> http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >>>> >>> >>> >> >> >> -- >> QMS Software Ltd. >> <http://www.qms-software.com> >> Tel: +353-1-2178640, Fax: +353-1-2178691 >> 1 Blackrock Business Park >> Blackrock, Co. Dublin, Ireland. >> Registered in Ireland No: 255153 >> > > > > -- > QMS Software Ltd. > <http://www.qms-software.com> > Tel: +353-1-2178640, Fax: +353-1-2178691 > 1 Blackrock Business Park > Blackrock, Co. Dublin, Ireland. > Registered in Ireland No: 255153 > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > >-- Derek Fowler m. +44 (0) 7966 512 369 e. dezfowler at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100114/76543c2e/attachment.htm>
2010/1/14 Derek Fowler <dezfowler at gmail.com>> I''ve just committed a fix for this issue so if you do either an SVN Update > or just download the files from Google Code again it should be working as > expected. > > The proxy method which is added to the core LatLonPoint class expects the > Mapstraction API ID for the relevant provider as it''s first parameter. This > enables the call to be routed in to the correct implementation i.e. the one > in mxn.openlayers.core.js. Having said that you are correct in that there > was a bug in that code - it should have been stripping off the API ID > parameter before passing the call on to the provider method. > > Derek > >Thanks a lot, that worked a charm! Regards, Philippe -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100118/6678eef8/attachment.htm>
Possibly Parallel Threads
- Panning map to a point vs. setCenter
- [mapstraction commit] r11 - Added functionality to automatically load scripts needed.
- [mapstraction commit] r12 - Implemented most Cloudmade functions. Still requires image, tile and KML/GeoRSS overlays
- Implementation of openBubble for openlayers
- regarding polylines