<?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: map.CenterAndZoom zooms off point in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193369#M17830</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ha, well, that wasn't the answer. Can you post a simple codepen?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jul 2020 22:58:02 GMT</pubDate>
    <dc:creator>Noah-Sager</dc:creator>
    <dc:date>2020-07-01T22:58:02Z</dc:date>
    <item>
      <title>map.CenterAndZoom zooms off point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193366#M17827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I am trying to zoom in on a point with my following function but it zooms me way off course, far from the point which I need to be zoomed at.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="padding-left: 60px;"&gt;map = new Map("map", {&lt;BR /&gt; basemap: "satellite", //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd&lt;BR /&gt; center: [21.403316, 42.002183],&lt;BR /&gt; zoom: 10&lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://62.162.113.130:6080/arcgis/rest/services/DUP_podlogi_Izvodi/MapServer", {&lt;BR /&gt; "opacity": 1&lt;BR /&gt; });&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;var secondLayer = new ArcGISDynamicMapServiceLayer("https://app.gdi.mk:6443/arcgis/rest/services/karpos/Karpos_Vector_Izvodi/MapServer", {&lt;BR /&gt; "opacity": 1&lt;BR /&gt; });&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;map.addLayers([dynamicMapServiceLayer, secondLayer]);&lt;BR /&gt; map.on("load", selectRoute);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;function zoomToRoute(features) {&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;var num = features.features.length;&lt;BR /&gt; var map = this.map;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;function zoomToRoute(features) {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var num = features.features.length;&lt;BR /&gt; var map = this.map;&lt;BR /&gt; map.graphics.clear();&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var pointSymbolNew = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 255, 255]), 1), new Color([255, 0, 127, 1]));&lt;BR /&gt; var selectedFeature = features.features;&lt;BR /&gt; selectedFeature[0].setSymbol(pointSymbolNew);&lt;BR /&gt; map.graphics.add(selectedFeature[0]);&lt;BR /&gt; var lat = selectedFeature[0].geometry.x; //getLatitude();&lt;BR /&gt; var longs = selectedFeature[0].geometry.y; //getLongitude();&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var point = new esri.geometry.Point({&lt;BR /&gt; latitude: lat,&lt;BR /&gt; longitude: longs&lt;BR /&gt; });&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;map.centerAndZoom(point, 3);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var factor = 3; //some factor for converting point to extent --&amp;gt;&lt;BR /&gt; var extent = new Extent(lat - factor, longs - factor, lat + factor, longs + factor, map.spatialReference);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;map.setExtent(extent);&lt;BR /&gt; map.setScale(sentScale);&lt;BR /&gt; setTimeout(printImage, 1000);&lt;BR /&gt; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="padding-left: 60px;"&gt;&lt;/P&gt;&lt;P&gt;I tried increasing and decreasing the factor value but still nothing. I also increased and decreased the levelOrFactor of centerAndZoom and it didn't help. Anyone has any idea what I'm doing wrong that it zooms me far off point?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 12:59:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193366#M17827</guid>
      <dc:creator>NovicaJosifovski</dc:creator>
      <dc:date>2020-07-01T12:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: map.CenterAndZoom zooms off point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193367#M17828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't test it, but I wonder if you try using the x and y values for the location of the point like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="border: 0px; padding: 0px 0px 0px 30px;"&gt;var lat = selectedFeature[0].geometry.x; //getLatitude();&lt;BR /&gt;var longs = selectedFeature[0].geometry.y; //getLongitude();&lt;/P&gt;&lt;P style="border: 0px; padding: 0px 0px 0px 30px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; padding: 0px 0px 0px 30px;"&gt;var point = new esri.geometry.Point({&lt;BR /&gt;&amp;nbsp; x: lat,&lt;BR /&gt;&amp;nbsp; y: longs&lt;BR /&gt;});&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 18:50:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193367#M17828</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2020-07-01T18:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: map.CenterAndZoom zooms off point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193368#M17829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried that out and it just zooms me further away than before &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 22:55:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193368#M17829</guid>
      <dc:creator>NovicaJosifovski</dc:creator>
      <dc:date>2020-07-01T22:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: map.CenterAndZoom zooms off point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193369#M17830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ha, well, that wasn't the answer. Can you post a simple codepen?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 22:58:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193369#M17830</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2020-07-01T22:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: map.CenterAndZoom zooms off point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193370#M17831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to provide you with a codepen but my feature layers are not public, I'll try to get a working codepen version &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 23:14:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193370#M17831</guid>
      <dc:creator>NovicaJosifovski</dc:creator>
      <dc:date>2020-07-01T23:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: map.CenterAndZoom zooms off point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193371#M17832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/396815"&gt;Novica Josifovski&lt;/A&gt;‌, can you check you are using the same spatial reference system?&amp;nbsp;e.g 3857 vs 4326&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2020 02:46:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193371#M17832</guid>
      <dc:creator>VictorTey</dc:creator>
      <dc:date>2020-07-02T02:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: map.CenterAndZoom zooms off point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193372#M17833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/36951"&gt;Noah Sager&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;Since I cannot provide you with a Codepen, I'll try it like this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/498665_Screenshot_48.png" /&gt;&lt;/P&gt;&lt;P&gt;I replaced my satellite basemap with this one, I thought that might be the issue. I set the proper WKID and extent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aaaand here is my &lt;STRONG&gt;printMap()&lt;/STRONG&gt; function called on the click of the &lt;STRONG&gt;"Print map"&lt;/STRONG&gt; button.&lt;BR /&gt;In the &lt;STRONG&gt;printMap()&lt;/STRONG&gt; function, I call the &lt;STRONG&gt;zoomToRoute()&lt;/STRONG&gt; function which I use to zoom on a point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/498666_Screenshot_49.png" /&gt;&lt;/P&gt;&lt;P&gt;So, when I click the &lt;STRONG&gt;Print map&lt;/STRONG&gt; button once, it takes me here - at the &lt;STRONG&gt;X&lt;/STRONG&gt;, marked on the map. And I zoomed out quite a bit to shop the point on the map, which I also highlighted. So it zooms me quite a bit off point. But if I click the &lt;STRONG&gt;Print map&lt;/STRONG&gt; button again, it takes me to the correct point on the map.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-3 j-img-original" src="https://community.esri.com/legacyfs/online/498667_Screenshot_50.png" /&gt;&lt;/P&gt;&lt;P&gt;I tried to use &lt;STRONG&gt;map.centerAndZoom&lt;/STRONG&gt; as well as &lt;STRONG&gt;map.centerAt&lt;/STRONG&gt; but the same thing happens.&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the weirdest part of all is that I get this warning /error in the console&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Map: Geometry (wkid: 4326) cannot be converted to spatial reference of the map (wkid: 6316)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I tripled checked all my layers /services. They are all the correct WKID, the one I need is 6316.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2020 13:59:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-centerandzoom-zooms-off-point/m-p/193372#M17833</guid>
      <dc:creator>NovicaJosifovski</dc:creator>
      <dc:date>2020-07-02T13:59:48Z</dc:date>
    </item>
  </channel>
</rss>

