I downloaded a geojson.gz that I'd like to view and inspect. I have Python installed, but I don't want to use it to read the file. What's the command line to gzip it into the same folder? Thanks.
Solved! Go to Solution.
I'm not sure you want this on the Python forum if you don't want to use Python, but from the command line, if you're working on MacOS or Linux, you can use the command `gunzip`. You'll need to install the same on Windows, or use a tool like 7-zip to extract the content. For future readers who may want to use Python, a solution could look something like this:
import gzip import shutil with gzip.open('geojson.gz', 'rb') as gz_in: with open('geo.json', 'wb') as json_out: shutil.copyfileobj(gz_in, json_out)
I'm not sure you want this on the Python forum if you don't want to use Python, but from the command line, if you're working on MacOS or Linux, you can use the command `gunzip`. You'll need to install the same on Windows, or use a tool like 7-zip to extract the content. For future readers who may want to use Python, a solution could look something like this:
import gzip import shutil with gzip.open('geojson.gz', 'rb') as gz_in: with open('geo.json', 'wb') as json_out: shutil.copyfileobj(gz_in, json_out)
Thanks @ShaunWalbridge, what I meant was that I didn't want to use Python to view and inspect the extracted files. I used 7-zip to extract locally in Windows, but I asked because I thought that gzip could have been used instead to do the same.