Install jpndistrict on CentOS 7

jpndistrict is a convenient R package for plotting administrative districts in Japan. I was advised that it would be convenient, so I decided to use it, but it was quite difficult to install. In the end, the installation was successful and I realized that it was a useful tool, so I will write an article so that I can help with the installation when I recommend it to others.

The usage of jpndistrict itself is not explained. Please refer to the Official Page for details.


CentOS 7 R version 3.6.0


First, simply try installing jpndistrict on R. If it is not CentOS 7 such as ubuntu, this will probably work (see below).


If you get the following error during installation, install the requested package and try again.

configure: error: 
  Configuration failed because was not found. Try installing:
    * deb: libudunits2-dev (Debian, Ubuntu, ...)
    * rpm: udunits2-devel (Fedora, EPEL, ...)
    * brew: udunits (OSX)
  If udunits2 is already installed in a non-standard location, use:
  if the library was not found, and/or:
  if the header was not found, replacing paths with appropriate values.
  You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.

Since my OS is CentOS 7, install udunits2-devel and try again. But it failed.

Why CentOS 7 doesn't work


* installing *source* package ‘sf’ ...
**Successfully unzipped package ‘sf’ and verified MD5 thumb
** using staged installation
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64 -std=gnu++11
checking for gdal-config... no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’

checking for gdal-config... no

I was told that I installed GDAL by referring to here, but

configure: GDAL: 1.11.4
checking GDAL version >= 2.0.1... no
configure: error: sf is not compatible with GDAL versions below 2.0.1
ERROR: configuration failed for package ‘sf’

I have been told that the version of GDAL is old.

yum info gdal

name: gdal
architecture: x86_64
version: 1.11.4
release: 3.el7
capacity: 276 k
Repository: epel/x86_64
wrap up: GIS file format library
URL                 :
license: MIT
Explanation: Geospatial Data Abstraction Library (GDAL/OGR) is a cross
                    : platform C++ translator library for raster and vector
                    : geospatial data formats. As a library, it presents a single
                    : abstract data model to the calling application for all
                    : supported formats. It also comes with a variety of useful
                    : commandline utilities for data translation and processing.
                    : It provides the primary data access engine for many
                    : applications. GDAL/OGR is the most widely used geospatial data
                    : access library.

The latest version that can be installed with yum (using EPEL repository) is 1.11.4

apt info gdal-bin

Package: gdal-bin
Version: 3.0.4+dfsg-1build3
Priority: optional
Section: universe/science
Source: gdal
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian GIS Project <[email protected]>
Installed-Size: 1369 kB
Depends: python3-gdal (= 3.0.4+dfsg-1build3), python3-numpy (>= 1:1.16.0~rc1), python3-numpy-abi9, python3:any, libc6 (>= 2.15), libgcc-s1 (>= 3.0), libgdal26 (>= 3.0.0), libstdc++6 (>= 5.2)
Suggests: libgdal-grass
Breaks: gdal-bin (<< 1.10.0-0~), python-gdal (<< 2.4.3~)
Replaces: python-gdal (<< 2.4.3~)
Download-Size: 256 kB
APT-Sources: focal/universe amd64 Packages
Description: Geospatial Data Abstraction Library - Utility programs

The GDAL that can be installed with apt (ubuntu) was 3.0.4.

So, if the version of the package registered in the repository is an older CentOS 7, If you want to install jpndistrict (sf package required by) ** You need to build from source and install GDAL without using yum **. Furthermore, if you install PROJ, which is necessary to run GDAL, from yum, the version is old.

yum info proj

name: proj
architecture: x86_64
version: 4.8.0
release: 4.el7
capacity: 181 k
Repository: epel/x86_64
wrap up: Cartographic projection software (PROJ.4)
URL                 :
license: MIT
Explanation: Proj and invproj perform respective forward and inverse
                    : transformation of cartographic data to or from cartesian data
                    : with a wide range of selectable projection functions.

You can install with yum 4.8.0 and now you need 6.0.0 or above

In short, you need to install "** PROJ " to install " GDAL " to install " sf " to install " jpndistrict **" .. Depressed.

Which version should be included

At least the required version GDAL >= 2.0.1 PROJ >= 6.0.0 GEOS >= 3.4.0

The latest version that can be installed with yum GDAL : 1.11.4 PROJ : 4.8.0 GEOS : 3.4.2

After trying various things, when installing sf on CentOS 7

It worked well if I installed it first.

** GDAL ** has the latest version as of the time of article creation (2020/11/18).

When ** PROJ ** tried to install the latest version 7.2.0, it was necessary to upgrade SQLite3 additionally, and it would be a part of yum's system, so I gave up thinking that it was a high risk. However, even if I installed 6.0.0, which is the oldest version that can be used and does not require an upgrade of SQLite, the subsequent installation of the tool failed probably because the versions of GDAL and PROJ are too far apart. After trying various versions, the installation was successful with 6.1.1. reference [How to update SQLite3] The link destination is Amazon Linux 2, but I heard that OS base is like RHEL 7 / CentOS 7, so it's helpful. I made it.

** GEOS ** seems to be okay with a version that can be installed with yum, but I thought that it would be a problem if the version is too far from GDAL like PROJ and an error occurs, so I installed the latest version.

