Processing of GeoJson data in R

[This article was first published on mlampros, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This blog post is about my recently released package on CRAN, geojsonR. The following notes and examples are based mainly on the package Vignette.

GeoJSON is an open standard format designed for representing simple geographical features, along with their non-spatial attributes, based on JavaScript Object Notation. The features include points (therefore addresses and locations), line strings (therefore streets, highways and boundaries), polygons (countries, provinces, tracts of land), and multi-part collections of these types. GeoJSON features need not represent entities of the physical world only; mobile routing and navigation apps, for example, might describe their service coverage using GeoJSON. The GeoJSON format differs from other GIS standards in that it was written and is maintained not by a formal standards organization, but by an Internet working group of developers.”

geojsonR relies mainly on RFC 7946, which is the new standard specification of the GeoJSON format. Moreover, the package takes advantage of a C++11 JSON library (json11) to do the encoding from and to geojson data objects and all functions are then exported in R using the Rcpp and RcppArmadillo packages.

The following lines show an example GeoJson object (“feature_collection.geojson”),

<span class="w">
</span><span class="p">{</span><span class="w">
    </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"FeatureCollection"</span><span class="p">,</span><span class="w">
    </span><span class="s2">"features"</span><span class="o">:</span><span class="w"> </span><span class="p">[{</span><span class="w">
      
        </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Feature"</span><span class="p">,</span><span class="w">
         </span><span class="s2">"geometry"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w">
             </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Point"</span><span class="p">,</span><span class="w">
             </span><span class="s2">"coordinates"</span><span class="o">:</span><span class="w"> 
                </span><span class="p">[</span><span class="m">102.0</span><span class="p">,</span><span class="w"> </span><span class="m">0.5</span><span class="p">]</span><span class="w">
         </span><span class="p">},</span><span class="w">
         </span><span class="s2">"properties"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w">
         </span><span class="s2">"prop0"</span><span class="o">:</span><span class="w"> </span><span class="s2">"value0"</span><span class="w">
         </span><span class="p">}</span><span class="w">
        </span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="w">
        
           </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Feature"</span><span class="p">,</span><span class="w">
           </span><span class="s2">"geometry"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w">
               </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"LineString"</span><span class="p">,</span><span class="w">
               </span><span class="s2">"coordinates"</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="w">
                 </span><span class="p">[</span><span class="m">102.0</span><span class="p">,</span><span class="w"> </span><span class="m">0.0</span><span class="p">],</span><span class="w">
                 </span><span class="p">[</span><span class="m">103.0</span><span class="p">,</span><span class="w"> </span><span class="m">1.0</span><span class="p">],</span><span class="w">
                 </span><span class="p">[</span><span class="m">104.0</span><span class="p">,</span><span class="w"> </span><span class="m">0.0</span><span class="p">],</span><span class="w">
                 </span><span class="p">[</span><span class="m">102.0</span><span class="p">,</span><span class="w"> </span><span class="m">0.0</span><span class="p">]</span><span class="w">
                 </span><span class="p">]</span><span class="w">
               </span><span class="p">},</span><span class="w">
               </span><span class="s2">"properties"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w">
                </span><span class="s2">"prop0"</span><span class="o">:</span><span class="w"> </span><span class="s2">"value0"</span><span class="p">,</span><span class="w">
                </span><span class="s2">"prop1"</span><span class="o">:</span><span class="w"> </span><span class="m">0.0</span><span class="w">
               </span><span class="p">}</span><span class="w">
        </span><span class="p">}</span><span class="w">
    </span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">

</span>

The purpose of this package was not only the implementation of functions to convert from and to geojson objects, but also the development of web applications based on geojson objects / data, which I’ll explain later in the blog post.

FROM_GeoJson

The FROM_GeoJson function can take as input a path to a file, a valid url (beginning from http..) or a GeoJson object in form of a character string. The output is a named list and the resulted coordinates member is a matrix, as the following code chunks illustrate,

