<?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: How to add a graphic with geojson string？ in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228320#M21295</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yiyuan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There does not appear to be any direct way to create a Graphic from a GeoJSON string.&amp;nbsp; The Graphic class in the ArcGIS API for JavaScript does have a fromJSON() method but, the JSON format that it is expecting is not quite the same as GeoJSON.&amp;nbsp; The fromJSON() method is expecting the coordinates to look like the format below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;geometry: {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x: -49.97,&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;y: 41.73&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can suggest the ability to create Graphics from GeoJSON strings on the Esri&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/community/arcgis-ideas"&gt;Ideas&lt;/A&gt;&amp;nbsp;page.&amp;nbsp; I searched to see if this feature had already been suggested but it appears it has not.&amp;nbsp; Check out the links under Getting Started at the right of the Ideas page to learn how to submit an idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Apr 2020 18:08:52 GMT</pubDate>
    <dc:creator>ChristopherKoenig</dc:creator>
    <dc:date>2020-04-01T18:08:52Z</dc:date>
    <item>
      <title>How to add a graphic with geojson string？</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228316#M21291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm using Arcgis API for JS 4.14，it provides&amp;nbsp;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;GeoJSONLayer to add geoJSON data from url, just like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN class="" style="font-size: 14px;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="color: #4f4f4f; background-color: #f6f8fa;"&gt; geoJsonLayer1 = &lt;/SPAN&gt;&lt;SPAN class="" style="font-size: 14px;"&gt;new&lt;/SPAN&gt;&lt;SPAN style="color: #4f4f4f; background-color: #f6f8fa;"&gt; GeoJsonLayer({ url: &lt;/SPAN&gt;&lt;SPAN class="" style="font-size: 14px;"&gt;"http://www.myCorsEnabledServer.com/canada.json"&lt;/SPAN&gt;&lt;SPAN style="color: #4f4f4f; background-color: #f6f8fa;"&gt; });&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;However, my data and geo information is stored in MS SQL server，ever single record has a GeoJSON string, like&amp;nbsp;{"type":"Point","coordinates":[119.84039205155467,32.309760149806948]}, I can't load it directly by&amp;nbsp;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;GeoJSONLayer because there&amp;nbsp;are no urls.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;I think I can read the GeoJSON strings and creat graphics for each record, but how? Is there any way to convert &lt;SPAN&gt;GeoJSON string to graphic?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Mar 2020 17:36:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228316#M21291</guid>
      <dc:creator>YiyuanGao</dc:creator>
      <dc:date>2020-03-28T17:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a graphic with geojson string？</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228317#M21292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can load is as URL object via Blob.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;  &lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; blob &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;Blob&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;JSON&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;stringify&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;geojson&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    type&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"application/json"&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; url &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; URL&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createObjectURL&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;blob&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;GeoJSONLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; url &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Demo:&amp;nbsp;&lt;A class="" href="https://codepen.io/odoe/pen/YzKqLZO" title="https://codepen.io/odoe/pen/YzKqLZO" rel="nofollow noopener noreferrer" target="_blank"&gt;https://codepen.io/odoe/pen/YzKqLZO&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:06:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228317#M21292</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-11T11:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a graphic with geojson string？</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228318#M21293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rene,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Sure would be nice to just have a string constructor option too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2020 12:47:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228318#M21293</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-03-30T12:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a graphic with geojson string？</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228319#M21294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's on the roadmap, not sure when it will be done though. I'll twist some screws, ha!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2020 16:45:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228319#M21294</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2020-03-30T16:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a graphic with geojson string？</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228320#M21295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yiyuan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There does not appear to be any direct way to create a Graphic from a GeoJSON string.&amp;nbsp; The Graphic class in the ArcGIS API for JavaScript does have a fromJSON() method but, the JSON format that it is expecting is not quite the same as GeoJSON.&amp;nbsp; The fromJSON() method is expecting the coordinates to look like the format below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;geometry: {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x: -49.97,&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;y: 41.73&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can suggest the ability to create Graphics from GeoJSON strings on the Esri&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/community/arcgis-ideas"&gt;Ideas&lt;/A&gt;&amp;nbsp;page.&amp;nbsp; I searched to see if this feature had already been suggested but it appears it has not.&amp;nbsp; Check out the links under Getting Started at the right of the Ideas page to learn how to submit an idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2020 18:08:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-a-graphic-with-geojson-string/m-p/228320#M21295</guid>
      <dc:creator>ChristopherKoenig</dc:creator>
      <dc:date>2020-04-01T18:08:52Z</dc:date>
    </item>
  </channel>
</rss>

