none
Error while using Point Based Clustering in V8 RRS feed

  • Question

  • Hi,

    We have an application using Bing Maps v7 api and we are in the process of migrating that to v8. In the current application "Point based clustering" module is being used. So, i got the compatible version for v8 and tried testing it. But, i am getting some undefined error from the script loaded using the following url. 

    "https://www.bing.com/rms/MapCoreBundle/cj,nj/ac38c0ee/6fa841c8.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCache*Gimme*GimmeWrapper*evPromise*ExternalPromise*StaticPromise*CookiesHelper*LruCache*Point*Rectangle*NAARectangle*ResourceManager*Anchor*Size*Binding*EventBinding*Observable*ObservableObject*ObservableObjectChangedArgs*ObservableCollection*Debug*DelayLoadedObject*JSEvent*Dispatcher*WorkDispatcher*Iterator*ElementSizeHelper*GimmeExt*GimmeTransition*Helper*PerfState*ClientPerf*LoggingWrapper*LoggerConstants*Network*ThrottledEventInvoker*ObjectPool*StaticObjectPool*FixedSizeObjectPool*OrderedDictionary*PooledImage*Url*MapCoreMiddle*NavigationBarMode*NavigationBarOrientation*TransformCurve*CurveKey*Curve*Color*CurveVector4*CurveColor*Vector4*DiscreteRange*DiscreteRangeCollectionSpline*MapLayer*CopyrightProvider*CopyrightProviderService*CustomMapStyleManager*MapFrameManager*LayerFrameManager*GoalCounter*FrameEventAggregator*DataMonitor*MapFrameData*LayerFrameData*Clipper*CompositePrimitiveSet*DataLoader*Differ*FixedPrimitiveSet*PrimitiveSubset*Overlay*ImageryMapLayer*SimpleSceneContributor*VectorMapLayer*BasicMapAnimation*MapViewAnimator*BoundsAccumulator*CombinedLayerCollection*ConstrainViewArgs*LatLonCrs*LocationRect*Matrix2D*MapInstrumentationManager*PerfV2Logger*Map*MapHelper*MapMath*MapLocation*MapType*MapTypeChangeArgs*MapTypeCollection*MapTypeId*MapView*MapQuadrant*PrimitiveOverlayHelper*OverlayBehavior*GeometryGeneralizer*SimplePointPrimitive*SimpleLinePrimitive*SimpleAreaPrimitive*MoveableSimplePointPrimitive*TargetViewChangeArgs*VectorMath*ViewChangeArgs*ZoomLevel*ZoomAroundLocationAnimator*ZoomEventArgs*OverviewMapMode*MapAuthentication*PublicApi*InternalApi*AnonymousEnd"

    

    The code that's used to setup the map is as follows. 

    MapModuleOptions mapOptions = new MapModuleOptions();
                mapOptions.Callback = delegate()
                {
                    MapOptions options = new MapOptions();
                    options.Credentials = _config.BingKey;
                    options.EnableClickableLogo = false;
                    options.ShowDashboard = true;
                    options.ShowBreadcrumb = false;
                
                    Script.Literal("{0}.customizeOverlays= true", options);
    
    
    
    
                    _map = new Map(Document.GetElementById(MapDivId), options);
    
                    
    
                    Map.RegisterModule("PointBasedClusteringModule", "../js/PointBasedClustering.js");
    
                    MapModuleOptions clusteringOptions = new MapModuleOptions();
                    clusteringOptions.Callback = delegate()
                    {   
                        int clusterRadius;
                        if (_config.EnableClustering)
                            clusterRadius = _config.ClusterRadius;
                        else
                            clusterRadius = -1;
    
                        
                        PointBasedClusteringOptions pointBasedClusteringOptions = new PointBasedClusteringOptions();
                        pointBasedClusteringOptions.Callback = OnRender;
                        pointBasedClusteringOptions.SinglePinCallback = CreatePinCallBack;
                        pointBasedClusteringOptions.ClusteredPinCallback = CreateClustedPin;
                        pointBasedClusteringOptions.ClusterRadius = clusterRadius;
                        _clusterLayer = new PointBasedClusteredEntityCollection(_map, pointBasedClusteringOptions);
                        IsLoaded = true;
    
                        
                        SetupCallBack();
                    };
                                    Map.LoadModule("PointBasedClusteringModule", clusteringOptions);
    
                    MapEvents.AddHandler(_map, "click", delegate(MapEventArgs e)
                    {
                        // This fixes an issue in IE where the pins appear behind the polygon search when the map is clicked
                        _clusterLayer.BringLayerToFront();
                    });
                };
                Map.LoadModule("Microsoft.Maps.Search", mapOptions);

    Can anyone point me in the direction of how to fix this.

    Thanks in advance!!

    Tuesday, May 30, 2017 4:40 PM

Answers

