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

Michele M Tobias mmtobias at ucdavis.edu
Fri Jul 23 12:39:04 PDT 2021


Hi Carl,
You can script the whole workflow to do each step in succession if you'd like or the model builder might also be useful if you'd like a graphical tool.  There's good information about this in the QGIS user's manual here: https://docs.qgis.org/3.16/en/docs/user_manual/processing/index.html 

Michele

Michele Tobias, PhD
Geospatial Data Specialist
DataLab: Data Science & Informatics
Data & Digital Scholarship
UC Davis Library 

370 Shields Library
(530)752-7532
mmtobias at ucdavis.edu
ORCID: 0000-0002-2954-8710 

Pronouns: she, her, hers


-----Original Message-----
From: Qgis-us-user <qgis-us-user-bounces at lists.osgeo.org> On Behalf Of Keith Jenkins
Sent: Friday, July 23, 2021 12:30 PM
To: Carl Reinemann <creinemann at gmail.com>
Cc: qgis-us-user at lists.osgeo.org
Subject: Re: [Qgis-us-user] Converting from Shapefile to JSON format with geometry features.

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
_______________________________________________
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