Plot marker in Bing map using postcode not working after application keep ideal for 30 minutes










0















I have integrated Bing map for showing map marker from a postcode. The post will pass as input for the map. If I go to map first-time with postcode it will work fine. After returning from map page if I keep application ideal for 3o minute then if I will redirect to Bing map page with postcode then it will not plot a marker on the map.



bingmap.ts 

getMarker()
Microsoft.Maps.loadModule(['Microsoft.Maps.SpatialDataService',
'Microsoft.Maps.Search'], () =>
this.searchManager = new Microsoft.Maps.Search.SearchManager(this.map);
);
var url = environment.baseurl + '/tables/Property?$filter=IncidentId eq ';
const data = this.passdataservice.bingMapdata.mapparam;
const searchrequest = data.postcode;
let geocodeRequest =
where: searchrequest,
callback: this.generateMarker,
errorCallback: (e) =>
,
userData: that: this
;
this.searchManager.geocode(geocodeRequest);

// end of fucntion

// frucntion for generating marker
generateMarker(geocodeResult, userData)
userData.that.clearOldMapsData();
let that = userData.that;
console.log('result data fucntion');
console.log(geocodeResult);
console.log('userData');
console.log(userData.that);
if (geocodeResult && geocodeResult.results && geocodeResult.results.length > 0)
let latLongDetails: LatLongDetail = ;
for (const result of geocodeResult.results)
let latLongRecord = new LatLongDetail();
latLongRecord.lat = result.locations[0].latitude;
latLongRecord.long = result.locations[0].longitude;
latLongDetails.push(latLongRecord);

for (var i = 0; i < 1; i++)
let loc = new Microsoft.Maps.Location(latLongDetails[i].lat, latLongDetails[i].long);
let title =
title: latLongDetails[i].buildingName,
icon: '../../assets/images/map_marker.png'

// custom map setview
that.map.setView(
mapTypeId: Microsoft.Maps.MapTypeId.road,
center: new Microsoft.Maps.Location(latLongDetails[i].lat, latLongDetails[i].long),
zoom: 7
);
const data = that.passdataservice.bingMapdata.mapparam;
// const searchrequest = data.buildingName + ", " + data.dependentLocality + "," + data.postcode;
const searchrequest = data.postcode;
let pin = new Microsoft.Maps.Pushpin(loc, title);
var infobox = new Microsoft.Maps.Infobox(loc,
title: data.postcode,
description: searchrequest,
visible: false
);
infobox.setMap(that.map);
Microsoft.Maps.Events.addHandler(pin, 'click', () =>
infobox.setOptions( visible: true );
);
that.map.entities.push(pin);
that.mapvisible = true;


// end of fucntion









