Loading ...
Sorry, an error occurred while loading the content.

GeoRSS: add overlay to map with AJAX Api

Expand Messages
  • iondata_zach
    I am dynamically creating a GeoRSS feed from my SQL db based on a users input and their location then posting the java back into my page. The map loads fine,
    Message 1 of 3 , May 1, 2008
    View Source
    • 0 Attachment
      I am dynamically creating a GeoRSS feed from my SQL db based on a
      users input and their location then posting the java back into my
      page. The map loads fine, my GeoRSS file is public on my site, and
      part of the java is firing because i coded in a text box to check it
      out. Here is my code:

      This is the map that inititially loads, there are a couple text boxes
      on the screen that the user can input their address in which i
      geocode and then pull a couple points from my DB. That part all
      works.


      <script type="text/javascript" language="JavaScript">

      function StartYMap() {
      var map = new YMap(document.getElementById('ymap'));
      map.addPanControl();
      map.addZoomShort();
      map.drawZoomAndCenter("85353",3);
      function doStart(eventObj) {
      var defaultEventObject = eventObj;
      }
      function doEnd(eventObj) {
      var defaultEventObject = eventObj;
      map.smoothMoveByXY(new YCoordPoint(10,50));
      }
      }
      window.onload = StartYMap;

      </script>

      After I have my GeoRSS file I call this:


      void CallJava(string myPath)
      {
      StringBuilder sb = new StringBuilder();
      sb.Append("<script type='text/javascript'
      language='JavaScript'>\n");

      sb.Append("function geoRss(){\n");
      sb.Append("var map = YMap(document.getElementById
      ('ymap'));\n");
      sb.Append("map.addOverlay(new YGeoRSS('" + myPath + "'));\n");
      sb.Append("}\n");
      sb.Append("alert('stuff happened!');");
      sb.Append("</script>\n");

      Which postsback the page and adds this in in a seperate java block:

      <script type='text/javascript' language='JavaScript'>
      function geoRss(){
      var map = new YMap(document.getElementById('ymap'));
      map.addOverlay(new YGeoRSS
      ('http://www.iondataexpress.com/geo/geo.xml'));
      }
      alert('stuff happened!');</script>

      ...

      The alert "stuff happened!" fires. My overlay does not get on the
      map though... can anyone help me and tell me what I am doing wrong?
      I don't have a ton of exp with java so I believe i may not understand
      the order of events that is happening here.

      Thanks for any help!!!

      Zach
    • yanncorno
      Keep in mind that the map.addOverlay(new YGeoRSS... is going to be executed asynchronously. In other words, your alert( stuff happened! ) is going to appear
      Message 2 of 3 , May 4, 2008
      View Source
      • 0 Attachment
        Keep in mind that the "map.addOverlay(new YGeoRSS..." is going to be
        executed asynchronously. In other words, your alert('stuff happened!')
        is going to appear BEFORE seing the geoRSS data on your map.

        You need to wait for the geoRSS feed to be complete, which is
        accomplished using an YEvent call-back: onEndGeoRSS

        See the reference API.

        Hope this helps,

        Yann


        --- In yws-maps@yahoogroups.com, "iondata_zach" <iondata_zach@...> wrote:
        >
        > I am dynamically creating a GeoRSS feed from my SQL db based on a
        > users input and their location then posting the java back into my
        > page. The map loads fine, my GeoRSS file is public on my site, and
        > part of the java is firing because i coded in a text box to check it
        > out. Here is my code:
        >
        > This is the map that inititially loads, there are a couple text boxes
        > on the screen that the user can input their address in which i
        > geocode and then pull a couple points from my DB. That part all
        > works.
        >
        >
        > <script type="text/javascript" language="JavaScript">
        >
        > function StartYMap() {
        > var map = new YMap(document.getElementById('ymap'));
        > map.addPanControl();
        > map.addZoomShort();
        > map.drawZoomAndCenter("85353",3);
        > function doStart(eventObj) {
        > var defaultEventObject = eventObj;
        > }
        > function doEnd(eventObj) {
        > var defaultEventObject = eventObj;
        > map.smoothMoveByXY(new YCoordPoint(10,50));
        > }
        > }
        > window.onload = StartYMap;
        >
        > </script>
        >
        > After I have my GeoRSS file I call this:
        >
        >
        > void CallJava(string myPath)
        > {
        > StringBuilder sb = new StringBuilder();
        > sb.Append("<script type='text/javascript'
        > language='JavaScript'>\n");
        >
        > sb.Append("function geoRss(){\n");
        > sb.Append("var map = YMap(document.getElementById
        > ('ymap'));\n");
        > sb.Append("map.addOverlay(new YGeoRSS('" + myPath + "'));\n");
        > sb.Append("}\n");
        > sb.Append("alert('stuff happened!');");
        > sb.Append("</script>\n");
        >
        > Which postsback the page and adds this in in a seperate java block:
        >
        > <script type='text/javascript' language='JavaScript'>
        > function geoRss(){
        > var map = new YMap(document.getElementById('ymap'));
        > map.addOverlay(new YGeoRSS
        > ('http://www.iondataexpress.com/geo/geo.xml'));
        > }
        > alert('stuff happened!');</script>
        >
        > ...
        >
        > The alert "stuff happened!" fires. My overlay does not get on the
        > map though... can anyone help me and tell me what I am doing wrong?
        > I don't have a ton of exp with java so I believe i may not understand
        > the order of events that is happening here.
        >
        > Thanks for any help!!!
        >
        > Zach
        >
      • Zachary Bowers
        ah... I actually got this to work... should i post what i did? ... From: yanncorno To: yws-maps@yahoogroups.com Sent: Sunday, May
        Message 3 of 3 , May 5, 2008
        View Source
        • 0 Attachment
          ah... I actually got this to work... should i post what i did?


          ----- Original Message ----
          From: yanncorno <yann+ymap@...>
          To: yws-maps@yahoogroups.com
          Sent: Sunday, May 4, 2008 11:10:02 PM
          Subject: [yws-maps] Re: GeoRSS: add overlay to map with AJAX Api


          Keep in mind that the "map.addOverlay( new YGeoRSS..." is going to be
          executed asynchronously. In other words, your alert('stuff happened!')
          is going to appear BEFORE seing the geoRSS data on your map.

          You need to wait for the geoRSS feed to be complete, which is
          accomplished using an YEvent call-back: onEndGeoRSS

          See the reference API.

          Hope this helps,

          Yann

          --- In yws-maps@yahoogroup s.com, "iondata_zach" <iondata_zach@ ....> wrote:
          >
          > I am dynamically creating a GeoRSS feed from my SQL db based on a
          > users input and their location then posting the java back into my
          > page. The map loads fine, my GeoRSS file is public on my site, and
          > part of the java is firing because i coded in a text box to check it
          > out. Here is my code:
          >
          > This is the map that inititially loads, there are a couple text boxes
          > on the screen that the user can input their address in which i
          > geocode and then pull a couple points from my DB. That part all
          > works.
          >
          >
          > <script type="text/javascri pt" language="JavaScrip t">
          >
          > function StartYMap() {
          > var map = new YMap(document. getElementById( 'ymap'));
          > map.addPanControl( );
          > map.addZoomShort( );
          > map.drawZoomAndCent er("85353" ,3);
          > function doStart(eventObj) {
          > var defaultEventObject = eventObj;
          > }
          > function doEnd(eventObj) {
          > var defaultEventObject = eventObj;
          > map..smoothMoveByXY( new YCoordPoint( 10,50));
          > }
          > }
          > window.onload = StartYMap;
          >
          > </script>
          >
          > After I have my GeoRSS file I call this:
          >
          >
          > void CallJava(string myPath)
          > {
          > StringBuilder sb = new StringBuilder( );
          > sb.Append("< script type='text/javascri pt'
          > language='JavaScrip t'>\n");
          >
          > sb.Append("function geoRss(){\n" );
          > sb.Append("var map = YMap(document. getElementById
          > ('ymap'));\n" );
          > sb.Append("map. addOverlay( new YGeoRSS('" + myPath + "'));\n");
          > sb.Append("} \n");
          > sb.Append("alert( 'stuff happened!'); ");
          > sb.Append("< /script>\ n");
          >
          > Which postsback the page and adds this in in a seperate java block:
          >
          > <script type='text/javascri pt' language='JavaScrip t'>
          > function geoRss(){
          > var map = new YMap(document. getElementById( 'ymap'));
          > map.addOverlay( new YGeoRSS
          > ('http://www.iondatae xpress.com/ geo/geo.xml'));
          > }
          > alert('stuff happened!'); </script>
          >
          > ...
          >
          > The alert "stuff happened!" fires. My overlay does not get on the
          > map though... can anyone help me and tell me what I am doing wrong?
          > I don't have a ton of exp with java so I believe i may not understand
          > the order of events that is happening here.
          >
          > Thanks for any help!!!
          >
          > Zach
          >




          ____________________________________________________________________________________
          Be a better friend, newshound, and
          know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.