[Qgis-us-user] Converting from Shapefile to JSON format with geometry features.

Keith Jenkins kgj2 at cornell.edu
Fri Jul 23 12:29:37 PDT 2021


Hi, Carl.

You can use ogr2ogr on the command line like this:

ogr2ogr -f "GeoJSON" -dialect SQLite -sql "select ST_Buffer(geometry,
0.01) from inputfile" output.geojson inputfile.shp

substituting your filename for "inputfile" in both places.

QGIS uses OGR behind the scenes to handle most vector datasets, so it
should already be on your computer if installed QGIS.  For more
details about OGR, see https://gdal.org/programs/ogr2ogr.html

Cheers,
Keith


On Fri, Jul 23, 2021 at 2:37 PM Carl Reinemann <creinemann at gmail.com> wrote:
>
> Hello,
> I am Brand new to QGIS. I have a question on the conversion of a shapefile (.shp) to a geojson format.  I am using data produced by NOAA,NASA to map out on satellite imagery, current fire hotspots onto satellite imagery I receive and process at home.
>
> The data I download is from here
> https://firms.modaps.eosdis.nasa.gov/active_fire/    (I use the shp files)
>
> I have a small script that downloads it every 12 hours.
>
> I then use QGIS this way, to convert it into the type I need to apply it to my imagery.
>
> This is the current way I process it with QGIS 3.16.8
>
> 1. Add a vector layer and open the .shp file I want to convert.
> 2. Goto Vector-
>             -Geoprocessing Tools
>                   -Buffer
> 3. I then change the distance to .01
> 4. then I run the Buffer (this is to create the geometry I need, rather than point)
> 5. I then export the Buffered file "Save Features as"
>  --selecting GEOJSON
>     -saving it as a file.
>
> This works and provides me the data in the format I need.
>
> My questions this- Can this be done via a command line?
> I wish to use my PC to automate the process so that I can have it run in a batch file after the data download.
>
> I am open to other methods as well.
>
> An example of the imagery with the data applied is here.
> https://imgur.com/a/2OEU8tj
>
> Carl
> http://usradioguy.com
> _______________________________________________
> Qgis-us-user mailing list
> Qgis-us-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/qgis-us-user


More information about the Qgis-us-user mailing list