none
Bing Map and SharePoint Integration Issue. RRS feed

  • Question

  • I use a Bing Map on a SharePoint site to display pushpins that are populating from a SharePoint list. I have been using this method for more than a year, but I have always run into a similar issue. Whenever a field that is used to display information into the infobox contains an apostrophe or special formating such as a list bullets or line breaks the pushpins for that layer will not display on the map, nor will the pushpins on the layers above that one. I have posted this question before on various sites but I havent had much luck, so I am reposting it with more details to see if anyone can help me out.

    I am using MOSS 2007 and the list I am using is a custom list with text boxes and a multiline rich text box.

    Link to an example site: http://11934.freesharepoint2007.com/default.aspx

    I am not sure whether the cause of this issue is the Bing Map script or related to SharePoint script. Any tips or advice that someone can offer me would be greatly appreciated.

    Below is the script that I use to load the Bing Map onto my SharePoint page.


    //START MAP ONLOAD CODE

    <script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>

        <script type="text/javascript">

          var map = null;
         
                var Layer1;
                var Layer2;
                var Layer3;
                         
          function GetMap()

          {

                map = new VEMap('myMap');
                map.SetDashboardSize(VEDashboardSize.Small);
                map.LoadMap(new VELatLong(38.59285100004955, -99.0000), 4,'r' ,false);
               
                CreateLayer1();
                CreateLayer2();
                CreateLayer3();
            
          AddPins();
      
          }

          function AddPin1(layer1, lat, lon, iconurl, title, desc)
          {

                var shape =

    new VEShape(VEShapeType.Pushpin,
    new VELatLong(lat,lon));
                shape.SetCustomIcon("images/Att.gif");
                shape.SetTitle(title);
                shape.SetDescription(desc);
                layer1.AddShape(shape);
     }
              
          function AddPin2(layer2, lat, lon, iconurl, title, desc)
          {

                var shape =

    new VEShape(VEShapeType.Pushpin,
    new VELatLong(lat,lon));
                shape.SetCustomIcon("images/BUR.gif");
                shape.SetTitle(title);
                shape.SetDescription(desc);
                layer2.AddShape(shape);
          }
          
    function AddPin3(layer3, lat, lon, iconurl, title, desc)
          {

                var shape =

    new VEShape(VEShapeType.Pushpin,
    new VELatLong(lat,lon));
                shape.SetCustomIcon("images/KEY2.gif");
                shape.SetTitle(title);
                shape.SetDescription(desc);
                layer3.AddShape(shape);
          }

                                                            
          function addLoadEvent(func)

          {

                var oldonload = window.onload;

                if (typeof window.onload != 'function')

                { window.onload = func; }

                else

                { window.onload = function()

                      { oldonload(); func(); }

                }

          }

          addLoadEvent(GetMap);
    </script></div>
    <div id='myMap'  style="height=380px"></div>

    //END MAP ONLOAD CODE


    Below is the XSL that I insert into my dataview web part.

    //START DATA VIEW INSERT

     <xsl:call-template name="dvt_1"/>
     </xsl:template>
     

    <xsl:template name="AddMapPins">

        <xsl:param name="Rows"/>

        <xsl:text disable-output-escaping="yes"><![CDATA[

                <script type="text/javascript">

                function CreateLayer3()

                {
                              layer3 = new VEShapeLayer();

                              map.AddShapeLayer(layer3);

                ]]></xsl:text>

        <xsl:for-each select="$Rows">

          <xsl:if test="not(normalize-space(@Lat) = '' and normalize-space(@Lon) = '')">

            AddPin3(layer3, <xsl:value-of select="@Lat" />,

            <xsl:value-of select="@Lon" />,

            null,

      &apos;<xsl:value-of select="@Title" disable-output-escaping="yes"/>&apos;,
        &apos;<xsl:value-of select="@TEXT" disable-output-escaping="yes"/>&apos;);

          </xsl:if>
        </xsl:for-each>
        <xsl:text disable-output-escaping="yes"><![CDATA[
                }
                </script>
                ]]></xsl:text>
    </xsl:template>

    <xsl:template name="dvt_1">
      <xsl:variable name="dvt_StyleName">Table</xsl:variable>
      <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
      
      <xsl:call-template name="AddMapPins">
      <xsl:with-param name="Rows" select="$Rows"/>
    </xsl:call-template>

    //END DATA VIEW INSERT

    Thanks,

    Aaron

    • Edited by Aaron - Outlawtorn.com Thursday, October 15, 2009 8:39 PM remove hyperlink
    • Moved by Ricky_Brundritt Saturday, March 10, 2012 10:24 AM (From:Bing Maps: Map Control and Web services Development)
    Thursday, October 15, 2009 8:38 PM

Answers

  • Can you try and escape those characters? Would it be possible to provide sample data?

    Windows Live Developer MVP - http://rbrundritt.spaces.live.com
    Saturday, November 28, 2009 11:22 PM

All replies

  • Can you try and escape those characters? Would it be possible to provide sample data?

    Windows Live Developer MVP - http://rbrundritt.spaces.live.com
    Saturday, November 28, 2009 11:22 PM
  • The text comes from the "@TEXT" found below.  I have tried it with and without applying (disable-output-escaping="yes"), but neither seems to work.

    <xsl:if test="not(normalize-space(@Lat) = '' and normalize-space(@Lon) = '')">

            AddPin3(layer3, <xsl:value-of select="@Lat" />,

            <xsl:value-of select="@Lon" />,

            null,

      &apos;<xsl:value-of select="@Title" disable-output-escaping="yes"/>&apos;,
       &apos;<xsl:value-of select="@TEXT" disable-output-escaping="yes"/>&apos;);

          </xsl:if>

    Wednesday, June 9, 2010 10:55 PM
  • Have you tried: <xsl:value-of select="@TEXT"/>
    Windows Live Developer MVP - http://rbrundritt.spaces.live.com
    Wednesday, June 9, 2010 11:48 PM
  • Hi Aaron,

    Did you get this resolved? I am trying to leverage your code and trying out the integration myself. I get unexpected onject errors on CreateLayerx() and AddPins().

    Thanks,

    Tuesday, May 31, 2011 2:14 PM
  • I resolved this issue. I inverted the use of quotes and apostrophes. 

     

    Before:

     &apos;<xsl:value-of select="@Title" disable-output-escaping="yes"/>&apos;,

     &apos;<xsl:value-of select="@TEXT" disable-output-escaping="yes"/>&apos;);

     

    After:

     &quot;<xsl:value-of select='@Title' disable-output-escaping='yes'/>&quot;,

     &quot;<xsl:value-of select='@TEXT' disable-output-escaping='yes'/>&quot;);

     

    I only had to make this change for the section about that gets displayed in the infobox. 

    Sunday, August 7, 2011 9:02 PM