share|improve this question


























    0















    I have integrated Bing map for showing map marker from a postcode. The post will pass as input for the map. If I go to map first-time with postcode it will work fine. After returning from map page if I keep application ideal for 3o minute then if I will redirect to Bing map page with postcode then it will not plot a marker on the map.



    bingmap.ts 

    getMarker()
    Microsoft.Maps.loadModule(['Microsoft.Maps.SpatialDataService',
    'Microsoft.Maps.Search'], () =>
    this.searchManager = new Microsoft.Maps.Search.SearchManager(this.map);
    );
    var url = environment.baseurl + '/tables/Property?$filter=IncidentId eq ';
    const data = this.passdataservice.bingMapdata.mapparam;
    const searchrequest = data.postcode;
    let geocodeRequest =
    where: searchrequest,
    callback: this.generateMarker,
    errorCallback: (e) =>
    ,
    userData: that: this
    ;
    this.searchManager.geocode(geocodeRequest);

    // end of fucntion

    // frucntion for generating marker
    generateMarker(geocodeResult, userData)
    userData.that.clearOldMapsData();
    let that = userData.that;
    console.log('result data fucntion');
    console.log(geocodeResult);
    console.log('userData');
    console.log(userData.that);
    if (geocodeResult && geocodeResult.results && geocodeResult.results.length > 0)
    let latLongDetails: LatLongDetail = ;
    for (const result of geocodeResult.results)
    let latLongRecord = new LatLongDetail();
    latLongRecord.lat = result.locations[0].latitude;
    latLongRecord.long = result.locations[0].longitude;
    latLongDetails.push(latLongRecord);

    for (var i = 0; i < 1; i++)
    let loc = new Microsoft.Maps.Location(latLongDetails[i].lat, latLongDetails[i].long);
    let title =
    title: latLongDetails[i].buildingName,
    icon: '../../assets/images/map_marker.png'

    // custom map setview
    that.map.setView(
    mapTypeId: Microsoft.Maps.MapTypeId.road,
    center: new Microsoft.Maps.Location(latLongDetails[i].lat, latLongDetails[i].long),
    zoom: 7
    );
    const data = that.passdataservice.bingMapdata.mapparam;
    // const searchrequest = data.buildingName + ", " + data.dependentLocality + "," + data.postcode;
    const searchrequest = data.postcode;
    let pin = new Microsoft.Maps.Pushpin(loc, title);
    var infobox = new Microsoft.Maps.Infobox(loc,
    title: data.postcode,
    description: searchrequest,
    visible: false
    );
    infobox.setMap(that.map);
    Microsoft.Maps.Events.addHandler(pin, 'click', () =>
    infobox.setOptions( visible: true );
    );
    that.map.entities.push(pin);
    that.mapvisible = true;


    // end of fucntion









    share|improve this question
























      0












      0








      0








      I have integrated Bing map for showing map marker from a postcode. The post will pass as input for the map. If I go to map first-time with postcode it will work fine. After returning from map page if I keep application ideal for 3o minute then if I will redirect to Bing map page with postcode then it will not plot a marker on the map.



      bingmap.ts 

      getMarker()
      Microsoft.Maps.loadModule(['Microsoft.Maps.SpatialDataService',
      'Microsoft.Maps.Search'], () =>
      this.searchManager = new Microsoft.Maps.Search.SearchManager(this.map);
      );
      var url = environment.baseurl + '/tables/Property?$filter=IncidentId eq ';
      const data = this.passdataservice.bingMapdata.mapparam;
      const searchrequest = data.postcode;
      let geocodeRequest =
      where: searchrequest,
      callback: this.generateMarker,
      errorCallback: (e) =>
      ,
      userData: that: this
      ;
      this.searchManager.geocode(geocodeRequest);

      // end of fucntion

      // frucntion for generating marker
      generateMarker(geocodeResult, userData)
      userData.that.clearOldMapsData();
      let that = userData.that;
      console.log('result data fucntion');
      console.log(geocodeResult);
      console.log('userData');
      console.log(userData.that);
      if (geocodeResult && geocodeResult.results && geocodeResult.results.length > 0)
      let latLongDetails: LatLongDetail = ;
      for (const result of geocodeResult.results)
      let latLongRecord = new LatLongDetail();
      latLongRecord.lat = result.locations[0].latitude;
      latLongRecord.long = result.locations[0].longitude;
      latLongDetails.push(latLongRecord);

      for (var i = 0; i < 1; i++)
      let loc = new Microsoft.Maps.Location(latLongDetails[i].lat, latLongDetails[i].long);
      let title =
      title: latLongDetails[i].buildingName,
      icon: '../../assets/images/map_marker.png'

      // custom map setview
      that.map.setView(
      mapTypeId: Microsoft.Maps.MapTypeId.road,
      center: new Microsoft.Maps.Location(latLongDetails[i].lat, latLongDetails[i].long),
      zoom: 7
      );
      const data = that.passdataservice.bingMapdata.mapparam;
      // const searchrequest = data.buildingName + ", " + data.dependentLocality + "," + data.postcode;
      const searchrequest = data.postcode;
      let pin = new Microsoft.Maps.Pushpin(loc, title);
      var infobox = new Microsoft.Maps.Infobox(loc,
      title: data.postcode,
      description: searchrequest,
      visible: false
      );
      infobox.setMap(that.map);
      Microsoft.Maps.Events.addHandler(pin, 'click', () =>
      infobox.setOptions( visible: true );
      );
      that.map.entities.push(pin);
      that.mapvisible = true;


      // end of fucntion









      share|improve this question














      I have integrated Bing map for showing map marker from a postcode. The post will pass as input for the map. If I go to map first-time with postcode it will work fine. After returning from map page if I keep application ideal for 3o minute then if I will redirect to Bing map page with postcode then it will not plot a marker on the map.



      bingmap.ts 

      getMarker()
      Microsoft.Maps.loadModule(['Microsoft.Maps.SpatialDataService',
      'Microsoft.Maps.Search'], () =>
      this.searchManager = new Microsoft.Maps.Search.SearchManager(this.map);
      );
      var url = environment.baseurl + '/tables/Property?$filter=IncidentId eq ';
      const data = this.passdataservice.bingMapdata.mapparam;
      const searchrequest = data.postcode;
      let geocodeRequest =
      where: searchrequest,
      callback: this.generateMarker,
      errorCallback: (e) =>
      ,
      userData: that: this
      ;
      this.searchManager.geocode(geocodeRequest);

      // end of fucntion

      // frucntion for generating marker
      generateMarker(geocodeResult, userData)
      userData.that.clearOldMapsData();
      let that = userData.that;
      console.log('result data fucntion');
      console.log(geocodeResult);
      console.log('userData');
      console.log(userData.that);
      if (geocodeResult && geocodeResult.results && geocodeResult.results.length > 0)
      let latLongDetails: LatLongDetail = ;
      for (const result of geocodeResult.results)
      let latLongRecord = new LatLongDetail();
      latLongRecord.lat = result.locations[0].latitude;
      latLongRecord.long = result.locations[0].longitude;
      latLongDetails.push(latLongRecord);

      for (var i = 0; i < 1; i++)
      let loc = new Microsoft.Maps.Location(latLongDetails[i].lat, latLongDetails[i].long);
      let title =
      title: latLongDetails[i].buildingName,
      icon: '../../assets/images/map_marker.png'

      // custom map setview
      that.map.setView(
      mapTypeId: Microsoft.Maps.MapTypeId.road,
      center: new Microsoft.Maps.Location(latLongDetails[i].lat, latLongDetails[i].long),
      zoom: 7
      );
      const data = that.passdataservice.bingMapdata.mapparam;
      // const searchrequest = data.buildingName + ", " + data.dependentLocality + "," + data.postcode;
      const searchrequest = data.postcode;
      let pin = new Microsoft.Maps.Pushpin(loc, title);
      var infobox = new Microsoft.Maps.Infobox(loc,
      title: data.postcode,
      description: searchrequest,
      visible: false
      );
      infobox.setMap(that.map);
      Microsoft.Maps.Events.addHandler(pin, 'click', () =>
      infobox.setOptions( visible: true );
      );
      that.map.entities.push(pin);
      that.mapvisible = true;


      // end of fucntion






      typescript dictionary angular6






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 11:29









      Sarjerao GhadageSarjerao Ghadage

      295115




      295115






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299191%2fplot-marker-in-bing-map-using-postcode-not-working-after-application-keep-ideal%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299191%2fplot-marker-in-bing-map-using-postcode-not-working-after-application-keep-ideal%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          ReactJS Fetched API data displays live - need Data displayed static

          政党