<span class="w">
</span><span class="c1"># assuming that the data is saved in the previously mentioned "feature_collection.geojson"
</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="n">geojsonR</span><span class="p">)</span><span class="w">

</span><span class="c1"># INPUT IS A PATH TO A FILE
</span><span class="w">
</span><span class="n">file_js</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">FROM_GeoJson</span><span class="p">(</span><span class="n">url_file_string</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"feature_collection.geojson"</span><span class="p">)</span><span class="w">

</span><span class="n">file_js</span><span class="w">

</span>
<span class="w">
</span><span class="c1"># output :
</span><span class="w">

</span><span class="o">$</span><span class="n">features</span><span class="w">
</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">1</span><span class="p">]]</span><span class="w">
</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">1</span><span class="p">]]</span><span class="o">$</span><span class="n">geometry</span><span class="w">
</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">1</span><span class="p">]]</span><span class="o">$</span><span class="n">geometry</span><span class="o">$</span><span class="n">type</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="s2">"Point"</span><span class="w">

</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">1</span><span class="p">]]</span><span class="o">$</span><span class="n">geometry</span><span class="o">$</span><span class="n">coordinates</span><span class="w">
     </span><span class="p">[,</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="p">[,</span><span class="m">2</span><span class="p">]</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">,]</span><span class="w">  </span><span class="m">102</span><span class="w">  </span><span class="m">0.5</span><span class="w">


</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">1</span><span class="p">]]</span><span class="o">$</span><span class="n">properties</span><span class="w">
</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">1</span><span class="p">]]</span><span class="o">$</span><span class="n">properties</span><span class="o">$</span><span class="n">prop0</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="s2">"value0"</span><span class="w">


</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">1</span><span class="p">]]</span><span class="o">$</span><span class="n">type</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="s2">"Feature"</span><span class="w">


</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">2</span><span class="p">]]</span><span class="w">
</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">2</span><span class="p">]]</span><span class="o">$</span><span class="n">geometry</span><span class="w">
</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">2</span><span class="p">]]</span><span class="o">$</span><span class="n">geometry</span><span class="o">$</span><span class="n">type</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="s2">"LineString"</span><span class="w">

</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">2</span><span class="p">]]</span><span class="o">$</span><span class="n">geometry</span><span class="o">$</span><span class="n">coordinates</span><span class="w">
     </span><span class="p">[,</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="p">[,</span><span class="m">2</span><span class="p">]</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">,]</span><span class="w">  </span><span class="m">102</span><span class="w">    </span><span class="m">0</span><span class="w">
</span><span class="p">[</span><span class="m">2</span><span class="p">,]</span><span class="w">  </span><span class="m">103</span><span class="w">    </span><span class="m">1</span><span class="w">
</span><span class="p">[</span><span class="m">3</span><span class="p">,]</span><span class="w">  </span><span class="m">104</span><span class="w">    </span><span class="m">0</span><span class="w">
</span><span class="p">[</span><span class="m">4</span><span class="p">,]</span><span class="w">  </span><span class="m">102</span><span class="w">    </span><span class="m">0</span><span class="w">


</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">2</span><span class="p">]]</span><span class="o">$</span><span class="n">properties</span><span class="w">
</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">2</span><span class="p">]]</span><span class="o">$</span><span class="n">properties</span><span class="o">$</span><span class="n">prop0</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="s2">"value0"</span><span class="w">

</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">2</span><span class="p">]]</span><span class="o">$</span><span class="n">properties</span><span class="o">$</span><span class="n">prop1</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="m">0</span><span class="w">


</span><span class="o">$</span><span class="n">features</span><span class="p">[[</span><span class="m">2</span><span class="p">]]</span><span class="o">$</span><span class="n">type</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="s2">"Feature"</span><span class="w">



</span><span class="o">$</span><span class="n">type</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="s2">"FeatureCollection"</span><span class="w">

</span>

<span class="w">
</span><span class="c1"># INPUT IS A GeoJson OBJECT (character string)
</span><span class="w">
</span><span class="n">str_js</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'{ "type": "MultiPolygon", 
            "coordinates": [
                [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
                [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
                 [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
                ]
}'</span><span class="w">


</span><span class="n">char_js</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">FROM_GeoJson</span><span class="p">(</span><span class="n">url_file_string</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">str_js</span><span class="p">)</span><span class="w">

</span><span class="n">char_js</span><span class="w">

</span>
<span class="w">
</span><span class="o">$</span><span class="n">type</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="s2">"MultiPolygon"</span><span class="w">

</span><span class="o">$</span><span class="n">coordinates</span><span class="w">
</span><span class="o">$</span><span class="n">coordinates</span><span class="p">[[</span><span class="m">1</span><span class="p">]]</span><span class="w">
     </span><span class="p">[,</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="p">[,</span><span class="m">2</span><span class="p">]</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">,]</span><span class="w">  </span><span class="m">102</span><span class="w">    </span><span class="m">2</span><span class="w">
</span><span class="p">[</span><span class="m">2</span><span class="p">,]</span><span class="w">  </span><span class="m">103</span><span class="w">    </span><span class="m">2</span><span class="w">
</span><span class="p">[</span><span class="m">3</span><span class="p">,]</span><span class="w">  </span><span class="m">103</span><span class="w">    </span><span class="m">3</span><span class="w">
</span><span class="p">[</span><span class="m">4</span><span class="p">,]</span><span class="w">  </span><span class="m">102</span><span class="w">    </span><span class="m">3</span><span class="w">
</span><span class="p">[</span><span class="m">5</span><span class="p">,]</span><span class="w">  </span><span class="m">102</span><span class="w">    </span><span class="m">2</span><span class="w">

</span><span class="o">$</span><span class="n">coordinates</span><span class="p">[[</span><span class="m">2</span><span class="p">]]</span><span class="w">
</span><span class="o">$</span><span class="n">coordinates</span><span class="p">[[</span><span class="m">2</span><span class="p">]][[</span><span class="m">1</span><span class="p">]]</span><span class="w">
     </span><span class="p">[,</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="p">[,</span><span class="m">2</span><span class="p">]</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">,]</span><span class="w">  </span><span class="m">100</span><span class="w">    </span><span class="m">0</span><span class="w">
</span><span class="p">[</span><span class="m">2</span><span class="p">,]</span><span class="w">  </span><span class="m">101</span><span class="w">    </span><span class="m">0</span><span class="w">
</span><span class="p">[</span><span class="m">3</span><span class="p">,]</span><span class="w">  </span><span class="m">101</span><span class="w">    </span><span class="m">1</span><span class="w">
</span><span class="p">[</span><span class="m">4</span><span class="p">,]</span><span class="w">  </span><span class="m">100</span><span class="w">    </span><span class="m">1</span><span class="w">
</span><span class="p">[</span><span class="m">5</span><span class="p">,]</span><span class="w">  </span><span class="m">100</span><span class="w">    </span><span class="m">0</span><span class="w">

</span><span class="o">$</span><span class="n">coordinates</span><span class="p">[[</span><span class="m">2</span><span class="p">]][[</span><span class="m">2</span><span class="p">]]</span><span class="w">
      </span><span class="p">[,</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="p">[,</span><span class="m">2</span><span class="p">]</span><span class="w">
</span><span class="p">[</span><span class="m">1</span><span class="p">,]</span><span class="w"> </span><span class="m">100.2</span><span class="w">  </span><span class="m">0.2</span><span class="w">
</span><span class="p">[</span><span class="m">2</span><span class="p">,]</span><span class="w"> </span><span class="m">100.8</span><span class="w">  </span><span class="m">0.2</span><span class="w">
</span><span class="p">[</span><span class="m">3</span><span class="p">,]</span><span class="w"> </span><span class="m">100.8</span><span class="w">  </span><span class="m">0.8</span><span class="w">
</span><span class="p">[</span><span class="m">4</span><span class="p">,]</span><span class="w"> </span><span class="m">100.2</span><span class="w">  </span><span class="m">0.8</span><span class="w">
</span><span class="p">[</span><span class="m">5</span><span class="p">,]</span><span class="w"> </span><span class="m">100.2</span><span class="w">  </span><span class="m">0.2</span><span class="w">

</span>

<span class="w">
</span><span class="c1"># INPUT IS A URL (beginning from http..)
</span><span class="w">
</span><span class="n">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"https://raw.githubusercontent.com/mlampros/DataSets/master/california.geojson"</span><span class="w">

</span><span class="n">url_js</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">FROM_GeoJson</span><span class="p">(</span><span class="n">url_file_string</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">url_path</span><span class="p">)</span><span class="w">

</span><span class="n">str</span><span class="p">(</span><span class="n">url_js</span><span class="p">)</span><span class="w">

</span><span class="n">Warning</span><span class="w"> </span><span class="n">message</span><span class="o">:</span><span class="w">
</span><span class="n">closing</span><span class="w"> </span><span class="n">unused</span><span class="w"> </span><span class="n">connection</span><span class="w"> </span><span class="m">3</span><span class="w"> </span><span class="p">(</span><span class="n">https</span><span class="o">://</span><span class="n">raw.githubusercontent.com</span><span class="o">/</span><span class="n">mlampros</span><span class="o">/</span><span class="n">DataSets</span><span class="o">/</span><span class="n">master</span><span class="o">/</span><span class="n">california.geojson</span><span class="p">)</span><span class="w"> 

</span>
<span class="w">
</span><span class="n">List</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="m">4</span><span class="w">
 </span><span class="o">$</span><span class="w"> </span><span class="n">geometry</span><span class="w">  </span><span class="o">:</span><span class="n">List</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="m">2</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">type</span><span class="w">       </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"MultiPolygon"</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">coordinates</span><span class="o">:</span><span class="n">List</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="m">11</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">56</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">64</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">36</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">24</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-120</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">16</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">42</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">48</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-119</span><span class="w"> </span><span class="m">-118</span><span class="w"> </span><span class="m">-118</span><span class="w"> </span><span class="m">-118</span><span class="w"> </span><span class="m">-118</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">11</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">11</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-123</span><span class="w"> </span><span class="m">-123</span><span class="w"> </span><span class="m">-123</span><span class="w"> </span><span class="m">-123</span><span class="w"> </span><span class="m">-123</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">9</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="m">-122</span><span class="w"> </span><span class="n">...</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">1154</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">-124</span><span class="w"> </span><span class="m">-124</span><span class="w"> </span><span class="m">-124</span><span class="w"> </span><span class="m">-124</span><span class="w"> </span><span class="m">-124</span><span class="w"> </span><span class="n">...</span><span class="w">
 </span><span class="o">$</span><span class="w"> </span><span class="n">id</span><span class="w">        </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"california"</span><span class="w">
 </span><span class="o">$</span><span class="w"> </span><span class="n">properties</span><span class="o">:</span><span class="n">List</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="m">11</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">abbreviation</span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"CA"</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">area</span><span class="w">        </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="m">423968</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">capital</span><span class="w">     </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"Sacramento"</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">city</span><span class="w">        </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"Los Angeles"</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">group</span><span class="w">       </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"US States"</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">houseseats</span><span class="w">  </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="m">53</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">landarea</span><span class="w">    </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="m">403466</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">name</span><span class="w">        </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"California"</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">population</span><span class="w">  </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="m">38332521</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">statehood</span><span class="w">   </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"1850-09-09"</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="n">waterarea</span><span class="w">   </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="m">20502</span><span class="w">
 </span><span class="o">$</span><span class="w"> </span><span class="n">type</span><span class="w">      </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"Feature"</span><span class="w">

</span>
TO_GeoJson

The TO_GeoJson function is an R6 class, which takes as input a vector (in case of a Point) or a list (in case of the rest geometry objects) and converts it to a GeoJson object (named list). The output can also include the data in form of a geojson character string if the argument stringify is TRUE. The following code chunk shows the output for a polygon with interior rings,

<span class="w">
</span><span class="n">init</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">TO_GeoJson</span><span class="o">$</span><span class="n">new</span><span class="p">()</span><span class="w">

</span><span class="n">polygon_WITH_dat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">list</span><span class="p">(</span><span class="nf">list</span><span class="p">(</span><span class="nf">c</span><span class="p">(</span><span class="m">100</span><span class="p">,</span><span class="w"> </span><span class="m">1.01</span><span class="p">),</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="m">200</span><span class="p">,</span><span class="w"> </span><span class="m">2.01</span><span class="p">),</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="m">100</span><span class="p">,</span><span class="w"> </span><span class="m">1.0</span><span class="p">),</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="m">100</span><span class="p">,</span><span class="w"> </span><span class="m">1.01</span><span class="p">)),</span><span class="w">

                        </span><span class="nf">list</span><span class="p">(</span><span class="nf">c</span><span class="p">(</span><span class="m">50</span><span class="p">,</span><span class="w"> </span><span class="m">0.5</span><span class="p">),</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="m">50</span><span class="p">,</span><span class="w"> </span><span class="m">0.8</span><span class="p">),</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="m">50</span><span class="p">,</span><span class="w"> </span><span class="m">0.9</span><span class="p">),</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="m">50</span><span class="p">,</span><span class="w"> </span><span class="m">0.5</span><span class="p">)))</span><span class="w">

</span><span class="n">polygon_with</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">init</span><span class="o">$</span><span class="n">Polygon</span><span class="p">(</span><span class="n">polygon_WITH_dat</span><span class="p">,</span><span class="w"> </span><span class="n">stringify</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">

</span><span class="n">str</span><span class="p">(</span><span class="n">polygon_with</span><span class="p">)</span><span class="w">

</span>
<span class="w">
</span><span class="n">List</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="m">3</span><span class="w">
 </span><span class="o">$</span><span class="w"> </span><span class="n">json_dump</span><span class="w">  </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"{\"coordinates\": [[[100, 1.01], [200, 2.0099999999999998], [100, 1], [100, 1.01]], [[50, 0.5], [50, 0.80000000000000004], [50,"</span><span class="o">|</span><span class="w"> </span><span class="err">__</span><span class="n">truncated__</span><span class="w">
 </span><span class="o">$</span><span class="w"> </span><span class="n">type</span><span class="w">       </span><span class="o">:</span><span class="w"> </span><span class="n">chr</span><span class="w"> </span><span class="s2">"Polygon"</span><span class="w">
 </span><span class="o">$</span><span class="w"> </span><span class="n">coordinates</span><span class="o">:</span><span class="n">List</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="m">2</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="n">List</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="m">4</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="m">1.01</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">200</span><span class="w"> </span><span class="m">2.01</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="m">1</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="m">1.01</span><span class="w">
  </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="n">List</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="m">4</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">50</span><span class="w"> </span><span class="m">0.5</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">50</span><span class="w"> </span><span class="m">0.8</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">50</span><span class="w"> </span><span class="m">0.9</span><span class="w">
  </span><span class="n">..</span><span class="w"> </span><span class="n">..</span><span class="o">$</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">num</span><span class="w"> </span><span class="p">[</span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">]</span><span class="w"> </span><span class="m">50</span><span class="w"> </span><span class="m">0.5</span><span class="w">

</span>
<span class="w">
</span><span class="c1"># if "stringify = TRUE"
</span><span class="w">
</span><span class="n">cat</span><span class="p">(</span><span class="n">polygon_with</span><span class="o">$</span><span class="n">json_dump</span><span class="p">)</span><span class="w">

</span><span class="p">{</span><span class="s2">"coordinates"</span><span class="o">:</span><span class="w"> </span><span class="p">[[[</span><span class="m">100</span><span class="p">,</span><span class="w"> </span><span class="m">1.01</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">200</span><span class="p">,</span><span class="w"> </span><span class="m">2.0099999999999998</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">100</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">100</span><span class="p">,</span><span class="w"> </span><span class="m">1.01</span><span class="p">]],</span><span class="w"> </span><span class="p">[[</span><span class="m">50</span><span class="p">,</span><span class="w"> </span><span class="m">0.5</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">50</span><span class="p">,</span><span class="w"> </span><span class="m">0.80000000000000004</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">50</span><span class="p">,</span><span class="w"> </span><span class="m">0.90000000000000002</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">50</span><span class="p">,</span><span class="w"> </span><span class="m">0.5</span><span class="p">]]],</span><span class="w"> </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Polygon"</span><span class="p">}</span><span class="w">

</span>

The package documentation includes examples on how to build geojson objects for all geometries ( Point, MultiPoint, LineString, MultiLineString, Polygon (with or without interior rings), MultiPolygon, GeometryCollection, Feature and FeatureCollection ).

Dump_From_GeoJson

The Dump_From_GeoJson function returns a GeoJson character string (GeoJson-dump) for a file or url. The following code excerpt shows the output for the previously mentioned feature_collection.geojson file,

<span class="w">
</span><span class="n">dump_js</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Dump_From_GeoJson</span><span class="p">(</span><span class="n">url_file</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"feature_collection.geojson"</span><span class="p">)</span><span class="w">

</span><span class="n">cat</span><span class="p">(</span><span class="n">dump_js</span><span class="p">)</span><span class="w">

</span>
<span class="w">
</span><span class="p">{</span><span class="s2">"features"</span><span class="o">:</span><span class="w"> </span><span class="p">[{</span><span class="s2">"geometry"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="s2">"coordinates"</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="m">102</span><span class="p">,</span><span class="w"> </span><span class="m">0.5</span><span class="p">],</span><span class="w"> </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Point"</span><span class="p">},</span><span class="w"> </span><span class="s2">"properties"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="s2">"prop0"</span><span class="o">:</span><span class="w"> </span><span class="s2">"value0"</span><span class="p">},</span><span class="w"> </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Feature"</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="s2">"geometry"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="s2">"coordinates"</span><span class="o">:</span><span class="w"> </span><span class="p">[[</span><span class="m">102</span><span class="p">,</span><span class="w"> </span><span class="m">0</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">103</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">104</span><span class="p">,</span><span class="w"> </span><span class="m">0</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">105</span><span class="p">,</span><span class="w"> </span><span class="m">1</span><span class="p">]],</span><span class="w"> </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"LineString"</span><span class="p">},</span><span class="w"> </span><span class="s2">"properties"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="s2">"prop0"</span><span class="o">:</span><span class="w"> </span><span class="s2">"value0"</span><span class="p">,</span><span class="w"> </span><span class="s2">"prop1"</span><span class="o">:</span><span class="w"> </span><span class="m">0</span><span class="p">},</span><span class="w"> </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Feature"</span><span class="p">}],</span><span class="w"> </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"FeatureCollection"</span><span class="p">}</span><span class="w">

</span>

The same applies to url files beginning from http...

Features_2Collection

The aim of the Features_2Collection function is to take a vector of valid path’s / url’s of Feature object files as input and to return a Feature Collection. For instance, if I have the following two files (“Feature1.geojson”, “Feature2.geojson”),

<span class="w">
</span><span class="c1"># "Feature1.geojson"
</span><span class="w">
</span><span class="p">{</span><span class="w">
 </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Feature"</span><span class="p">,</span><span class="w">
 
 </span><span class="s2">"id"</span><span class="o">:</span><span class="w"> </span><span class="m">1</span><span class="p">,</span><span class="w">
 
 </span><span class="s2">"bbox"</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="m">-10.0</span><span class="p">,</span><span class="w"> </span><span class="m">-10.0</span><span class="p">,</span><span class="w"> </span><span class="m">10.0</span><span class="p">,</span><span class="w"> </span><span class="m">10.0</span><span class="p">],</span><span class="w">
 
 </span><span class="s2">"geometry"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w">
 
    </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Polygon"</span><span class="p">,</span><span class="w">
    
    </span><span class="s2">"coordinates"</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="w">
    
         </span><span class="p">[</span><span class="w">
            </span><span class="p">[</span><span class="m">-10.0</span><span class="p">,</span><span class="w"> </span><span class="m">-10.0</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">10.0</span><span class="p">,</span><span class="w"> </span><span class="m">-10.0</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">10.0</span><span class="p">,</span><span class="w"> </span><span class="m">10.0</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">-10.0</span><span class="p">,</span><span class="w"> </span><span class="m">-10.0</span><span class="p">]</span><span class="w">
         </span><span class="p">]</span><span class="w">
      </span><span class="p">]</span><span class="w">
    </span><span class="p">},</span><span class="w">

    </span><span class="s2">"properties"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w">
  
      </span><span class="s2">"prop_1"</span><span class="o">:</span><span class="w"> </span><span class="s2">"addr1"</span><span class="p">,</span><span class="w">
  
      </span><span class="s2">"prop_2"</span><span class="o">:</span><span class="w"> </span><span class="m">1</span><span class="w">
    </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">

</span>

<span class="w">
</span><span class="c1"># "Feature2.geojson"
</span><span class="w">
</span><span class="p">{</span><span class="w">
 </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Feature"</span><span class="p">,</span><span class="w">
 
 </span><span class="s2">"id"</span><span class="o">:</span><span class="w"> </span><span class="m">2</span><span class="p">,</span><span class="w">
 
 </span><span class="s2">"bbox"</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="m">-10.0</span><span class="p">,</span><span class="w"> </span><span class="m">-10.0</span><span class="p">,</span><span class="w"> </span><span class="m">10.0</span><span class="p">,</span><span class="w"> </span><span class="m">10.0</span><span class="p">],</span><span class="w">
 
 </span><span class="s2">"geometry"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w">
 
    </span><span class="s2">"type"</span><span class="o">:</span><span class="w"> </span><span class="s2">"Polygon"</span><span class="p">,</span><span class="w">
    
    </span><span class="s2">"coordinates"</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="w">
    
         </span><span class="p">[</span><span class="w">
            </span><span class="p">[</span><span class="m">-10.0</span><span class="p">,</span><span class="w"> </span><span class="m">-10.0</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">10.0</span><span class="p">,</span><span class="w"> </span><span class="m">-10.0</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">10.0</span><span class="p">,</span><span class="w"> </span><span class="m">10.0</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="m">-10.0</span><span class="p">,</span><span class="w"> </span><span class="m">-10.0</span><span class="p">]</span><span class="w">
         </span><span class="p">]</span><span class="w">
      </span><span class="p">]</span><span class="w">
    </span><span class="p">},</span><span class="w">

    </span><span class="s2">"properties"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w">
  
      </span><span class="s2">"prop_1"</span><span class="o">:</span><span class="w"> </span><span class="s2">"addr2"</span><span class="p">,</span><span class="w">
  
      </span><span class="s2">"prop_2"</span><span class="o">:</span><span class="w"> </span><span class="m">2</span><span class="w">
    </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">

</span>

then the output of the function will be a Feature Collection dump,

<span class="w">
</span><span class="n">vec_in</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="s2">"Feature1.geojson"</span><span class="p">,</span><span class="w"> </span><span class="s2">"Feature2.geojson"</span><span class="p">)</span><span class="w">

</span><span class="n">res_fcol</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Features_2Collection</span><span class="p">(</span><span class="n">vec_in</span><span class="p">,</span><span class="w"> </span><span class="n">bbox_vec</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">NULL</span><span class="p">)</span><span class="w">

</span><span class="n">cat</span><span class="p">(</span><span class="n">res_fcol</span><span class="p">)</span><span class="w">

</span>
<span class="w">
</span><span class="p">{</span><span class="s2">"bbox"</span><span class="o">:</span><span class="w"> </span><span class="p">[],</span><span class="w"> </s...

To leave a comment for the author, please follow the link and comment on their blog: mlampros.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)