<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: External Link to Map Element in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/external-link-to-map-element/m-p/588171#M54933</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can think of one way of doing this but it may not fit in with how you've designed your website. Here it goes-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;On your webpage, use an IFRAME for the map.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;In the IFRAME, load an HTML page of your javascript API map that uses 100% of the browser's width and height.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;In your map initialization javascript, include some code to check the URL to see if any parameters were passed to it. I've done this before and it looked something like this:&lt;/LI&gt;&lt;BR /&gt;[INDENT]&lt;PRE class="lia-code-sample line-numbers language-none"&gt; //Evaluate the URL of this HTML page to determine if any parameters were passed with it
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var htmlPagePath = window.location.toString();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var qLocation = htmlPagePath.indexOf('?');

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (qLocation &amp;lt; 1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp; passedLatLong = false;
&amp;nbsp; }
&amp;nbsp; else
&amp;nbsp;&amp;nbsp; passLatLong = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //If a coordinate location was passed as a parameter, zoom the map to it
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (passedLatLong)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp; //Extract the lat/long coordinates passed as a parameter with the URL
&amp;nbsp;&amp;nbsp; var coordStr = window.location.toString().substr(qLocation + 1,window.location.toString().length);
&amp;nbsp;&amp;nbsp; var coords = new Array();
&amp;nbsp;&amp;nbsp; coords = coordStr.split(',');

&amp;nbsp;&amp;nbsp; //Create a lat/long point
&amp;nbsp;&amp;nbsp; var bridgeLoc = new esri.geometry.Point(coords[0],coords[1], new esri.SpatialReference({wkid:4326}));

&amp;nbsp;&amp;nbsp; //set the map extent based on the lat/long coordinate passed. The coordinate must be converted
&amp;nbsp;&amp;nbsp; //to Web Mercator since the web services used have been defined with that projection..
&amp;nbsp;&amp;nbsp; map.setExtent(pointToExtent(map,esri.geometry.geographicToWebMercator(bridgeLoc),3));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;LI&gt;Hopefully you now see where I'm going with this. When your users click on your "external link" on the page, have the onClick event reload the IFRAME but append a parameter to the URL (FID, lat/long, etc) and then your map init() routine will recognize the parameter and respond accordingly.&lt;/LI&gt;
&lt;/PRE&gt;[/INDENT]&lt;BR /&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, this approach may not fit in with what you want to do but it's possible. Good luck!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 01:16:01 GMT</pubDate>
    <dc:creator>SteveCole</dc:creator>
    <dc:date>2021-12-12T01:16:01Z</dc:date>
    <item>
      <title>External Link to Map Element</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/external-link-to-map-element/m-p/588170#M54932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We have a web map embedded in a website page. And we are able to listen to elements clicked on in the map for use externally to the map within the website.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But, what we would now like to do is to alter the map view based on a link that a user clicks on outside of the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to have an external link on the same page as the map, that when clicked on would zoom and center the map on the chosen map element? Say a polygon etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this possible?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Livetech&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 14:52:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/external-link-to-map-element/m-p/588170#M54932</guid>
      <dc:creator>GrantRussell1</dc:creator>
      <dc:date>2012-11-30T14:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: External Link to Map Element</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/external-link-to-map-element/m-p/588171#M54933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can think of one way of doing this but it may not fit in with how you've designed your website. Here it goes-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;On your webpage, use an IFRAME for the map.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;In the IFRAME, load an HTML page of your javascript API map that uses 100% of the browser's width and height.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;In your map initialization javascript, include some code to check the URL to see if any parameters were passed to it. I've done this before and it looked something like this:&lt;/LI&gt;&lt;BR /&gt;[INDENT]&lt;PRE class="lia-code-sample line-numbers language-none"&gt; //Evaluate the URL of this HTML page to determine if any parameters were passed with it
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var htmlPagePath = window.location.toString();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var qLocation = htmlPagePath.indexOf('?');

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (qLocation &amp;lt; 1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp; passedLatLong = false;
&amp;nbsp; }
&amp;nbsp; else
&amp;nbsp;&amp;nbsp; passLatLong = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //If a coordinate location was passed as a parameter, zoom the map to it
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (passedLatLong)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp; //Extract the lat/long coordinates passed as a parameter with the URL
&amp;nbsp;&amp;nbsp; var coordStr = window.location.toString().substr(qLocation + 1,window.location.toString().length);
&amp;nbsp;&amp;nbsp; var coords = new Array();
&amp;nbsp;&amp;nbsp; coords = coordStr.split(',');

&amp;nbsp;&amp;nbsp; //Create a lat/long point
&amp;nbsp;&amp;nbsp; var bridgeLoc = new esri.geometry.Point(coords[0],coords[1], new esri.SpatialReference({wkid:4326}));

&amp;nbsp;&amp;nbsp; //set the map extent based on the lat/long coordinate passed. The coordinate must be converted
&amp;nbsp;&amp;nbsp; //to Web Mercator since the web services used have been defined with that projection..
&amp;nbsp;&amp;nbsp; map.setExtent(pointToExtent(map,esri.geometry.geographicToWebMercator(bridgeLoc),3));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;LI&gt;Hopefully you now see where I'm going with this. When your users click on your "external link" on the page, have the onClick event reload the IFRAME but append a parameter to the URL (FID, lat/long, etc) and then your map init() routine will recognize the parameter and respond accordingly.&lt;/LI&gt;
&lt;/PRE&gt;[/INDENT]&lt;BR /&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, this approach may not fit in with what you want to do but it's possible. Good luck!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:16:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/external-link-to-map-element/m-p/588171#M54933</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2021-12-12T01:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: External Link to Map Element</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/external-link-to-map-element/m-p/588172#M54934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Cheers, will investigate that, but dont really want to go the Iframe route if can be helped due to other processes we have going on....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hmmm&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2012 07:50:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/external-link-to-map-element/m-p/588172#M54934</guid>
      <dc:creator>GrantRussell1</dc:creator>
      <dc:date>2012-12-04T07:50:01Z</dc:date>
    </item>
  </channel>
</rss>

