---
title: "Memasang pustaka Geospatial"
version: 5.0
locale: id
source: https://docs.djangoproject.com/id/5.0/ref/contrib/gis/install/geolibs/
canonical: https://djangodocs.dev/id/5.0/ref/contrib/gis/install/geolibs/
---
# Memasang pustaka Geospatial

GeoDjango menggunakan dan/atau menyediakan antarmuka untuk pustaka geospatial sumber terbuka berikut:

| Program | Deskripsi | Dibutuhkan | Versi Didukung |
| --- | --- | --- | --- |
| [GEOS](/id/5.0/ref/contrib/gis/geos/) | Geometry Engine Open Source | Ya | 3.12, 3.11, 3.10, 3.9, 3.8 |
| [PROJ](https://proj.org/) | Pustaka Cartographic Projections | Ya (hanya PostgreSQL dan SQLite ) | 9.x, 8.x, 7.x, 6.x, 5.x |
| [GDAL](/id/5.0/ref/contrib/gis/gdal/) | Pustaka Abstrak Data Geospatial | Ya | 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.1, 3.0, 2.4 |
| [GeoIP](/id/5.0/ref/contrib/gis/geoip2/) | Pustaka geolokasi berdasarkan-IP | Tidak | 2 |
| [PostGIS](https://postgis.net/) | Tambahan spasial untuk PostgreSQL | Ya (hanya PostgreSQL) | 3.4, 3.3, 3.2, 3.1, 3.0, 2.5 |
| [SpatiaLite](https://www.gaia-gis.it/gaia-sins/) | Tambahan spasial untuk SQLite | Ya (hanya SQLite ) | 5.1, 5.0, 4.3 |

Catat bahwa terlama atau lebih versi saat ini dari pustaka-pustaka ini *mungkin* juga bekerja sepenuhnya baik dengan GeoDjango. Jarak tempuh anda mungkin beragam.

> **Note**
>
> The GeoDjango interfaces to GEOS, GDAL, and GeoIP may be used
> independently of Django.  In other words, no database or settings file
> required -- import them as normal from [`django.contrib.gis`](/id/5.0/ref/contrib/gis/#module-django.contrib.gis).

Pada Debian/Ubuntu, anda disarankan memasang paket-paket berikut yang akan memasang, secara langsung atau secara terpisah, pustaka-pustaka geospasial yang dibutuhkan:

```console
$ sudo apt-get install binutils libproj-dev gdal-bin
```

Harap juga rundingkan petunjuk serambi-spesifik jika anda berada pada [macOS](/id/5.0/ref/contrib/gis/install/#macos) atau [Windows](/id/5.0/ref/contrib/gis/install/#windows).

## Membangun dari sumber

Ketika memasang dari sumber pada sistem UNIX dan GNU/Linux, harap ikuti petunjuk pemakaian dengan hati-hati, dan pasang pustaka-pustaka dalam urutan yang diberikan. Jika menggunakan MySQL atau Oracle sebagai basisdata spasial, hanya GEOS dibutuhkan.

> **Note**
>
> On Linux platforms, it may be necessary to run the `ldconfig` command
> after installing each library. For example:
>
> ```shell
> $ sudo make install
> $ sudo ldconfig
> ```

> **Note**
>
> Pengguna macOS harus memasang Xcode\`\_ untuk menyusun perangkat lunak dari sumber.

### GEOS

GEOS adalah sebuah pustaka C++ untuk melakukan tindakan geometrik, dan adalah pewakilan geometri internal awalan digunakan oleh GeoDjango (itu dibelakang geometri "lazy"). Khususnya, pustaka API C dipanggil (misalnya, `libgeos_c.so`) langsung dari Python menggunakan ctype.

First, download GEOS from the GEOS website and untar the source archive:

```shell
$ wget https://download.osgeo.org/geos/geos-X.Y.Z.tar.bz2
$ tar xjf geos-X.Y.Z.tar.bz2
```

Then step into the GEOS directory, create a `build` folder, and step into
it:

```shell
$ cd geos-X.Y.Z
$ mkdir build
$ cd build
```

Then build and install the package:

```shell
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build .
$ sudo cmake --build . --target install
```

#### Menyelesaikan masalah

##### Tidak dapat menemukan pustaka GEOS

Ketika GeoDjango tidak dapat menemukan GEOS, kesalahan ini akan muncul:

```text
ImportError: Could not find the GEOS library (tried "geos_c"). Try setting GEOS_LIBRARY_PATH in your settings.
```

Pemecahan paling umum adalah dengan benar mengkonfigurasi [Pustaka pengaturan lingkungan](/id/5.0/ref/contrib/gis/install/#libsettings) anda *atau* menyetel [GEOS\_LIBRARY\_PATH](#geoslibrarypath) di pengaturan anda.

Jika menggunakan paket biner dari GEOS (misalnya, pada Ubuntu), anda mungkin butuh untuk [Pasang binutils](/id/5.0/ref/contrib/gis/install/#binutils).

##### `GEOS_LIBRARY_PATH`

If your GEOS library is in a non-standard location, or you don't want to
modify the system's library path then the [`GEOS_LIBRARY_PATH`](/id/5.0/ref/contrib/gis/geos/#std-setting-GEOS_LIBRARY_PATH)
setting may be added to your Django settings file with the full path to the
GEOS C library.  For example:

```shell
GEOS_LIBRARY_PATH = '/home/bob/local/lib/libgeos_c.so'
```

> **Note**
>
> Pengaturan harus berupa jalur *penuh* pada pustaka berbagi *C*; dengan kata lain anda ingin menggunakan `libgeos_c.so`, bukan `libgeos.so`.

Lihat juga [Catatan saya diisi dengan kesalahan terkait GEOS](/id/5.0/ref/contrib/gis/geos/#geos-exceptions-in-logfile).

### PROJ

[PROJ](https://proj.org/) is a library for converting geospatial data to different coordinate
reference systems.

First, download the PROJ source code:

```shell
$ wget https://download.osgeo.org/proj/proj-X.Y.Z.tar.gz
```

... and datum shifting files (download `proj-datumgrid-X.Y.tar.gz` for
PROJ \< 7.x) [^1]:

```shell
$ wget https://download.osgeo.org/proj/proj-data-X.Y.tar.gz
```

Next, untar the source code archive, and extract the datum shifting files in the
`data` subdirectory (use `nad` subdirectory for PROJ \< 6.x). This must be
done *prior* to configuration:

```shell
$ tar xzf proj-X.Y.Z.tar.gz
$ cd proj-X.Y.Z/data
$ tar xzf ../../proj-data-X.Y.tar.gz
$ cd ../..
```

For PROJ 9.x and greater, releases only support builds using `CMake` (see
[PROJ RFC-7](https://proj.org/community/rfc/rfc-7.html#rfc7)).

To build with `CMake` ensure your system meets the [build requirements](https://proj.org/install.html#build-requirements).
Then create a `build` folder in the PROJ directory, and step into it:

```shell
$ cd proj-X.Y.Z
$ mkdir build
$ cd build
```

Finally, configure, make and install PROJ:

```shell
$ cmake ..
$ cmake --build .
$ sudo cmake --build . --target install
```

### GDAL

[GDAL](https://gdal.org/) adalah sebuah pustaka geospasial sumber terbuka yang luar biasa yang mempunyai dukungan untuk membaca kebanyakan bentuk data vektor dan raster. Saat ini, GeoDjango hanya mendukung [GDAL's vector data](/id/5.0/ref/contrib/gis/gdal/) kemampuan-kemampuan [^2]. [GEOS](#geosbuild) dan [PROJ](#proj4) harus dipasang sebelum membangun GDAL.

First download the latest GDAL release version and untar the archive:

```shell
$ wget https://download.osgeo.org/gdal/X.Y.Z/gdal-X.Y.Z.tar.gz
$ tar xzf gdal-X.Y.Z.tar.gz
```

For GDAL 3.6.x and greater, releases only support builds using `CMake`. To
build with `CMake` create a `build` folder in the GDAL directory, and step
into it:

```shell
$ cd gdal-X.Y.Z
$ mkdir build
$ cd build
```

Finally, configure, make and install GDAL:

```shell
$ cmake ..
$ cmake --build .
$ sudo cmake --build . --target install
```

Jika anda mempunyai masalah apapun, harap melihat bagian penyelesaian masalah dibawah untuk saran dan pemecahan.

#### Menyelesaikan masalah

##### Tidak dapat menemukan pustaka GDAL

Ketika GeiDjango tidak dapat menemukan pustaka GDAL, konfigurasikan [Pustaka pengaturan lingkungan](/id/5.0/ref/contrib/gis/install/#libsettings) anda *atau* setel [GDAL\_LIBRARY\_PATH](#gdallibrarypath) dalam pengaturan anda.

##### `GDAL_LIBRARY_PATH`

If your GDAL library is in a non-standard location, or you don't want to
modify the system's library path then the [`GDAL_LIBRARY_PATH`](/id/5.0/ref/contrib/gis/gdal/#std-setting-GDAL_LIBRARY_PATH)
setting may be added to your Django settings file with the full path to
the GDAL library.  For example:

```shell
GDAL_LIBRARY_PATH = '/home/sue/local/lib/libgdal.so'
```

**Catatan kaki**

[^1]: The datum shifting files are needed for converting data to and from
certain projections.
For example, the PROJ string for the [Google projection (900913 or 3857)](https://spatialreference.org/ref/epsg/3857/) requires the `null`
grid file only included in the extra datum shifting files. It is easier
to install the shifting files now, then to have debug a problem caused
by their absence later.

[^2]: Secara khusus, GeoDjango menyediakan dukungan untuk [OGR](https://gdal.org/user/vector_data_model.html) library, a component of GDAL.
