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
Hi,
I took the example on the AJAX maps page where it says:
"You need at least one div container in which to place the map. Here,
it's called "map". By default, the map will expand to fit the size of
the div container. You should provide a height and width for the div
container or else the map may not size as expected."
Since I want to show my page in standards mode, I added a doctype to
it so that I got the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript"
src="http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=VvzHd8rV34GF1BoZV2QiN5cqGxra\
x0dBCF5RnIhTci06M_AEQFfn6EfiKmxf_Q--"></script>
<style type="text/css">
#map{
height: 75%;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
// Create a map object
var map = new YMap(document.getElementById('map'));
// Add map type control
map.addTypeControl();
// Set map type to either of: YAHOO_MAP_SAT, YAHOO_MAP_HYB,
YAHOO_MAP_REG
map.setMapType(YAHOO_MAP_REG);
// Display the map centered on a geocoded location
map.drawZoomAndCenter("San Francisco", 3);
</script>
</body>
</html>
This code produces a map of size 400x400 pixels, despite setting the
width and height. I also tried the following:
<div id="map" style="width: 100px; height: 75%"></div>
but that produced the same effect.
Can anyone tell me how I can get the correct behavior in standards
mode for this?
It would also be good to know how the ajax map actually calculates the
space that it needs. Where, for example, does the 400 pixels come from?
--- In yws-maps-ajax@yahoogroups.com, "c_suereth" <c_suereth@...> wrote:
>
> I am trying to set up my map, and I want it to point to a subdomain.
> However, I put the domain in when I registered my key. Will this work
> and if not, how do I fix it?
> Thank you.
>
I have not found the answer to my problem, but I have worked around
it. Thank you anyway.
Are we supposed to save the files in .php files or .html files?
--- In yws-maps-ajax@yahoogroups.com, "peterpunks" <peterpunks@...> wrote:
>
> Hi guys, I'm having a problem trying to show a map from within a
webpage.
>
> The webpage is a detail page showing office center's information, the
> information is called and displayed through an ajax function that
> calls another php file...
>
> the problem is when you select to view the map, it only show the blank
> div but not the map, but when I put the javascript code inside the the
> main php it shows flawlessly, Is this has something to do with the api
> key?
>
> here's the code:
>
> main php:
>
> <script type='text/javascript'
>
src='http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=f.k_40PV34GQsXxKH3FtjHgQ.q9E\
hO..zgipI0U_7N6.DRspGaudelKR.E1cl1i.6g--'></script>
>
> on the secondary php (called from ajax function) is this code:
> case "map":
> $resultInfo = "<h2>Map</h2>";
> $yahooString = <<<EOF
> <div id="ymap">
> <script type="text/javascript">
> // Create a map object
> var map = new YMap(document.getElementById('ymap'));
> // Display the map centered on a geocoded location
> map.drawZoomAndCenter("San Francisco", 6);
> </script>
> EOF;
> $resultInfo .= $yahooString;
>
>
> btw the files are located
> main php: root folder 'center.php'
> secondary php on '/classes/centerProcess.php'
>
> this is an example page:
> http://test.pbcenters.com/center.php?cid=111
>
> any help or directions would be greatly appreciated...
>
> Memo.
>
I am trying to set up my map, and I want it to point to a subdomain.
However, I put the domain in when I registered my key. Will this work
and if not, how do I fix it?
Thank you.
Hi guys, I'm having a problem trying to show a map from within a webpage.
The webpage is a detail page showing office center's information, the
information is called and displayed through an ajax function that
calls another php file...
the problem is when you select to view the map, it only show the blank
div but not the map, but when I put the javascript code inside the the
main php it shows flawlessly, Is this has something to do with the api
key?
here's the code:
main php:
<script type='text/javascript'
src='http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=f.k_40PV34GQsXxKH3FtjHgQ.q9E\
hO..zgipI0U_7N6.DRspGaudelKR.E1cl1i.6g--'></script>
on the secondary php (called from ajax function) is this code:
case "map":
$resultInfo = "<h2>Map</h2>";
$yahooString = <<<EOF
<div id="ymap">
<script type="text/javascript">
// Create a map object
var map = new YMap(document.getElementById('ymap'));
// Display the map centered on a geocoded location
map.drawZoomAndCenter("San Francisco", 6);
</script>
EOF;
$resultInfo .= $yahooString;
btw the files are located
main php: root folder 'center.php'
secondary php on '/classes/centerProcess.php'
this is an example page:
http://test.pbcenters.com/center.php?cid=111
any help or directions would be greatly appreciated...
Memo.
hi there!
i started coding by the help of the yahoo maps api! well i got an
appid and played around with your service. well after a while i wanted
to try out your geocoding service. i experienced that there i have to
work with REST and coded like as you posted it on your geocoding
website. then i tried out my piece of work. well but i all the time
get an error telling me that the use of xmlhttprequest.open is
restricted and that i cant access this method! so i started again with
the registration and tried to do a browser based authetication. no
luck this time again i did everything as described on that page placed
the auth. file at the root of my page but your authetication service
cant locate it. well by typing in the url and the filename the
browser brings up the file and its content!
you may give me a hint to come along with that issue!
cu fritz
Hello All,
I have been using Yahoo AJAX maps for a few months but am still
learning. I would like to find out if there is a method available
that will return the YGeoPoint (latitude and longitude) of a Ymarker?
I create my Ymarker's using the address of a point (street, city,
state, zip) and do not have the initial latitude and longitude. There
are some subsequent things I would like to do on my maps which require
the latitude and longitude of my markers.
I have seen the example where the Latitude and Longitude of the
position of the mouse when it is clicked is displayed in Ylog, but I
can't figure out how this could be incorporated using Ymarker. I have
experimented using YCoordPoint to return the x,y position of each
marker but these values do not appear to be correct.
Any help or suggestions would be appreciated.
Thanks.
Hi everyone,
I am fairly new to web programming and I was wondering if anyone could
explain why I have the following problem with the demo code for Ymaps.
The issue I am having is that I can't get the map's width to spread
across the screen if I use the following doc type (it just produces a
square map half the size of the screen)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Is there a preferred doctype to use with maps? Any wisdom would be
greatly appreciated
Thanks
-J
here is the code I used
<html>
<head>
<script type="text/javascript"
src="http://api.maps.yahoo.com/ajaxymap?v=3.7&appid=YahooDemo"></script>
<style type="text/css">
#map{
height: 75%;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
// Create a map object
var map = new YMap(document.getElementById('map'));
// Add map type control
map.addTypeControl();
// Set map type to either of: YAHOO_MAP_SAT, YAHOO_MAP_HYB, YAHOO_MAP_REG
map.setMapType(YAHOO_MAP_SAT);
// Display the map centered on a geocoded location
map.drawZoomAndCenter("San Francisco", 3);
</script>
</body>
</html>
I'm able to load markers via GeoRSS, but a few things are missing from
the popup information box.
Each of my items look like this:
<item>
<title>mytitle</title>
<link><![CDATA[http:///www.mylink.com]]></link>
<description></description>
<ymaps:Address>myaddress</ymaps:Address>
<ymaps:CityState>mycity</ymaps:CityState>
<ymaps:GroupId>mygroup</ymaps:GroupId>
<ymaps:ExtraLink href="http://www.mylink.com">More
Details</ymaps:ExtraLink>
<ymaps:ExtraImage>
<url><![CDATA[http://www.myimageurl.com]]></url>
<title>imagetitle</title>
<link><![CDATA[imagelinkurl]]></link>
</ymaps:ExtraImage>
</item>
Yahoo Maps GeoRSS specification:
http://com4.devnet.re3.yahoo.com/maps/georss/index.html
1. the ExtraImage shows up with the correct title, but doesn't link
anywhere.
2. the ExtraLink doesn't show up at all.
Is there a problem with my GeoRSS xml, or are these bugs?
Maybe I am missing something, but an overloaded YGeoPoint method is
definately needed here. Something along the lines of:
var point = new YGeoPoint('some address/city,state/zip');
Google maps does this for geocoding and it works really well. Am I
missing something?
Hello,
I've been using the Yahoo Ajax Map API for well over a year, starting
with version 3.0. It's been easy to use and has worked very well.
Thank you and keep up the good work!!
I upgraded to the most recent 3.7 API. Now, I want to add labels to
the markers I have on the map. I do so this way:
var marker = new YMarker("New York, NY, USA", "marker1");
marker.addLabel("YOU ARE HERE");
this.map.addOverlay(marker);
The result, however, is that the little "bubble" marker appears on the
map at the correct place, but the "YOU ARE HERE" text is not in the
bubble, in fact, it appears on the map down and to the right of the
marker bubble.
I've added multiple markers with labels to a map, and all of the label
texts appear down and to the right of where they should be.
Any idea why this is happening?
In case it matters, I'm also using various parts of YUI version 2.3.1
on the same page as the map, in case that's creating any collisions.
Also, we use some advanced CSS for layout and positioning, in case
that might be causing issues.
Thank you!!!
-Ryan
co-author, "Foundations of Ajax"
Lead Developer, Taconite Framework (taconite.sf.net)
Hi
I am also experiencing the same problem with memory leakage using the
removeMarkersAll and removeOverlay functions. It appears to be
particularly evident within Internet Explorer, however it is also
observed within FireFox when the operations are repeated several
times.
As I understand, based on earlier posts within this forum, Yahoo were
addressesing the issue, however this was raised at version 3.0 of the
AJAX API and it still does not seem to be resolved.
Please see the following related links:
http://tech.groups.yahoo.com/group/yws-maps/message/3120http://tech.groups.yahoo.com/group/yws-maps/message/5299
Any comment from Yahoo would be greatly appreciated.
Regards
Jamie
--- In yws-maps-ajax@yahoogroups.com, "mauno3" <eiprkl@...> wrote:
>
> Ajax version of map seems to leak a lot of memory when used with IE7.
> I found that I could use YEvent.ClearAll(marker) before removing
> marker from map to minimize memory leak. Function isn't documented.
>
> Problem is that ClearAll function is slow, are there any
alternatives?
> YEvent.Remove doesn't seem to work, it leaves functions to
YEvent._cache.
>
> Is there a way to clean whole map? Currently user cannot exit if
yahoo
> map contains >40 markers without getting "script is taking too long"
> -popup with ie7.
>
Ajax version of map seems to leak a lot of memory when used with IE7.
I found that I could use YEvent.ClearAll(marker) before removing
marker from map to minimize memory leak. Function isn't documented.
Problem is that ClearAll function is slow, are there any alternatives?
YEvent.Remove doesn't seem to work, it leaves functions to YEvent._cache.
Is there a way to clean whole map? Currently user cannot exit if yahoo
map contains >40 markers without getting "script is taking too long"
-popup with ie7.
Hi,
My hope is to draw a circle in yahoo maps. But, I try to use
jsgraphics library. But, the shapes (lines, ellipse or square) don't
refresh because of yahoo maps !!!
How do you draw the shapes in yahoo maps ?
Thank to answer my question.
Regards.
Sébastien Nicaisse.
I got a couple questions:
1. Yahoo released YUI as a BSD licensed library. The Map AJax APi uses
some of the js files although they are out of sync version wise. From js
perspective, the map API is a set of widgets used to view a dynamically
loaded image tiles, just like other widgets in YUI such as sliders etc.
A standalone tile image viewer widget can be very useful. A great
potential is to use it as a map viewer for map contents produced by our
own organization, or use it to view extremely large images (which can be
splited into tiles at different level) in a different coordinate system
etc. (http://gwtsandbox.com/?q=node/33) Is it possible Yahoo may
consider something like this? We'd love it even it may not be BSD
license.
2. If not, what if I downloaded the actual javascript
(http://yuiblog.com/blog/2006/12/14/maps-plus-yui/) and modify it to
fit my needs? If I am not consuming the actual map images from
http://us.i1.yimg.com, will that modification violate teh terms of
service? Currenly Google API have all functions I need (customize map
types, projection etc) but their licecnse does not allow Intranet use
without a very high price.
3. If I customize (by extending prototype etc) some of the undocumented
internal classes in the API, such as MercatorProjection, will that
consider a viloation of the terms of service?
Thanks a lot!
--- In yws-maps-ajax@yahoogroups.com, "avr_255" <support23@...> wrote:
>
> --- In yws-maps-ajax@yahoogroups.com, "Rahul Malik" <rmalik2@>
> wrote:
> >
> > Hi YMaps Developers!
> >
> > There has been some documentation improvements and additions for
> > version 3.7 of the API that you can play around with. The examples
> now
> > build on each other so that they are easier to follow.
> >
> > **New** We have cheatsheets that should be a good reference while
> you
> > are coding away that are comprehensive and compact in a PDF format.
> >
> > You can view the new Getting Started Guide here:
> > http://developer.yahoo.com/maps/ajax/index.html
> >
> > You can view the new Reference section here:
> > http://developer.yahoo.com/maps/ajax/V3.7/reference.html
> >
> > And download all the examples + cheatsheets in one zipped up
> bundle here:
> >
> http://developer.yahoo.com/maps/ajax/V3.7/yahoo_maps_ajax_api_referen
> ce_bundle.z\
> > ip
> >
> >
> > Stay tuned for more updates and in the meanwhile have fun coding
> and
> > ping me if you need some help.
> >
> > ~Rahul Malik
> > Y!Maps - Developer Intern
> >
>
> This is great.
>
> Is there a summary of changes, enhancements, bug fixes,
> incompatibilities and known issues for this version (3.7)?
>
> Is there a "roadmap" and timetable for future versions (e.g.,
> support for polygon fill)?
>
> Is there a way for developers to submit bug reports and feature
> requests to Yahoo?
>
> Will you or someone on Yahoo development/support team monitor this
> forum and answer questions regarding Yahoo AJAX map api?
>
> Thanks.
>
The details you are asking for are internal at Yahoo. You can submit
bug reports to this forum as we monitor it to see and help with
problems with the Y!Maps API. We check this forum in addition to our
normal workload to help the public usage of our API.
Hope this helps!
~Rahul Malik
Y!Maps - Intern
Is this online? It is hard to imagine what you are exactly talking
about from this description.
~Rahul
--- In yws-maps-ajax@yahoogroups.com, "asganeshbabu"
<asganeshbabu@...> wrote:
>
> Hi,
>
> I am Ganesh, new member of this Group.
>
> I generated a XML file containing custom marker with addAutoExpand()
> for my map. When i executed the map and mouse hover on a marker placed
> in the corner of the map, the AutoExpand small window gone inner
> outside of the map.
>
> Can I bring the small window into the map region? I tried the
> openSmartWindow in the MouseOver event. But due to the custom marker
> it is not working. It bring the last marker details.
>
> Please answer me as soon as possible.
>
Hi Tony,
At this point in time you cannot use the Yahoo Maps AJAX API to do
driving directions.
~Rahul Malik
--- In yws-maps-ajax@yahoogroups.com, congfan zhou <tonychou8253@...>
wrote:
>
> Hi there,
>
> I have a problem about the Yahoo! Maps AJAX API . How can I add
the function of searching the path or driving directions to the yahoo
map embeded in my own page? Is it possible to do it now? Thanks!
>
>
> Tony
I have a problem about the Yahoo! Maps AJAX API . How can I add the function of searching the path or driving directions to the yahoo map embeded in my own page? Is it possible to do it now? Thanks!
Hi,
I am Ganesh, new member of this Group.
I generated a XML file containing custom marker with addAutoExpand()
for my map. When i executed the map and mouse hover on a marker placed
in the corner of the map, the AutoExpand small window gone inner
outside of the map.
Can I bring the small window into the map region? I tried the
openSmartWindow in the MouseOver event. But due to the custom marker
it is not working. It bring the last marker details.
Please answer me as soon as possible.
I apologize if this is posted in the incorrect Group. I am trying to
determine if the Yahoo Maps APIs are available for intranet use. I have
found such documentation stating so at:
http://developer.yahoo.net/blog/archives/2006/06/yahoo_maps_you_1.html
According to this document intranet use is allowed. However, when
navigating to each of the reference manuals for the Yahoo Maps API
found under the "rate limit", it sates "Non-Commercial use only". The
Getting Started guide does not state that under the "rate limit". Can
someone help to answer my question or lead me in the right direction as
who to ask? I have tried to register where you are supposed to receive
feed back about questions you may have, but I have got no such thing on
4 attempts over the last month.
Thanks,
Adam
Hi everyone.
Basically what I want to do is have an image over the map based off of
screen coords (always in the same place when the map pans).
I tried to look around the documentation and examples. The YImage
reference section says that it should be used with the YCustomOverlay,
but I can't seem to find anything that links them together.
YCustomOverlay only takes HTML as its second argument and I am not
sure how to turn the YImage into one...
Thoughts or an example I can take a look at that is doing what I am
trying to do?
Thanks in advance.
chrizbo
Heres a demo that you can mess around with. The drag event you were
looking for is actually the functionality of EventsList.onPan, I think
this is what you were looking for:
<html>
<head>
<script type="text/javascript"
src="http://api.maps.yahoo.com/ajaxymap?v=3.7&appid=YahooDemo"></script>
<style type="text/css">
#map{
height: 75%;
width: 100%;
}
</style>
</head>
<body>
<div id="mapContainer"></div>
<div id="mapInfo"></div>
<script type="text/javascript">
// Create a lat/lon object
var myPoint = new YGeoPoint(36.7388841243943,-15.1171875);
// Create a map object
var map = new YMap(document.getElementById('mapContainer'));
// Display the map centered on a latitude and longitude
map.drawZoomAndCenter(myPoint, 16);
// Add map type control
//map.addTypeControl();
// Add a slider zoom control
map.addZoomLong();
// Set map type to either of: YAHOO_MAP_SAT YAHOO_MAP_HYB YAHOO_MAP_REG
map.setMapType(YAHOO_MAP_REG);
function displayCenter() {
var center = map.getCenterLatLon();
YLog.print('('+center.Lat+','+center.Lon+')');
}
YEvent.Capture(map, EventsList.onPan, displayCenter);
</script>
</body>
</html>
--- In yws-maps-ajax@yahoogroups.com, "marclebel81" <marclebel81@...>
wrote:
>
> --- In yws-maps-ajax@yahoogroups.com, "golden360vr" <golden360@> wrote:
> >
> > When I drag the map around, is there any way to get the Lat/Lon info
> > the the center point, and show such info somewhere on the web page?
> > Please help, a demo will be appreciated.
> >
>
>
> Hi,
>
> Here is a simple example that displays the center of the map each time
> you click on it :
>
> <div id="mapContainer"></div>
> <div id="mapInfo"></div>
>
> <script type="text/javascript">
> // Create a lat/lon object
> var myPoint = new YGeoPoint(36.7388841243943,-15.1171875);
> // Create a map object
> var map = new YMap(document.getElementById('mapContainer'));
> // Display the map centered on a latitude and longitude
> map.drawZoomAndCenter(myPoint, 16);
>
> // Add map type control
> //map.addTypeControl();
> // Add a slider zoom control
> map.addZoomLong();
>
>
> // Set map type to either of: YAHOO_MAP_SAT YAHOO_MAP_HYB YAHOO_MAP_REG
> map.setMapType(YAHOO_MAP_REG);
>
> function displayCenter() {
> var center = map.getCenterLatLon();
> document.getElementById('mapInfo').innerHTML =
> '('+center.Lat+','+center.Lon+')';
> }
>
> YEvent.Capture(map, EventsList.MouseClick, displayCenter);
>
> </script>
>
There is currently no public API for driving directions from Yahoo so
you will have to redirect for driving directions and also there is no
way to distinguish what a street or highway is for proper overlays
that stay within the road margins.
~Rahul
--- In yws-maps-ajax@yahoogroups.com, "avr_255" <support23@...> wrote:
>
> --- In yws-maps-ajax@yahoogroups.com, "dvidluca" <dvidluca@>
> wrote:
> >
> > Hi,
> >
> > I've got a map with a 'home' marker on it and a smartWin that
> opens and
> > lets you enter another address to add a second marker to the map.
> I
> > can draw a line between them with YPolyline, center the map on the
> > middle distance and zoom out to an appropriate level easily, but
> the
> > polyLine is a straight, 'as the crow flies' line between the two.
> How
> > can I get the polyline to follow roads and provide a route
> (optimally
> > with directions too)?? Is this possible??
> >
> > Do I have to create a series of polylines or is their another
> service
> > or API I can use?
> >
>
> With start and destination addresses, you can simply create a URL
> link to Yahoo for driving directions. Here is an example of starting
> at "100 Wall Street,New York,NY" and ending at "1600 Pennsylvania
> Ave,Washington DC":
>
> <a target="_blank" href="http://api.maps.yahoo.com/dd_result?
> addr=100+Wall+Street%2C+New+York%2C+NY&taddr=1600+Pennsylvania+Ave%
> 2C+Washington+DC">Driving Directions</a>
>