Hello.
I am trying to calculate the difference between the bounds of my map. When I
call the getBoundsLatLon() function she seems not to get me an object with the
properties LatMax, LatMin, LonMax and LonMin. I am new to the Yahoo Maps AJAX
API.
my code is:
var map = new YMap(document.getElementById('map'));
map.addTypeControl();
map.setMapType(YAHOO_MAP_REG);
map.drawZoomAndCenter("San Francisco", 3);
var bounds = map.getBoundsLatLon();
var height = bounds.LatMax - bounds.LatMin;
alert(height);
I always get "bounds is undefined" in the error console of Firefox.
The map is being drawn correctly.
The alert is not being shown because of the "bounds is undefined" error.
I am using the 3.8 version of the API.
Any help will be appreciated a lot.
Thanks in advance.
hi all,
I met a problem when I dynamically load Yahoo map script,
var e = document.createElement("script");
e.src =
"http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=YD-eQRpTl0_JX2E95l_xAFs5UwZUlNQh\
hn7lj1H";
e.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);
then, I can get the YAHOO variable but not YAHOO_MAP_REG. It seems the scripts
in http://api.maps.yahoo.com/ajaxymap?v=3.8 is not loaded.
Would you please give me some suggestions? And is there any workaround?
Thanks,
Arthur
I just wanted to add that I don't think I'm creating the object properly. When I
do this:
var marker = new YCustomOverlay(new YGeoPoint(Lat, Lon));
(Lat and Lon are numbers)
and I try to access the YGeoPoint it says it's not defined.
I even try this example I found in Internet:
var oDiv = document.createElement("div");
oDiv.style.width = "16px";
oDiv.style.height = "16px";
oDiv.style.backgroundColor = "blue";
oMap.addOverlay(new YCustomOverlay(oMap.getCenterLatLon(), oDiv));
but it won't show anything!! :(
How do I create a YCustomOverlay then? I'm stuck here I can't make them work.
Thanks again :)
Reine.
--- In yws-maps-ajax@yahoogroups.com, "notaplayer83" <notaplayer83@...> wrote:
>
> Hi :)
>
> I'm working with YCustomOverlays but I'm not able to get the lat nd long from
the object once it's created :(. The weird part is that I can actually print
them with an alert() but can't use the value for anything else.
>
> To get the value I'm using something like this:
>
> var point = marker.YGeoPoint; // marker is the YCustomOverlay
>
> Firebug says marker.YGeoPoint is undefined but if I do this:
> alert(marker.YGeoPoint.Lat);
>
> I get the right values.
>
> What can I do to get the lat and long properly?
>
> Thanks fr your help :)
> Reine.
>
Hi :)
I'm working with YCustomOverlays but I'm not able to get the lat nd long from
the object once it's created :(. The weird part is that I can actually print
them with an alert() but can't use the value for anything else.
To get the value I'm using something like this:
var point = marker.YGeoPoint; // marker is the YCustomOverlay
Firebug says marker.YGeoPoint is undefined but if I do this:
alert(marker.YGeoPoint.Lat);
I get the right values.
What can I do to get the lat and long properly?
Thanks fr your help :)
Reine.
Hi all,
Is there any way to load yahoo map script dynamically?
In google maps we can use
var script = document.createElement("script");
script.src = "http://www.google.com/jsapi?key=api_key
&callback="addGoogleStaff"";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
In virtual Earth
var script = document.createElement("script");
script.src =
"http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2onScriptLoad='addVE\
Staff'";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
Is there any similar method in Yahoo maps?
Thanks,
Arthur
Capgemini Requires 3000 Positions -Fresher & 1-2y Exp Immidiatly
Qualification : Btech,MCA,BCA,Msc(IT),Msc(cs)
Platform:UNIX,JAVA,.NET,ORACLE9i,C++
Location : Banglore,Hyderabad,Pune,Noida,Delhi
for details
http://alturl.com/misz
Sign-Up here' and register your profile clearly and post your resume.
Shortlisted candidate will be called for online test on July 25th 2009
Hi All,
I am developing a web application, in this i have to perform these two tasks,
i) Javascript API calls for optimum routing based on start/origin and
end/destination.
ii) Retrieve the lat/long for the route identified for the optimum route.
If you have worked in these, kindly let me know how to do.
Thanks,
Vadivelan. P
I'm wondering how i can show custom markers (just change the default icon
really) on my Yahoo Map (Ajax) when using GeoRSS. I have the following code but
i cannot get the icon to show:
<script type="text/javascript" language="JavaScript">
function StartYMap() {
var map = new YMap(document.getElementById('mapDiv'));
map.setMapType(YAHOO_MAP_SAT);
map.addTypeControl();
map.addPanControl();
map.addZoomLong();
function doStart(eventObj) {
var defaultEventObject = eventObj;
}
function doEnd(eventObj) {
var defaultEventObject = eventObj;
map.smoothMoveByXY(new YCoordPoint(10,50));
}
YEvent.Capture(map,EventsList.onStartGeoRSS, function(eventObj) {
doStart(eventObj); });
YEvent.Capture(map,EventsList.onEndGeoRSS, function(eventObj) {
doEnd(eventObj); });
map.addOverlay(new YGeoRSS('http://www.surfacewatch.com[*rss_geo_link*]'));
function createCustomMarkerImage(){
var myImage = new YImage();
myImage.src =
'http://www.surfacewatch.com/assets/images/map_icon.png';
myImage.size = new YSize(20,20);
myImage.offsetSmartWindow = new YCoordPoint(0,0);
return myImage;
}
}
window.onload = StartYMap;
</script>
Hi, I have a simple question, I'm starting to migrate a Web application from
Google Maps to Yahoo Maps and I want to use the AJAX API but I cannot seem to
find anywhere in the documentation or any forum out there how to change the
control names to spanish.
With Google I just pass a parameter like this:
<script src="http://maps.google.com/maps?file=api&v=2& hl=es & key= ...
Where hl=es does the trick of changing the control labels and everything else to
spanish.
I see that the ActionScript API has the option to change the locale, is this
supported also for the AJAX API?, I will really appreciate your help in this
matter, cheers!
Jorge Pablos
Sonora, Mexico
http://www.inmosonora.com
--- In yws-maps-ajax@yahoogroups.com, "kevin_korczak" <kkorczak@...> wrote:
>
> The map.disableKeyControls() and enableKeyControls() functions flip the
boolean '_disableKeys' variable but to no effect either way.
>
> The arrow keys still move the map after onfocus on an input text field invokes
the map.disableKeyControls() despite debug code showing the _disableKeys
variable has been flipped to 'true'.
>
> Likewise when onblur invokes enableKeyControls() _disableKeys is correctly
flipped back to 'false'.
>
> Any ideas?
>
> head markup:
>
> <script type="text/javascript"
src="http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=....................
>
> The following scripts do not show up when you do a simple view source but
firebug's html tab shows them. It's that last script that contains the
KeyControls functions.
>
> <script type="text/javascript"
src="http://l.yimg.com/d/lib/common/utils/2/dom_2.0.1-b2.js">
> </script>
> <script type="text/javascript"
src="http://l.yimg.com/d/lib/common/utils/2/event_2.0.0-b2.js">
> </script>
> <script type="text/javascript"
src="http://l.yimg.com/d/lib/common/utils/2/dragdrop_2.0.1-b4.js">
> </script>
> <script type="text/javascript"
src="http://l.yimg.com/d/lib/common/utils/2/animation_2.0.1-b2.js">
> </script>
> <script type="text/javascript"
src="http://l.yimg.com/d/lib/map/js/api/ymapapi_3_8_2_3.js">
>
> that last script clearly has the functions mentioned.
>
> Again, I gotta be missing something, any Ideas?
>
> -Kevin
>
One other piece of the puzzle: We're using an older version of dojo (v. 0.3.1)
which has the yahoo maps calls built into it.
Finally: a bright moment. the "distance" method has property "kilometers",
"miles" etc. according to the manual.
So:
var g1 = new YGeoPoint(52.4264895, 4.8389139);
var g2 = new YGeoPoint(52.3539378, 4.9302562);
var d = g1.distance(g2);
alert(d.kilometers);
This works, but is SO WRONG!!! According to the lon/lat's of the two geopoints
(which I retrieved by using:
http://developer.yahoo.com/maps/rest/V1/geocode.html), the distance from my
office to HQ is about 10 kilometers, while in fact it's almost 20 (about 19.5)!
Am I doing something wrong here (probably!).
If so, can anyone point me in the right direction, cause it looks like the
Haversine formula was used, which is never too accurate.
Too bad this forum does not seem to be a very active one, and pretty sure that
Yahoo will never respond themselves....
--- In yws-maps-ajax@yahoogroups.com, "connectcasenl" <cees@...> wrote:
>
> So far, I came up with:
>
> var g1 = new YGeoPoint(52.426520,4.839082);
> var g2 = new YGeoPoint(52.354187,4.929902);
> var d = g1.distance(g2);
>
> I just want the var d to be outputted, but don't know how. It keeps telling me
it is an object.....
>
> --- In yws-maps-ajax@yahoogroups.com, "connectcasenl" <cees@> wrote:
> >
> > Hi there,
> >
> > anyone know if it's possible to create a distance calculator with the Ajax
API? Been searching the Developer Network site all night long, but I could only
find that it's possible with the AS3 API.
> >
> > Regarding the Ajax API, there is a YMapDistance-constructor, but that seems
to be some sort of convertor....
> >
> > What I want is basically: enter two adresses, calculate distance and output
that in a div. Preferrably no loading of any (graphical) maps.....
> >
> > Thanks for any points into the right directioN!
> >
>
So far, I came up with:
var g1 = new YGeoPoint(52.426520,4.839082);
var g2 = new YGeoPoint(52.354187,4.929902);
var d = g1.distance(g2);
I just want the var d to be outputted, but don't know how. It keeps telling me
it is an object.....
--- In yws-maps-ajax@yahoogroups.com, "connectcasenl" <cees@...> wrote:
>
> Hi there,
>
> anyone know if it's possible to create a distance calculator with the Ajax
API? Been searching the Developer Network site all night long, but I could only
find that it's possible with the AS3 API.
>
> Regarding the Ajax API, there is a YMapDistance-constructor, but that seems to
be some sort of convertor....
>
> What I want is basically: enter two adresses, calculate distance and output
that in a div. Preferrably no loading of any (graphical) maps.....
>
> Thanks for any points into the right directioN!
>
Hi there,
anyone know if it's possible to create a distance calculator with the Ajax API?
Been searching the Developer Network site all night long, but I could only find
that it's possible with the AS3 API.
Regarding the Ajax API, there is a YMapDistance-constructor, but that seems to
be some sort of convertor....
What I want is basically: enter two adresses, calculate distance and output that
in a div. Preferrably no loading of any (graphical) maps.....
Thanks for any points into the right directioN!
I'm having the same problem! Is there a solution to this? Is there an
update that I missed?
-Blaise
--- In yws-maps-ajax@yahoogroups.com, "rammano3" <rammano3@...> wrote:
>
> Just wanted to add a link to show you an example. From one of the
> examples from yahoo if you print from internet explorer it prints it
in
> squares. Right click print or print preview on the map and you can
see
> what I am talking about.
> http://developer.yahoo.com/maps/ajax/V3.8/example/georss-xml-
> overlay.html
>
Just wanted to add a link to show you an example. From one of the
examples from yahoo if you print from internet explorer it prints it in
squares. Right click print or print preview on the map and you can see
what I am talking about.
http://developer.yahoo.com/maps/ajax/V3.8/example/georss-xml-
overlay.html
Printing the map using standard window.print() in javascript has
suddenly started printing funny. It only print a small section of the
map with the square sections split apart by a gray space. It is also
printing this on the second page of seven. This used to work perfect.
Maybe a recent update to the API has made it stop working with my
implementation? Any ideas? Thanks!
Is it possible to retrieve driving directions with Yahoo AJAX Maps
API? If so, please can somebody share a code snippet or point me to
the documentation ?
If not, is there any other way of retrieving them?
-A.D