topojson keep and remove properties - topojson

How to run the below command to remove properties? When I install topojson the executable I get is geo2topo. The command topojson is unrecognised. So, how to run the below command with geo2topo.
topojson --id-property adm1_cod_1 -p name -o states_jpn.topo.json states_jpn.json

Related

openBinaryFile: does not exist when executing pandoc in Gitlab CI bash script

I am getting this error:
pandoc: sh: openBinaryFile: does not exist (No such file or directory)
when trying to build some assets with Pandoc in a Gitlab CI bash script.
I have a repo, Finnito/Science, that is serving a Gitlab Pages site using Hugo. I am trying to set up a Gitlab CI pipeline to build my HTML slides and PDFs docs from my Markdown source when I commit to the repo so that I don't have to build them locally.
I have been trying out different Docker images of pandoc but decided pandoc/latex is my best bet because it's "official" and built on Alpine which is nice and lightweight. But I can't seem to make heads or tails of this error.
I have tried various different incantations for pandoc but they don't seem to work.
My Gitlab CI job looks like this:
assets:
image: pandoc/latex
script:
- chmod +x ci-build.sh
- sh ci-build.sh
and my ci-build.sh script looks like this:
#!/bin/sh
modulesToBuild=(
"/builds/Finnito/science/content/10sci/5-fire-and-fuels"
"/builds/Finnito/science/content/10scie/6-geology"
"/builds/Finnito/science/content/11sci/4-mechanics"
"/builds/Finnito/science/content/11sci/5-genetics"
"/builds/Finnito/science/content/12phy/2-mechanics"
"/builds/Finnito/science/content/12phy/3-electricity"
)
for i in "${modulesToBuild[#]}"; do
# Navigate to the directory.
cd $i
# Build the HTML slides and
# PDFs for all markdown docs.
for filename in markdown/*.md; do
file=${filename##*/}
name=${file%%.*}
pandoc/latex pandoc -s --mathjax -i -t revealjs "markdown/$name.md" -o "$name.html"
pandoc/latex pandoc "markdown/$name.md" -o "$name.pdf" --pdf-engine=pdflatex
done
done
Honestly, I'm just pretty lost with how to successfully call pandoc within the Docker container. I am very new to this and it all makes very little sense!
Any help would be most appreciated!
The image has /usr/bin/pandoc set as an entry point. This means that one doesn't has to specify the pandoc command when running the container; providing a command it will cause pandoc to try to read an input file with the name of the given command, which causes the error you are seeing.
For a while, images used a custom entrypoint script which tried to detect if a different binary should be executed. But this was reverted as it proved unreliable and confusing.

Why is Pandoc not converting a .tex to .pdf but will convert the .md fine?

