Search code examples
javascriptimportexportgeojsonarcgis

How to turn URL into downloadable GeoJSON file


I'm trying to take a URL like this one:

https://a.mapillary.com/v3/images?client_id=Q2ZpVVBEYXFreDFRalB6Z0J5dWRtVzphNjlkMDVjZWMzMWIxMzNj&closeto=-87.59220807169899,41.769205512917&radius=1000

and turn the resulting GeoJSON file into something that can be imported into ArcGIS Online, or something similar.

I'm stuck, and would appreciate any help. Thanks. I am very new to all of this, and have been trying to accomplish this using JavaScript.


Solution

  • You can do that by creating an anchor tag (<a>) with a download attribute. The documentation at MDN define the behavior of the attribute as such.

    Prompts the user to save the linked URL instead of navigating to it. Can be used with or without a value:

    <a download href="https://a.mapillary.com/v3/images?client_id=Q2ZpVVBEYXFreDFRalB6Z0J5dWRtVzphNjlkMDVjZWMzMWIxMzNj&closeto=-87.59220807169899,41.769205512917&radius=1000" >Download</a>

    The download attribute can be empty or hold a value. This value can be the name of the file that the user will download, for example your situation: download="locations.json".