All replies

  • Can you walk through each line your code and find where the error occurs. Is it when the LoadModule function is called? Are you using .NET and some wrapper library as all the names doesn't have the correct JavaScript casing.

    [Blog] [twitter] [LinkedIn]

    Tuesday, May 30, 2017 7:30 PM
  • Hi Ricky,

    Yeah, i am using the scriptsharp wrapper for this. I have implemented the required items that were missing in the wrapper and using it in the project. 

    https://github.com/larrywelch/ScriptSharpBingMapsV8Import

    The code goes through fine adding the pin to the layer.


    "TypeError: Unable to get property 'id' of undefined or null reference\n   at n._clipExact (https://www.bing.com/rms/MapCoreBundle/cj,nj/ac38c0ee/6fa841c8.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCache*Gimme*GimmeWrapper*evPromise*ExternalPromise*StaticPromise*CookiesHelper*LruCache*Point*Rectangle*NAARectangle*ResourceManager*Anchor*Size*Binding*EventBinding*Observable*ObservableObject*ObservableObjectChangedArgs*ObservableCollection*Debug*DelayLoadedObject*JSEvent*Dispatcher*WorkDispatcher*Iterator*ElementSizeHelper*GimmeExt*GimmeTransition*Helper*PerfState*ClientPerf*LoggingWrapper*LoggerConstants*Network*ThrottledEventInvoker*ObjectPool*StaticObjectPool*FixedSizeObjectPool*OrderedDictionary*PooledImage*Url*MapCoreMiddle*NavigationBarMode*NavigationBarOrientation*TransformCurve*CurveKey*Curve*Color*CurveVector4*CurveColor*Vector4*DiscreteRange*DiscreteRangeCollectionSpline*MapLayer*CopyrightProvider*CopyrightProviderService*CustomMapStyleManager*MapFrameManager*LayerFrameManager*GoalCounter*FrameEventAggregator*DataMonitor*MapFrameData*LayerFrameData*Clipper*CompositePrimitiveSet*DataLoader*Differ*FixedPrimitiveSet*PrimitiveSubset*Overlay*ImageryMapLayer*SimpleSceneContributor*VectorMapLayer*BasicMapAnimation*MapViewAnimator*BoundsAccumulator*CombinedLayerCollection*ConstrainViewArgs*LatLonCrs*LocationRect*Matrix2D*MapInstrumentationManager*PerfV2Logger*Map*MapHelper*MapMath*MapLocation*MapType*MapTypeChangeArgs*MapTypeCollection*MapTypeId*MapView*MapQuadrant*PrimitiveOverlayHelper*OverlayBehavior*GeometryGeneralizer*SimplePointPrimitive*SimpleLinePrimitive*SimpleAreaPrimitive*MoveableSimplePointPrimitive*TargetViewChangeArgs*VectorMath*ViewChangeArgs*ZoomLevel*ZoomAroundLocationAnimator*ZoomEventArgs*OverviewMapMode*MapAuthentication*PublicApi*InternalApi*AnonymousEnd:1:159962)\n   at n.clip (https://www.bing.com/rms/MapCoreBundle/cj,nj/ac38c0ee/6fa841c8.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCache*Gimme*GimmeWrapper*evPromise*ExternalPromise*StaticPromise*CookiesHelper*LruCache*Point*Rectangle*NAARectangle*ResourceManager*Anchor*Size*Binding*EventBinding*Observable*ObservableObject*ObservableObjectChangedArgs*ObservableCollection*Debug*DelayLoadedObject*JSEvent*Dispatcher*WorkDispatcher*Iterator*ElementSizeHelper*GimmeExt*GimmeTransition*Helper*PerfState*ClientPerf*LoggingWrapper*LoggerConstants*Network*ThrottledEventInvoker*ObjectPool*StaticObjectPool*FixedSizeObjectPool*OrderedDictionary*PooledImage*Url*MapCoreMiddle*NavigationBarMode*NavigationBarOrientation*TransformCurve*CurveKey*Curve*Color*CurveVector4*CurveColor*Vector4*DiscreteRange*DiscreteRangeCollectionSpline*MapLayer*CopyrightProvider*CopyrightProviderService*CustomMapStyleManager*MapFrameManager*LayerFrameManager*GoalCounter*FrameEventAggregator*DataMonitor*MapFrameData*LayerFrameData*Clipper*CompositePrimitiveSet*DataLoader*Differ*FixedPrimitiveSet*PrimitiveSubset*Overlay*ImageryMapLayer*SimpleSceneContributor*VectorMapLayer*BasicMapAnimation*MapViewAnimator*BoundsAccumulator*CombinedLayerCollection*ConstrainViewArgs*LatLonCrs*LocationRect*Matrix2D*MapInstrumentationManager*PerfV2Logger*Map*MapHelper*MapMath*MapLocation*MapType*MapTypeChangeArgs*MapTypeCollection*MapTypeId*MapView*MapQuadrant*PrimitiveOverlayHelper*OverlayBehavior*GeometryGeneralizer*SimplePointPrimitive*SimpleLinePrimitive*SimpleAreaPrimitive*MoveableSimplePointPrimitive*TargetViewChangeArgs*VectorMath*ViewChangeArgs*ZoomLevel*ZoomAroundLocationAnimator*ZoomEventArgs*OverviewMapMode*MapAuthentication*PublicApi*InternalApi*AnonymousEnd:1:159606)\n   at n.prototype.getPrimitives (https://www.bing.com/rms/MapCoreBundle/cj,nj/ac38c0ee/6fa841c8.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCache*Gimme*GimmeWrapper*evPromise*ExternalPromise*StaticPromise*CookiesHelper*LruCache*Point*Rectangle*NAARectangle*ResourceManager*Anchor*Size*Binding*EventBinding*Observable*ObservableObject*ObservableObjectChangedArgs*ObservableCollection*Debug*DelayLoadedObject*JSEvent*Dispatcher*WorkDispatcher*Iterator*ElementSizeHelper*GimmeExt*GimmeTransition*Helper*PerfState*ClientPerf*LoggingWrapper*LoggerConstants*Network*ThrottledEventInvoker*ObjectPool*StaticObjectPool*FixedSizeObjectPool*OrderedDictionary*PooledImage*Url*MapCoreMiddle*NavigationBarMode*NavigationBarOrientation*TransformCurve*CurveKey*Curve*Color*CurveVector4*CurveColor*Vector4*DiscreteRange*DiscreteRangeCollectionSpline*MapLayer*CopyrightProvider*CopyrightProviderService*CustomMapStyleManager*MapFrameManager*LayerFrameManager*GoalCounter*FrameEventAggregator*DataMonitor*MapFrameData*LayerFrameData*Clipper*CompositePrimitiveSet*DataLoader*Differ*FixedPrimitiveSet*PrimitiveSubset*Overlay*ImageryMapLayer*SimpleSceneContributor*VectorMapLayer*BasicMapAnimation*MapViewAnimator*BoundsAccumulator*CombinedLayerCollection*ConstrainViewArgs*LatLonCrs*LocationRect*Matrix2D*MapInstrumentationManager*PerfV2Logger*Map*MapHelper*MapMath*MapLocation*MapType*MapTypeChangeArgs*MapTypeCollection*MapTypeId*MapView*MapQuadrant*PrimitiveOverlayHelper*OverlayBehavior*GeometryGeneralizer*SimplePointPrimitive*SimpleLinePrimitive*SimpleAreaPrimitive*MoveableSimplePointPrimitive*TargetViewChangeArgs*VectorMath*ViewChangeArgs*ZoomLevel*ZoomAroundLocationAnimator*ZoomEventArgs*OverviewMapMode*MapAuthentication*PublicApi*InternalApi*AnonymousEnd:1:159025)\n   at n.prototype.getPrimitives (https://www.bing.com/rms/MapCoreBundle/cj,nj/ac38c0ee/6fa841c8.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCache*Gimme*GimmeWrapper*evPromise*ExternalPromise*StaticPromise*CookiesHelper*LruCache*Point*Rectangle*NAARectangle*ResourceManager*Anchor*Size*Binding*EventBinding*Observable*ObservableObject*ObservableObjectChangedArgs*ObservableCollection*Debug*DelayLoadedObject*JSEvent*Dispatcher*WorkDispatcher*Iterator*ElementSizeHelper*GimmeExt*GimmeTransition*Helper*PerfState*ClientPerf*LoggingWrapper*LoggerConstants*Network*ThrottledEventInvoker*ObjectPool*StaticObjectPool*FixedSizeObjectPool*OrderedDictionary*PooledImage*Url*MapCoreMiddle*NavigationBarMode*NavigationBarOrientation*TransformCurve*CurveKey*Curve*Color*CurveVector4*CurveColor*Vector4*DiscreteRange*DiscreteRangeCollectionSpline*MapLayer*CopyrightProvider*CopyrightProviderService*CustomMapStyleManager*MapFrameManager*LayerFrameManager*GoalCounter*FrameEventAggregator*DataMonitor*MapFrameData*LayerFrameData*Clipper*CompositePrimitiveSet*DataLoader*Differ*FixedPrimitiveSet*PrimitiveSubset*Overlay*ImageryMapLayer*SimpleSceneContributor*VectorMapLayer*BasicMapAnimation*MapViewAnimator*BoundsAccumulator*CombinedLayerCollection*ConstrainViewArgs*LatLonCrs*LocationRect*Matrix2D*MapInstrumentationManager*PerfV2Logger*Map*MapHelper*MapMath*MapLocation*MapType*MapTypeChangeArgs*MapTypeCollection*MapTypeId*MapView*MapQuadrant*PrimitiveOverlayHelper*OverlayBehavior*GeometryGeneralizer*SimplePointPrimitive*SimpleLinePrimitive*SimpleAreaPrimitive*MoveableSimplePointPrimitive*TargetViewChangeArgs*VectorMath*ViewChangeArgs*ZoomLevel*ZoomAroundLocationAnimator*ZoomEventArgs*OverviewMapMode*MapAuthentication*PublicApi*InternalApi*AnonymousEnd:1:158595)\n   at i.prototype._showLabelsForFrame (https://www.bing.com/rms/LabelsBundle/cj,nj/28c97678/b5c332dc.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*IconLabel*RelativePlacement*PointLabel*LineLabel*AreaLabel*ShieldLabel*CollisionIndex*CollisionManager*LabelerWorker*Labeler*LabelController*LabelCollider*LabelRenderer*CanvasLabelRenderer*VectorLabels*LabelsPluginEnd*AnonymousEnd:1:39409)\n   at Anonymous function (https://www.bing.com/rms/LabelsBundle/cj,nj/28c97678/b5c332dc.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*IconLabel*RelativePlacement*PointLabel*LineLabel*AreaLabel*ShieldLabel*CollisionIndex*CollisionManager*LabelerWorker*Labeler*LabelController*LabelCollider*LabelRenderer*CanvasLabelRenderer*VectorLabels*LabelsPluginEnd*AnonymousEnd:1:38296)\n   at n.prototype.invoke (https://www.bing.com/rms/MapCoreBundle/cj,nj/ac38c0ee/6fa841c8.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCache*Gimme*GimmeWrapper*evPromise*ExternalPromise*StaticPromise*CookiesHelper*LruCache*Point*Rectangle*NAARectangle*ResourceManager*Anchor*Size*Binding*EventBinding*Observable*ObservableObject*ObservableObjectChangedArgs*ObservableCollection*Debug*DelayLoadedObject*JSEvent*Dispatcher*WorkDispatcher*Iterator*ElementSizeHelper*GimmeExt*GimmeTransition*Helper*PerfState*ClientPerf*LoggingWrapper*LoggerConstants*Network*ThrottledEventInvoker*ObjectPool*StaticObjectPool*FixedSizeObjectPool*OrderedDictionary*PooledImage*Url*MapCoreMiddle*NavigationBarMode*NavigationBarOrientation*TransformCurve*CurveKey*Curve*Color*CurveVector4*CurveColor*Vector4*DiscreteRange*DiscreteRangeCollectionSpline*MapLayer*CopyrightProvider*CopyrightProviderService*CustomMapStyleManager*MapFrameManager*LayerFrameManager*GoalCounter*FrameEventAggregator*DataMonitor*MapFrameData*LayerFrameData*Clipper*CompositePrimitiveSet*DataLoader*Differ*FixedPrimitiveSet*PrimitiveSubset*Overlay*ImageryMapLayer*SimpleSceneContributor*VectorMapLayer*BasicMapAnimation*MapViewAnimator*BoundsAccumulator*CombinedLayerCollection*ConstrainViewArgs*LatLonCrs*LocationRect*Matrix2D*MapInstrumentationManager*PerfV2Logger*Map*MapHelper*MapMath*MapLocation*MapType*MapTypeChangeArgs*MapTypeCollection*MapTypeId*MapView*MapQuadrant*PrimitiveOverlayHelper*OverlayBehavior*GeometryGeneralizer*SimplePointPrimitive*SimpleLinePrimitive*SimpleAreaPrimitive*MoveableSimplePointPrimitive*TargetViewChangeArgs*VectorMath*ViewChangeArgs*ZoomLevel*ZoomAroundLocationAnimator*ZoomEventArgs*OverviewMapMode*MapAuthentication*PublicApi*InternalApi*AnonymousEnd:1:86941)\n   at n.prototype._onLayerPrimitivesRendered (https://www.bing.com/rms/MapCoreBundle/cj,nj/ac38c0ee/6fa841c8.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCache*Gimme*GimmeWrapper*evPromise*ExternalPromise*StaticPromise*CookiesHelper*LruCache*Point*Rectangle*NAARectangle*ResourceManager*Anchor*Size*Binding*EventBinding*Observable*ObservableObject*ObservableObjectChangedArgs*ObservableCollection*Debug*DelayLoadedObject*JSEvent*Dispatcher*WorkDispatcher*Iterator*ElementSizeHelper*GimmeExt*GimmeTransition*Helper*PerfState*ClientPerf*LoggingWrapper*LoggerConstants*Network*ThrottledEventInvoker*ObjectPool*StaticObjectPool*FixedSizeObjectPool*OrderedDictionary*PooledImage*Url*MapCoreMiddle*NavigationBarMode*NavigationBarOrientation*TransformCurve*CurveKey*Curve*Color*CurveVector4*CurveColor*Vector4*DiscreteRange*DiscreteRangeCollectionSpline*MapLayer*CopyrightProvider*CopyrightProviderService*CustomMapStyleManager*MapFrameManager*LayerFrameManager*GoalCounter*FrameEventAggregator*DataMonitor*MapFrameData*LayerFrameData*Clipper*CompositePrimitiveSet*DataLoader*Differ*FixedPrimitiveSet*PrimitiveSubset*Overlay*ImageryMapLayer*SimpleSceneContributor*VectorMapLayer*BasicMapAnimation*MapViewAnimator*BoundsAccumulator*CombinedLayerCollection*ConstrainViewArgs*LatLonCrs*LocationRect*Matrix2D*MapInstrumentationManager*PerfV2Logger*Map*MapHelper*MapMath*MapLocation*MapType*MapTypeChangeArgs*MapTypeCollection*MapTypeId*MapView*MapQuadrant*PrimitiveOverlayHelper*OverlayBehavior*GeometryGeneralizer*SimplePointPrimitive*SimpleLinePrimitive*SimpleAreaPrimitive*MoveableSimplePointPrimitive*TargetViewChangeArgs*VectorMath*ViewChangeArgs*ZoomLevel*ZoomAroundLocationAnimator*ZoomEventArgs*OverviewMapMode*MapAuthentication*PublicApi*InternalApi*AnonymousEnd:1:147972)\n   at Anonymous function (https://www.bing.com/rms/MapCoreBundle/cj,nj/ac38c0ee/6fa841c8.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCache*Gimme*GimmeWrapper*evPromise*ExternalPromise*StaticPromise*CookiesHelper*LruCache*Point*Rectangle*NAARectangle*ResourceManager*Anchor*Size*Binding*EventBinding*Observable*ObservableObject*ObservableObjectChangedArgs*ObservableCollection*Debug*DelayLoadedObject*JSEvent*Dispatcher*WorkDispatcher*Iterator*ElementSizeHelper*GimmeExt*GimmeTransition*Helper*PerfState*ClientPerf*LoggingWrapper*LoggerConstants*Network*ThrottledEventInvoker*ObjectPool*StaticObjectPool*FixedSizeObjectPool*OrderedDictionary*PooledImage*Url*MapCoreMiddle*NavigationBarMode*NavigationBarOrientation*TransformCurve*CurveKey*Curve*Color*CurveVector4*CurveColor*Vector4*DiscreteRange*DiscreteRangeCollectionSpline*MapLayer*CopyrightProvider*CopyrightProviderService*CustomMapStyleManager*MapFrameManager*LayerFrameManager*GoalCounter*FrameEventAggregator*DataMonitor*MapFrameData*LayerFrameData*Clipper*CompositePrimitiveSet*DataLoader*Differ*FixedPrimitiveSet*PrimitiveSubset*Overlay*ImageryMapLayer*SimpleSceneContributor*VectorMapLayer*BasicMapAnimation*MapViewAnimator*BoundsAccumulator*CombinedLayerCollection*ConstrainViewArgs*LatLonCrs*LocationRect*Matrix2D*MapInstrumentationManager*PerfV2Logger*Map*MapHelper*MapMath*MapLocation*MapType*MapTypeChangeArgs*MapTypeCollection*MapTypeId*MapView*MapQuadrant*PrimitiveOverlayHelper*OverlayBehavior*GeometryGeneralizer*SimplePointPrimitive*SimpleLinePrimitive*SimpleAreaPrimitive*MoveableSimplePointPrimitive*TargetViewChangeArgs*VectorMath*ViewChangeArgs*ZoomLevel*ZoomAroundLocationAnimator*ZoomEventArgs*OverviewMapMode*MapAuthentication*PublicApi*InternalApi*AnonymousEnd:1:144567)\n   at n.prototype.invoke (https://www.bing.com/rms/MapCoreBundle/cj,nj/ac38c0ee/6fa841c8.js?bu=rms+answers+MapsSDKRelease+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCache*Gimme*GimmeWrapper*evPromise*ExternalPromise*StaticPromise*CookiesHelper*LruCache*Point*Rectangle*NAARectangle*ResourceManager*Anchor*Size*Binding*EventBinding*Observable*ObservableObject*ObservableObjectChangedArgs*ObservableCollection*Debug*DelayLoadedObject*JSEvent*Dispatcher*WorkDispatcher*Iterator*ElementSizeHelper*GimmeExt*GimmeTransition*Helper*PerfState*ClientPerf*LoggingWrapper*LoggerConstants*Network*ThrottledEventInvoker*ObjectPool*StaticObjectPool*FixedSizeObjectPool*OrderedDictionary*PooledImage*Url*MapCoreMiddle*NavigationBarMode*NavigationBarOrientation*TransformCurve*CurveKey*Curve*Color*CurveVector4*CurveColor*Vector4*DiscreteRange*DiscreteRangeCollectionSpline*MapLayer*CopyrightProvider*CopyrightProviderService*CustomMapStyleManager*MapFrameManager*LayerFrameManager*GoalCounter*FrameEventAggregator*DataMonitor*MapFrameData*LayerFrameData*Clipper*CompositePrimitiveSet*DataLoader*Differ*FixedPrimitiveSet*PrimitiveSubset*Overlay*ImageryMapLayer*SimpleSceneContributor*VectorMapLayer*BasicMapAnimation*MapViewAnimator*BoundsAccumulator*CombinedLayerCollection*ConstrainViewArgs*LatLonCrs*LocationRect*Matrix2D*MapInstrumentationManager*PerfV2Logger*Map*MapHelper*MapMath*MapLocation*MapType*MapTypeChangeArgs*MapTypeCollection*MapTypeId*MapView*MapQuadrant*PrimitiveOverlayHelper*OverlayBehavior*GeometryGeneralizer*SimplePointPrimitive*SimpleLinePrimitive*SimpleAreaPrimitive*MoveableSimplePointPrimitive*TargetViewChangeArgs*VectorMath*ViewChangeArgs*ZoomLevel*ZoomAroundLocationAnimator*ZoomEventArgs*OverviewMapMode*MapAuthentication*PublicApi*InternalApi*AnonymousEnd:1:86941)"

    After this the built-in scripts are loaded and the error is occuring at the highlighted code below. The f.getPrimitives is throwing error  "Unable to get property 'id' of undefined or null reference". 

    i.prototype._showLabelsForFrame = function (t) {
                var r = this, u, l = this._map.getFrameManager(), f = this._getMapFrameData(), e = this._isDiffingDisabled(), o, s, h, c;
                this._haveLabeledFirstFrame = !0;
                o = !e && f && this._previousFrameData;
                this._labelingDiagnostics = { frameNumber: t.frameNumber };
                s = n._getCurrentTimeStamp();
                this._labelingDiagnostics.totalLabelingTime = s;
                this._labelingDiagnostics.diffingTime = s;
                f && (o ? u = l.diffFrames(o, f, 1) : (u = { addedPrimitives: f.getPrimitives(1), removedPrimitives: [], changedPrimitives: [] }, e = !0));
                this._labelingDiagnostics.diffingTime = n._getCurrentTimeStamp() - this._labelingDiagnostics.diffingTime;
                u && (h = this._map.getMapOptions().liteMode || i._isNullDataRegionFrame(f), this._labelingDiagnostics.primitiveCount = u.addedPrimitives.length, this._labelingDiagnostics.timeToAddStyles = n._getCurrentTimeStamp(), a.awaitIconSelectors ? (c = this._getIconTemplateSelectors(u.addedPrimitives), this._previousFrameData = f, Promise.all(c).then(function () {
                    r._previousFrameData === f && r._labeler && (r.addStyle(u.addedPrimitives), r.addStyle(u.removedPrimitives), r.addStyle(u.changedPrimitives), r._labelingDiagnostics.timeToAddStyles = n._getCurrentTimeStamp() - r._labelingDiagnostics.timeToAddStyles, r._labelingDiagnostics.labelDataProcessingTime = n._getCurrentTimeStamp(), r._labeler.processData(t, u, r._viewport, r._map.getMercatorZoomLevel(), e, h), r._labelingDiagnostics.labelDataProcessingTime = n._getCurrentTimeStamp() - r._labelingDiagnostics.labelDataProcessingTime);
                })) : (this.addStyle(u.addedPrimitives), this.addStyle(u.removedPrimitives), this.addStyle(u.changedPrimitives), this._labelingDiagnostics.timeToAddStyles = n._getCurrentTimeStamp() - this._labelingDiagnostics.timeToAddStyles, this._labelingDiagnostics.labelDataProcessingTime = n._getCurrentTimeStamp(), this._labeler.processData(t, u, this._viewport, this._map.getMercatorZoomLevel(), e, h), this._labelingDiagnostics.labelDataProcessingTime = n._getCurrentTimeStamp() - this._labelingDiagnostics.labelDataProcessingTime, this._previousFrameData = f));
            }	function (t) { var r = this, u, l = this._map.getFrameManager(), f = this._getMapFrameData(), e = this._isDiffingDisabled(), o, s, h, c; this._haveLabeledFirstFrame = !0; o = !e && f && this._previousFrameData;



    Tuesday, May 30, 2017 11:15 PM
  • Can you provide the generated code in your application and/or the line of code in your app where the error occurs (not the internal code error). This will greatly help in trying to reproduce the issue.

    [Blog] [twitter] [LinkedIn]

    Wednesday, May 31, 2017 12:44 AM
  • Hi Ricky,

    Thanks. The code goes through fine in my code and it throws error only in the internal location that i mentioned earlier.

    supporting files are @ https://1drv.ms/f/s!AqUvwiXzOfIOgQnAIvrj5OirPfns

    HTML          

    <!DOCTYPE html>

    <html lang="en">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Property Map</title>  

    </head>
    <body>

        <div class="MicrosoftMap BingTheme MapTypeId_m medium" id="mapDiv" style="float: left; width: 500px; height: 500px;">

        </div>

        <!-- Sparkle Xrm -->
        <script src="SparkleXrmUI_Dependancies.js"></script>
        <script src="mscorlib.js" type="text/javascript"></script>
        <script src="SparkleXrm.js" type="text/javascript"></script>
        <script src="SparkleXrmUI.js" type="text/javascript"></script>

        <!-- Client Code -->
        <script src="ClientUI.js"></script>
        <script type="text/javascript">

            ClientUI.BingSearch.Views.BingMapView.init();
        </script>
    </body>
    </html>

    Script

    //! ClientUI.debug.js
    //

    (function ($) {

        Type.registerNamespace('ClientUI.Libaries.BingMaps');

       
        ClientUI.Libaries.BingMaps.BingMapsGeocodeService = function ClientUI_Libaries_BingMaps_BingMapsGeocodeService(map) {
            this._map = map;
        }
        ClientUI.Libaries.BingMaps.BingMapsGeocodeService.prototype = {
            _searchManager: null,
            _map: null,
            _completedCount: 0,
            _totalCount: 0,
            _completedCallBack: null,
            _allPins: null,

            setCallBack: function ClientUI_Libaries_BingMaps_BingMapsGeocodeService$setCallBack(completedCallBack) {
                this._completedCallBack = completedCallBack;
            },

            setTotal: function ClientUI_Libaries_BingMaps_BingMapsGeocodeService$setTotal(total) {
                this._totalCount = total;
                this._completedCount = 0;
                this._allPins = [];
            },

            _createSearchManager: function ClientUI_Libaries_BingMaps_BingMapsGeocodeService$_createSearchManager() {
                if (this._searchManager == null) {
                    this._map.addComponent('searchManager', new Microsoft.Maps.Search.SearchManager(this._map));
                    this._searchManager = this._map.getComponent('searchManager');
                }
            },

            geocodeRequest: function ClientUI_Libaries_BingMaps_BingMapsGeocodeService$geocodeRequest(search, pin) {
                ClientUI.Libaries.Services.TraceService.trace('Geocoding {0}', [search]);
                if (ss.isValue(pin.longitude) && ss.isValue(pin.latitude)) {
                    this.onGeocodeSuccess(null, pin);
                }
                else {
                    this._createSearchManager();
                    var request = {};
                    request.where = search;
                    request.count = 1;
                    request.bounds = this._map.getBounds();
                    request.callback = ss.Delegate.create(this, this.onGeocodeSuccess);
                    request.errorCallback = ss.Delegate.create(this, this.onGeocodeFail);
                    request.userData = pin;
                    this._searchManager.geocode(request);
                }
            },

            onGeocodeSuccess: function ClientUI_Libaries_BingMaps_BingMapsGeocodeService$onGeocodeSuccess(result, userdata) {
                var pinData = userdata;
                if (result != null) {
                    var topResult = (result.results != null && result.results.length > 0) ? result.results[0] : null;
                    if (topResult != null) {
                        pinData.latitude = topResult.location.latitude;
                        pinData.longitude = topResult.location.longitude;
                        pinData.name = topResult.name;
                    }
                }
                this._allPins.add(pinData);
                this._completedCount += 1;
                if (result != null) {
                    if (result.parsedAddress != null) {
                        ClientUI.Libaries.Services.TraceService.trace('Geocode Success {0} {1}', [result.parsedAddress.addressLine, result.parsedAddress.adminDistrict]);
                    }
                    var $enum1 = ss.IEnumerator.getEnumerator(result.results);
                    while ($enum1.moveNext()) {
                        var item = $enum1.current;
                        ClientUI.Libaries.Services.TraceService.trace('-PlaceResult Code:{0} Confidence:{1} name:{2} count:{3} {4} {5}', [item.matchCode, item.matchConfidence, item.name, item.locations.length, item.location.longitude, item.location.latitude]);
                    }
                }
                this._geocodeComplete();
            },

            onGeocodeFail: function ClientUI_Libaries_BingMaps_BingMapsGeocodeService$onGeocodeFail(result, userdata) {
                this._completedCount += 1;
                ClientUI.Libaries.Services.TraceService.trace('Geocode fail {0} {1} {2}', [(result.parsedAddress != null) ? result.parsedAddress.addressLine : '']);
                this._geocodeComplete();
            },

            _geocodeComplete: function ClientUI_Libaries_BingMaps_BingMapsGeocodeService$_geocodeComplete() {
                if (this._completedCount === this._totalCount) {
                    this._completedCallBack(this._allPins);
                }
            }
        }


       
        ClientUI.Libaries.BingMaps.BingMapsProvider = function ClientUI_Libaries_BingMaps_BingMapsProvider() {
        }
        ClientUI.Libaries.BingMaps.BingMapsProvider.prototype = {
            mapDivId: null,
            isLoaded: false,
            _config: null,
            _pins: null,
            _clusterLayer: null,
            _mapLayers: null,
            _map: null,
            _geocodeService: null,
            _infobox: null,

            add_onPolygonSelect: function ClientUI_Libaries_BingMaps_BingMapsProvider$add_onPolygonSelect(value) {
                this.__onPolygonSelect = ss.Delegate.combine(this.__onPolygonSelect, value);
            },
            remove_onPolygonSelect: function ClientUI_Libaries_BingMaps_BingMapsProvider$remove_onPolygonSelect(value) {
                this.__onPolygonSelect = ss.Delegate.remove(this.__onPolygonSelect, value);
            },

            __onPolygonSelect: null,
            pendingCentreView: false,
            polygonLocations: null,
            _pushPins: null,
            drawingManager: null,
            allowDrawPolygon: false,

            init: function ClientUI_Libaries_BingMaps_BingMapsProvider$init(mapDivId, initCallBackFunctionName, enableClustering, lcid) {
                var lang = 'en-GB';
                switch (lcid) {
                    case 1049:
                        lang = 'ru-RU';
                        break;
                }
                this.mapDivId = mapDivId;
                this._config = new ClientUI.Libaries.BingMaps.MapConfig();
                this._config.enableClustering = enableClustering;
                this._config.SSL = false;
                var protocol = (this._config.SSL) ? 'https://' : 'http://';
                var bingMapScriptUrl = protocol + 'www.bing.com/api/maps/mapcontrol?callback=' + initCallBackFunctionName;
                var bingMapScript = document.createElement('script');
                bingMapScript.setAttribute('type', 'text/javascript');
                bingMapScript.setAttribute('src', bingMapScriptUrl);
                bingMapScript.setAttribute('async', 'true');
                bingMapScript.setAttribute('defer', 'true');
                bingMapScript.setAttribute('branch', 'experimental');
                document.body.appendChild(bingMapScript);
            },

            getGeocodeService: function ClientUI_Libaries_BingMaps_BingMapsProvider$getGeocodeService() {
                if (this._geocodeService == null) {
                    this._geocodeService = new ClientUI.Libaries.BingMaps.BingMapsGeocodeService(this._map);
                }
                return this._geocodeService;
            },

            setUpMap: function ClientUI_Libaries_BingMaps_BingMapsProvider$setUpMap(SetupCallBack, CreatePinCallBack) {
                if (this._map != null) {
                    SetupCallBack();
                    return;
                }
                var mapOptions = {};
                mapOptions.callback = ss.Delegate.create(this, function () {
                    var options = {};
                    options.credentials = this._config.bingKey;
                    options.enableClickableLogo = false;
                    options.showDashboard = true;
                    options.showBreadcrumb = false;
                    options.customizeOverlays = true;
                    debugger;
                    this._map = new Microsoft.Maps.Map(document.getElementById(this.mapDivId), options);
                    Microsoft.Maps.registerModule('PointBasedClusteringModule', 'PointBasedClustering.js');
                    var clusteringOptions = {};
                    clusteringOptions.callback = ss.Delegate.create(this, function () {
                        var clusterRadius;
                        if (this._config.enableClustering) {
                            clusterRadius = this._config.clusterRadius;
                        }
                        else {
                            clusterRadius = -1;
                        }
                        var pointBasedClusteringOptions = {};
                        pointBasedClusteringOptions.callback = ss.Delegate.create(this, this._onRender);
                        pointBasedClusteringOptions.singlePinCallback = CreatePinCallBack;
                        pointBasedClusteringOptions.clusteredPinCallback = ss.Delegate.create(this, this.createClustedPin);
                        pointBasedClusteringOptions.clusterRadius = clusterRadius;
                        this._clusterLayer = new PointBasedClusteredEntityCollection(this._map, pointBasedClusteringOptions);
                        this.isLoaded = true;
                        SetupCallBack();
                    });
                    Microsoft.Maps.loadModule('PointBasedClusteringModule', clusteringOptions);
                    Microsoft.Maps.Events.addHandler(this._map, 'click', ss.Delegate.create(this, function (e) {
                        this._clusterLayer.BringLayerToFront();
                    }));
                });
                Microsoft.Maps.loadModule('Microsoft.Maps.Search', mapOptions);
            },

            setUpMap_old: function ClientUI_Libaries_BingMaps_BingMapsProvider$setUpMap_old(SetupCallBack, CreatePinCallBack) {
                if (this._map != null) {
                    SetupCallBack();
                    return;
                }
                var mapOptions = {};
                mapOptions.callback = ss.Delegate.create(this, function () {
                    var options = {};
                    options.credentials = this._config.bingKey;
                    options.enableClickableLogo = false;
                    options.showDashboard = true;
                    options.showBreadcrumb = false;
                    options.customizeOverlays = true;
                    this._map = new Microsoft.Maps.Map(document.getElementById(this.mapDivId), options);
                    var viewOptions = {};
                    SetupCallBack();
                });
            },

           

            _updatePolygon: function ClientUI_Libaries_BingMaps_BingMapsProvider$_updatePolygon(mapShape) {
                if (mapShape != null) {
                    this.polygonLocations = mapShape.getLocations();
                }
                else {
                    this.polygonLocations = null;
                }
                if (this.__onPolygonSelect != null) {
                    this.__onPolygonSelect(this.polygonLocations);
                }
            },

            showInfoBox: function ClientUI_Libaries_BingMaps_BingMapsProvider$showInfoBox(options, location) {
                if (this._infobox == null) {
                    this._infobox = new Microsoft.Maps.Infobox(location);
                }
                options.visible = true;
                this._infobox.setOptions(options);
                this._infobox.setLocation(location);
            },

            refresh: function ClientUI_Libaries_BingMaps_BingMapsProvider$refresh() {
                if (this._clusterLayer != null) {
                    this._clusterLayer.SetOptions({});
                }
            },

            _onRender: function ClientUI_Libaries_BingMaps_BingMapsProvider$_onRender() {
                if (this._map != null && this._clusterLayer != null && this.pendingCentreView) {
                    this.pendingCentreView = false;
                    this.centreView();
                }
            },

            clearPins: function ClientUI_Libaries_BingMaps_BingMapsProvider$clearPins() {
                if (this._clusterLayer != null) {
                    var layer = this._clusterLayer.GetLayer();
                    if (layer != null) {
                        layer.clear();
                    }
                }
            },

            addPins: function ClientUI_Libaries_BingMaps_BingMapsProvider$addPins(pins) {
                this._pins = pins;
                this._clusterLayer.SetData(pins);
            },

            updatePins: function ClientUI_Libaries_BingMaps_BingMapsProvider$updatePins() {
                this._clusterLayer.SetData(this._pins);
            },

            createClustedPin: function ClientUI_Libaries_BingMaps_BingMapsProvider$createClustedPin(clusterInfo) {
                var options = {};
                options.text = clusterInfo.dataIndices.length.toString();
                var pin = new Microsoft.Maps.Pushpin(clusterInfo.center, options);
                var infoBoxOptions = {};
                infoBoxOptions.title = 'Cluster';
                infoBoxOptions.pushpin = pin;
                infoBoxOptions.description = '';
                var infobox = new Microsoft.Maps.Infobox(clusterInfo.center, infoBoxOptions);
                return { pin: pin, pushpin: infobox };
            },

            addPushPin: function ClientUI_Libaries_BingMaps_BingMapsProvider$addPushPin(location) {
                var options = {};
                options.typeName = 'standard';
                options.draggable = true;
                options.icon = 'pin_blue.png';
                var pushPin = new Microsoft.Maps.Pushpin(location, options);
                this._map.entities.push(pushPin);
            },

            centreView: function ClientUI_Libaries_BingMaps_BingMapsProvider$centreView() {
                this.pendingCentreView = false;
                if (this._clusterLayer != null) {
                    var pins = this._pins;
                    var bounds = null;
                    if (pins == null || !pins.length) {
                        var defaultCentre = [new Microsoft.Maps.Location(this._config.centerLat, this._config.centerLon)];
                        bounds = Microsoft.Maps.LocationRect.fromLocations(defaultCentre);
                    }
                    else {
                        var boundPins = [];
                        boundPins.addRange(pins);
                        if (this.polygonLocations != null) {
                            boundPins.addRange(this.polygonLocations);
                        }
                        bounds = Microsoft.Maps.LocationRect.fromLocations(boundPins);
                    }
                    var options = {};
                    if (bounds != null && !bounds.height && !bounds.width) {
                        options.zoom = this._config.zoom;
                        options.center = bounds.center;
                        options.mapTypeId = Microsoft.Maps.MapTypeId.aerial;
                    }
                    else if (bounds != null) {
                        options.bounds = new Microsoft.Maps.LocationRect(bounds.center, bounds.width, bounds.height);
                    }
                    else {
                        options = null;
                    }
                    if (options != null) {
                        this._map.setView(options);
                        window.setTimeout(ss.Delegate.create(this, function () {
                            this._map.setView(options);
                        }), 1000);
                    }
                }
            },

            centreOn: function ClientUI_Libaries_BingMaps_BingMapsProvider$centreOn(location, zoom, animate) {
                var options = {};
                options.center = location;
                options.zoom = zoom;
                this._map.setView(options);
            },

            resize: function ClientUI_Libaries_BingMaps_BingMapsProvider$resize(width, height) {
                $('#' + this.mapDivId).width(width).height(height);
            },

            createInfoBox: function ClientUI_Libaries_BingMaps_BingMapsProvider$createInfoBox(label, clickHandler) {
                var action = {};
                action.label = label;
                action.eventHandler = clickHandler;
                return action;
            },

            createStreetViewAction: function ClientUI_Libaries_BingMaps_BingMapsProvider$createStreetViewAction(longitude, latitude) {
                var streetViewAction = {};
                streetViewAction.label = ResourceStrings.StreetView;
                streetViewAction.eventHandler = function () {
                    var streetViewUrl = 'https://www.google.com/maps?q={0},{1}&hl=en&layer=c&cbll={0},{1}&cbp=11,0,0,0,0';
                    var url = encodeURIComponent(String.format(streetViewUrl, latitude, longitude));
                    
                };
                return streetViewAction;
            }
        }


        ClientUI.Libaries.BingMaps.MapConfig = function ClientUI_Libaries_BingMaps_MapConfig() {
            this.centerLon = -106.346771;
        }
        ClientUI.Libaries.BingMaps.MapConfig.prototype = {
            bingKey: ' ',
            zoom: 3,
            centerLat: 56.130366,
            lang: 'en-GB',
            SSL: false,
            enableClustering: true,
            clusterRadius: 30,
            pinSize: 1
        }

        Type.registerNamespace('ClientUI.BingSearch.ViewModels');
        ClientUI.BingSearch.ViewModels.BingMapViewModel = function ClientUI_BingSearch_ViewModels_BingMapViewModel(map) {

            ClientUI.BingSearch.ViewModels.BingMapViewModel.initializeBase(this);
            this._map$1 = map;

           
        }
        ClientUI.BingSearch.ViewModels.BingMapViewModel._updateCoordinates$1 = function ClientUI_BingSearch_ViewModels_BingMapViewModel$_updateCoordinates$1(longitude, latitude) {
            
        }
        ClientUI.BingSearch.ViewModels.BingMapViewModel.prototype = {
            pinUnlocked: null,
            _pin$1: null,
            _map$1: null,
            AddressButtonViewModel: null,

            _addressButtonViewModel_OnAddressValidated$1: function ClientUI_BingSearch_ViewModels_BingMapViewModel$_addressButtonViewModel_OnAddressValidated$1() {
                this.loadAddress();
            },

            SetToPinLocation: function ClientUI_BingSearch_ViewModels_BingMapViewModel$SetToPinLocation() {
                if (this._pin$1 != null) {
                    ClientUI.BingSearch.ViewModels.BingMapViewModel._updateCoordinates$1(this._pin$1.longitude, this._pin$1.latitude);
                }
            },

            SearchCommand: function ClientUI_BingSearch_ViewModels_BingMapViewModel$SearchCommand() {
                var searchTerm = this.SearchTerm();
                if (String.isNullOrEmpty(searchTerm)) {
                    return;
                }
                var geocodeService = this._map$1.getGeocodeService();
                geocodeService.setTotal(1);
                geocodeService.setCallBack(ss.Delegate.create(this, function (data) {
                    if (data.length > 0) {
                        this.showPin(data[0]);
                    }
                }));
                var pin = {};
                geocodeService.geocodeRequest(this.SearchTerm(), pin);
            },

            showPin: function ClientUI_BingSearch_ViewModels_BingMapViewModel$showPin(pin) {
                debugger;
                this._pin$1 = pin;
                var unknownLocation = false;
                if (pin.latitude == null || !pin.latitude || pin.longitude == null || !pin.longitude) {
                    pin.latitude = 0;
                    pin.longitude = 0;
                    pin.name = ResourceStrings.UnkownLocation;
                    unknownLocation = true;
                }
                this._map$1.addPins([pin]);
                
                this._map$1.centreOn(pin, 14, false);
            },

            _addIfValue$1: function ClientUI_BingSearch_ViewModels_BingMapViewModel$_addIfValue$1(list, value) {
                if (!String.isNullOrEmpty(value)) {
                    list.add(value);
                }
            },

            loadAddress: function ClientUI_BingSearch_ViewModels_BingMapViewModel$loadAddress() {
                debugger;
                var address = '';
                var longitude = 55.7657890000;
                var latitude = 37.6983185000;
                

                if (longitude == null || latitude == null || !longitude || !latitude) {
                    this.SearchCommand();
                }
                else {
                    var pin = {};
                    pin.longitude = longitude;
                    pin.latitude = latitude;
                    this.showPin(pin);
                }
            },

            onPinDragged: function ClientUI_BingSearch_ViewModels_BingMapViewModel$onPinDragged(pin, longitude, latitude) {
                if (!this.pinUnlocked()) {
                    var confirmed = confirm('You have moved the location of this Bing, do you really want to repositiong the pin?');
                    this.pinUnlocked(confirmed);
                }
                if (this.pinUnlocked()) {
                    pin.longitude = longitude;
                    pin.latitude = latitude;
                    this._map$1.updatePins();
                }
                else {
                    this._map$1.refresh();
                }
            }
        }
       
        Type.registerNamespace('ClientUI.BingSearch.Views');


        ClientUI.BingSearch.Views.BingMapView = function ClientUI_BingSearch_Views_BingMapView() {
            ClientUI.BingSearch.Views.BingMapView.initializeBase(this);
            
            var lcid = 1033;
            this._map = new ClientUI.Libaries.BingMaps.BingMapsProvider();
            this._map.init('mapDiv', 'mapLoaded', false, lcid);
            this.vm = new ClientUI.BingSearch.ViewModels.BingMapViewModel(this._map);
            this._addResizeEventHandlers$1();
          
        }
        ClientUI.BingSearch.Views.BingMapView.init = function ClientUI_BingSearch_Views_BingMapView$init() {
            ClientUI.BingSearch.Views.BingMapView._view = new ClientUI.BingSearch.Views.BingMapView();
        }
        window.mapLoaded = function ClientUI_BingSearch_Views_BingMapView$mapLoaded() {
            $(function () {
                ClientUI.BingSearch.Views.BingMapView._view.onMapLoaded();
            });
        }
        ClientUI.BingSearch.Views.BingMapView.prototype = {
            vm: null,
            _map: null,

            _addResizeEventHandlers$1: function ClientUI_BingSearch_Views_BingMapView$_addResizeEventHandlers$1() {
                $(window).resize(ss.Delegate.create(this, this._onResize$1));
                $(ss.Delegate.create(this, function () {
                    this._onResize$1(null);
                }));
            },

            _onResize$1: function ClientUI_BingSearch_Views_BingMapView$_onResize$1(e) {
                var height = $(window).height();
                var width = $(window).width();
                this._map.resize(width, height);
                this._map.refresh();
            },

            onMapLoaded: function ClientUI_BingSearch_Views_BingMapView$onMapLoaded() {
                this._map.setUpMap(ss.Delegate.create(this, this._callBack$1), ss.Delegate.create(this, this._createPin$1));
            },

            _callBack$1: function ClientUI_BingSearch_Views_BingMapView$_callBack$1() {
                this.vm.loadAddress();
            },

            _createPin$1: function ClientUI_BingSearch_Views_BingMapView$_createPin$1(data, clusterInfo) {
                var pinData = data;
                var options = {};
                options.typeName = 'standard';
                options.draggable = true;
                options.icon = 'pin_blue.png';
                var location = new Microsoft.Maps.Location(pinData.latitude, pinData.longitude);
                var pin = new Microsoft.Maps.Pushpin(location, options);
                pin.metadata = pinData;
                Microsoft.Maps.Events.addHandler(pin, 'dragend', ss.Delegate.create(this, this._onEndDrag$1));
                return { pin: pin };
            },

            _onEndDrag$1: function ClientUI_BingSearch_Views_BingMapView$_onEndDrag$1(e) {
                var dragEvent = e;
                var pin = dragEvent['entity'];
                var location = pin.getLocation();
                var data = pin.metadata;
                this.vm.onPinDragged(data, location.longitude, location.latitude);
            }
        }
        
        
        ClientUI.BingSearch.ViewModels.BingMapViewModel.registerClass('ClientUI.BingSearch.ViewModels.BingMapViewModel', SparkleXrm.ViewModelBase);

        ClientUI.BingSearch.Views.BingMapView.registerClass('ClientUI.BingSearch.Views.BingMapView', SparkleXrm.ViewModelBase);
         
        ClientUI.BingSearch.Views.BingMapView._view = null;

    })(window.xrmjQuery);

    Thanks in advance!


    Wednesday, May 31, 2017 2:55 AM
  • Ok, digging into this it looks like you are passing in an object that contains a latitude/longitude property in place of pushpins, but these are not pushpins, they are not even proper location objects. As such, when the map goes to render them there is a lot of missing functions which makes it impossible for it to render the data. You need to use the proper Microsoft.Maps.Locaiton and Microsoft.Maps.Pushpin objects. It looks like this is an issue through out the code base and not a simple fix in one place.

    [Blog] [twitter] [LinkedIn]

    Wednesday, May 31, 2017 5:19 PM
  • Hi Ricky,

    Thanks. My bad. I was using the existing code that had implemented the pointbased clustering, with minimal changes. Now, i get to see the pushpin loaded, but having issues with the pushpin events. Can you please share some samples using this pointbased clustering module.

    Thanks 

    Prasanna


    Thursday, June 1, 2017 2:39 AM
  • Other than the one sample for V8 that is in the that module there are no other samples for this module using V8. Nearly all others use the built in clustering module now which is faster.

    http://bingmapsv8samples.azurewebsites.net/#Clustering_Basic

    https://msdn.microsoft.com/en-us/library/mt712807.aspx


    [Blog] [twitter] [LinkedIn]

    Thursday, June 1, 2017 4:49 PM
  • Thanks Ricky..
    Friday, June 2, 2017 1:47 AM