I have a number of Markdown files which I am converting to PDF using Pandoc - including folding in some header files with LaTeX options.
This works if I create the PDF in a single step (MD → PDF), however, I need to perform some additional steps on the intermediate LaTeX file so I am trying to split the Pandoc process into two steps (MD → TEX → PDF) - which produces an "Undefined Control Sequence" error.
I have compared the .tex file produced by one-step-Pandoc with the two-step version and they are identical - including the relevant \usepackage commands for the LaTeX packages that produce the error.
I am running on Windows, and have updated Pandoc to 2.7.3 and updated all my MiKTeX packages this morning.
Minimal test files that produce this error:
test.md:
% Title
% Author
% Date
Body text
title.tex
\setmainfont{Times New Roman}\fontsize{11pt}{11pt}\selectfont
\sectionfont{
\setmainfont{Arial}
\fontsize{32pt}{32pt}
\selectfont
}
When I use a single step command, the PDF produces correctly without issue:
> pandoc test.md options.yaml -o test.pdf -f markdown+smart+tex_math_dollars -s -V block-headings -H fontoptions.tex -B title.tex -B title_logo.tex -B header.tex --pdf-engine=lualatex
lualatex: warning: running with administrator privileges
lualatex: warning: running with administrator privileges
lualatex: warning: running with administrator privileges
When run in two steps:
> pandoc test.md options.yaml -o test.tex -f markdown+smart+tex_math_dollars -s -V block-headings -H fontoptions.tex -B title.tex -B title_logo.tex -B header.tex
> pandoc test.tex -o test.pdf -f latex --pdf-engine=lualatex
lualatex: warning: running with administrator privileges
lualatex: warning: running with administrator privileges
lualatex: warning: running with administrator privileges
Error producing PDF.
! Undefined control sequence.
l.81 \sectionfont
The second step should simply be:
> lualatex test.tex
By using pandoc to go from LaTeX to PDF you potentially lose information (because pandoc cannot represent all of TeX and more importantly, pandoc will use it's own template.)

Where in the world is my pandoc directory?

I am trying to add a custom latex template for pandoc
I know that pandoc templates go in ~/.pandoc/templates
and I confirmed the pandoc directory location by typing pandoc --v - it says pandoc is in ~/.pandoc
but when I do cd ~/.pandoc:
-bash: cd: /Users/[Name]/.pandoc: No such file or directory
According the pandoc man page I can set a different path for pandoc data files using --data-dir=DIRECTORY, but when I try build a file this way, e.g.
pandoc file.md -o file.pdf --data-dir=~/Library/texmf/tex/latex --template=mytemplate.latex
it throws the error
pandoc: Could not find data file templates/mytemplate.latex
which I assume means the data directory command is ignored.
Why can't I access my pandoc directory?
You are indeed expected to create the ~/.pandoc directory if it doesn't exist already. For example for a default latex template:
mkdir -p ~/.pandoc/templates
pandoc -D latex > ~/.pandoc/templates/default.latex
The --template option looks for files relative to the current directory (pwd), or "if not found, pandoc will search for it in the templates subdirectory of the user data directory" (~/.pandoc/templates for --data-dir=~/.pandoc, which is the default).
Which is where your error comes from as there's probably no file /Library/texmf/tex/latex/templates/mytemplate.latex.

shapeit command not found - shapeit installation for GWAS phasing

I would like to install the shapeit for GWAS phasing and impuation. I downloaded the Shapeit version for macos from Shapeit website:
https://mathgen.stats.ox.ac.uk/genetics_software/shapeit/shapeit.html#download
I extracted the file and got the shapeit execuable file, example folder, and licience file.
Next, I open the terminal in Mac, cd the directory to shapeit folder and type the command line as the website guided:
shapeit -B gwas \
-M genetic_map.txt \
-O gwas.phased
And I got the response:
shapeit command not found.
I guess that means i need to install the shapeit or set a path for shapeit. But I don't know how to do. I am very new with Macos.
Could someone help me ?
Try ./shapeit instead of shapeit, or
Run cp shapeit /usr/local/bin first and try again.

How to customize the docker gcc command and add own path instead of /usr/src

I'm trying to compile a C file named test.c using docker's gcc container.
I'm using the following command, I have put the test.c in my homein ubuntu.
sudo docker run -v /home/moomal/workspace/FypProject/WebContent/file/:/myapp.c:ro gcc:4.9 sh -c "gcc -o myapp /home/moomal/workspace/FypProject/WebContent/file/myapp.c; ./myapp"
It works cool, but, I want to change the folder from home to a folder inside my eclipse web project folder. I have an editor on a web page and then on compile it creates a test.c file inside a folder. I want to access that file.
I tried adding the path like /home/moomal/workspace/FypProject/WebContent/file but I get the error
gcc: error: /home/moomal/workspace/FypProject/WebContent/file/myapp.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
sh: 1: ./myapp: not found
You seem to be confused about several things here.
The -v HOST_PATH:CON_PATH argument can be used to mount files inside a container, as you seem to be attempting. The HOST_PATH can be a file or a directory. The CON_PATH determines where that file or directory will be in the container. In your case, I think you want:
-v /home/moomal/workspace/FypProject/WebContent/file/myapp.c:/myapp.c
Not just ...file/:/myapp.c. I'm not sure what you expected your version to do (how can a directory be mapped to a file?).
Also, in the shell command you give the path on the host, but as this is processed in the container, you need the path in the container i.e:
gcc -o myapp /myapp.c
Putting it together, I would expect to see something like:
sudo docker run -v /home/moomal/workspace/FypProject/WebContent/file/myapp.c:/myapp.c:ro gcc:4.9 sh -c "gcc -o myapp /myapp.c; ./myapp"

Resources