---
title: "Memasang pustaka Geospatial"
version: 2.0
locale: id
source: https://docs.djangoproject.com/id/2.0/ref/contrib/gis/install/geolibs/
canonical: https://djangodocs.dev/id/2.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/2.0/ref/contrib/gis/geos/) | Geometry Engine Open Source | Ya | 3.6, 3.5, 3.4 |
| [PROJ.4](https://github.com/OSGeo/proj.4/wiki/) | Pustaka Cartographic Projections | Ya (hanya PostgreSQL dan SQLite ) | 4.9, 4.8, 4.7, 4.6, 4.5, 4.4 |
| [GDAL](/id/2.0/ref/contrib/gis/gdal/) | Pustaka Abstrak Data Geospatial | Ya | 2.2, 2.1, 2.0, 1.11, 1.10, 1.9 |
| [GeoIP](/id/2.0/ref/contrib/gis/geoip2/) | Pustaka geolokasi berdasarkan-IP | Tidak | 2 |
| [PostGIS](https://postgis.net/) | Tambahan spasial untuk PostgreSQL | Ya (hanya PostgreSQL) | 2.4, 2.3, 2.2, 2.1 |
| [SpatiaLite](https://www.gaia-gis.it/gaia-sins/) | Tambahan spasial untuk SQLite | Ya (hanya SQLite ) | 4.3, 4.2, 4.1, 4.0 |

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

> **Changed in Django 1.11**
>
> Di versi terlama, GDAL hanya dibutuhkan untuk SQLite. Sekarang itu dibutuhkan untuk semua basisdata.

> **Note**
>
> Antarmuka GeoDjango pada GEOS, GDAL, dan GeoIP mungkin digunakan secara berdisi sendiri dari Django. Dengan kata lain, tidak ada basisdata atau berkas pengaturan dibutuhkan -- cukup mengimpor mereka seperti biasanya dari [`django.contrib.gis`](/id/2.0/ref/contrib/gis/#module-django.contrib.gis).

On Debian/Ubuntu, you are advised to install the following packages which will
install, directly or by dependency, the required geospatial libraries:

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

Paket pilihan untuk dipertimbangkan:

- `libgeoip1`: untuk dukungan [GeoIP](/id/2.0/ref/contrib/gis/geoip2/)
- `python-gdal` for GDAL's own Python bindings -- includes interfaces for raster manipulation

Please also consult platform-specific instructions if you are on [macOS](/id/2.0/ref/contrib/gis/install/#macos)
or [Windows](/id/2.0/ref/contrib/gis/testing/#windows).

## Membangun dari sumber

When installing from source on UNIX and GNU/Linux systems, please follow
the installation instructions carefully, and install the libraries in the
given order.  If using MySQL or Oracle as the spatial database, only GEOS
is required.

> **Note**
>
> Pada serambi Linux, itu mungkin sangat diperlukan menjalankan perintah `ldconfig` setelah memasang setiap pustaka. Sebagai contoh:
>
> ```
> $ sudo make install
> $ sudo ldconfig
> ```

> **Note**
>
> macOS users must install [Xcode](https://developer.apple.com/xcode/) in order to compile software from source.

### GEOS

GEOS is a C++ library for performing geometric operations, and is the default
internal geometry representation used by GeoDjango (it's behind the "lazy"
geometries).  Specifically, the C API library is called (e.g., `libgeos_c.so`)
directly from Python using ctypes.

Pertama, unduh GEOS 3.4.2 dari situs jaringan GEOS dan untar arsip sumber:

```
$ wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
$ tar xjf geos-3.4.2.tar.bz2
```

Selanjutnya, rubah kedalam direktori dimana GEOS dibuka, jalankan tulisan konfigurasi, susun, dan pasang:

```
$ cd geos-3.4.2
$ ./configure
$ make
$ sudo make install
$ cd ..
```

#### 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/2.0/ref/contrib/gis/install/#libsettings) anda *atau* menyetel [GEOS\_LIBRARY\_PATH](#geoslibrarypath) di pengaturan anda.

Jika menggunakan paket biner dari GEOS (sebagai contoh pada Ubuntu), anda mungkin butuh untuk [Pasang binutils](/id/2.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/2.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:

```
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/2.0/ref/contrib/gis/geos/#geos-exceptions-in-logfile).

### PROJ.4

[PROJ.4](https://github.com/OSGeo/proj.4/wiki/) is a library for converting geospatial data to different coordinate
reference systems.

Pertama, unduh kode sumber PROJ.4 dan fakta meindahkan berkas-berkas [^1]:

```
$ wget http://download.osgeo.org/proj/proj-4.9.1.tar.gz
$ wget http://download.osgeo.org/proj/proj-datumgrid-1.5.tar.gz
```

Next, untar the source code archive, and extract the datum shifting files in the
`nad` subdirectory.  This must be done *prior* to configuration:

```
$ tar xzf proj-4.9.1.tar.gz
$ cd proj-4.9.1/nad
$ tar xzf ../../proj-datumgrid-1.5.tar.gz
$ cd ..
```

Akhirnya, konfigurasi, buat dan pasang PROJ.4:

```
$ ./configure
$ make
$ sudo make install
$ cd ..
```

### GDAL

[GDAL](https://trac.osgeo.org/gdal/) is an excellent open source geospatial library that has support for
reading most vector and raster spatial data formats.  Currently, GeoDjango only
supports [GDAL's vector data](/id/2.0/ref/contrib/gis/gdal/) capabilities [^2].
[GEOS](#geosbuild) and [PROJ.4](#proj4) should be installed prior to building GDAL.

Pertama unduh versi terbitan GDAL terakhir dan keluarkan arsip:

```
$ wget http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz
$ tar xzf gdal-1.11.2.tar.gz
$ cd gdal-1.11.2
```

Konfigurasi, buat dan pasang:

```
$ ./configure
$ make # Go get some coffee, this takes a while.
$ sudo make install
$ cd ..
```

> **Note**
>
> Because GeoDjango has its own Python interface, the preceding instructions
> do not build GDAL's own Python bindings. The bindings may be built by
> adding the `--with-python` flag when running `configure`. See
> [GDAL/OGR In Python](https://trac.osgeo.org/gdal/wiki/GdalOgrInPython) for more information on GDAL's bindings.

If you have any problems, please see the troubleshooting section below for
suggestions and solutions.

#### Menyelesaikan masalah

##### Tidak dapat menemukan pustaka GDAL

When GeoDjango can't find the GDAL library, configure your [Pustaka pengaturan lingkungan](/id/2.0/ref/contrib/gis/install/#libsettings)
*or* set [GDAL\_LIBRARY\_PATH](#gdallibrarypath) in your settings.

##### `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/2.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:

```
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.4 string for the [Google projection (900913 or 3857)](http://spatialreference.org/ref/sr-org/6864/prj/) 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]: Specifically, GeoDjango provides support for the [OGR](http://gdal.org/ogr_arch.html) library, a component of GDAL.