Installation (for CentOS 7)

Install in the order of PROJ → GEOS → GDAL

For both installation methods, unzip the downloaded file and

make install

Installation is successful if the above three commands are passed

After installation, start R


Type jpndistrict installation (sf is also installed).

Load the package,


This package provide map data is based on the Digital Map 25000 (Map
Image) published by Geospatial Information Authority of Japan (Approval
No.603FY2017 information usage <>)

If it appears, the installation is successful.

Error that appears (if it doesn't appear, you can ignore it)

sqlite3 not found

Occurs when configuring PROJ

checking for SQLITE3... configure: error: Package requirements (sqlite3 >= 3.7) were not met:

No package 'sqlite3' found

I confirmed it, but it's there

sqlite3 --version

Solution: Install sqlite-devel

yum install sqlite-devel

pcs.csv cannot be read

Occurs during sf installation

checking GDAL: /usr/local/share/gdal/pcs.csv readable... no

I checked the location of the path, but pcs.csv did not exist.

Solution: Search on the net and install under "/ usr / local / share / gdal /"

PROJ not available

Occurs during sf installation

checking GDAL: checking whether PROJ is available fur running:... ./gdal_proj: error while loading shared libraries: cannot open shared object file: No such file or directory
configure: error: OGRCoordinateTransformation() does not return a coord.trans: PROJ not available?
ERROR: configuration failed for package ‘sf’

Solution: Exit R and then go to /etc/


Addition (If libgdal-x86_64.conf does not exist, create a new one and write the above contents).



After executing, start R and try the installation again.


After installation


When you hit

ERROR while rich displaying an object: Error in loadNamespace(name): there is no package called ‘geojsonio’

If you get an error, install geojsonio.


If no error occurs, the jpndistrict usage environment is complete.

As an operation test, let's display the location of the government office in Hokkaido.

pref01 = jpn_pref(admin_name = "Hokkaido") # Hokkaidoの地形データ
df_office01 = jpn_admins(1) #Location of the government office in Hokkaido

#Creating a canvas
ggplot() +
#Draw terrain
geom_sf(data = pref01, aes(fill = city)) +
#Plot points
geom_sf(data = df_office01, color = "white", size=0.8) +
theme(legend.position = 'none')


Visualizing the coordinates made it possible to predict the mountains from the location of the government office, which was an interesting result.

in conclusion

The old packages that can be installed with yum made me messed up. It's been a year since CentOS 8 was released, and maybe it's time to upgrade.

Recommended Posts

Install jpndistrict on CentOS 7
Install Golang on CentOS 8
Install Neo4j 4.1.3 on centOS
Install Vertica 10.0 on CentOS 6.10
Install PostgreSQL 12 on Centos8
Install nginx on centOS7
Install Python 3 on CentOS 7
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install Redmine 4.1.1 on CentOS 7
Smokeping Install on CentOS7
Install PostgreSQL 13 on CentOS 7.5
Install OpenFOAM v2006 on CentOS
Install Jenkins on Docker's CentOS
Install Apache on CentOS on VirtualBox
Install Ruby 2.7 on CentOS 7 (SCL)
Try DPDK20 SDK on CentOS7 ①Install
Install Ruby 2.5 on CentOS 7 using SCL
Install Java Open JDK 8 on CentOS 7
How to install MariaDB 10.4 on CentOS 8
Install apache 2.4.46 from source on CentOS7
Steps to install MySQL 8 on CentOS 8
Steps to install devtoolset-6 on CentOS 7
Install Java 9 on windows 10 and CentOS 7
Install MariaDB (CentOS 8)
[CentOS] Install apache-loggen
OpenVPN on CentOS 8
Install the webmail client Rainloop on CentOS 8
How to install beta php8.0 on CentOS8
Install CentOS 7 on Raspberry pi 4 Model B
Install NextCloud on CentOS 7 with Alibaba Cloud ECS
Install gradle on mac
Command to install nginx / PHP7 / php-fpm on CentOS7
Maven on CentOS 7 tutorial
Install OpenJDK on macOS
Install Java on Mac
Docker installation on CentOS 6
Use perltidy on CentOS 8
Install pyqt5 on ubuntu
Try OpenLiteSpeed on CentOS8
Tomcat v8 on CentOS7
[CentOS7] Install aws cli
Zabbix 5 installation on CentOS 8
Use mod_auth_cas on CentOS 8
Install GitLab on CentOS 8 with no internet connection
Use bat on Centos.
Jetty v8 on CentOS7
Install Autoware on Ubuntu 18.04.5
OpenJDK installation on CentOS 7
Install openjdk11 on mac
Install Homebrew on Ubuntu 20.04
Install CMS Made Simple v2.2.2 on LAMP on CentOS 7.3
Install OpenJDK 8 on mac
Install BookStack Documentation Wiki on Elastic Compute Service on CentOS 7
Install the latest hardware drivers from ELRepo on CentOS
Install MySQL 5.6 on CentOS6 [How to specify the version]
Install ag (the silver searcher) [on CentOS / Ubuntu / Mac]
Try RabbitMQ + PHP on CentOS
Install Docker on Raspberry Pi
Install Docker on Windows 10 PRO
Network install CentOS 8 with Kickstart.