Skip to main content

shp2postgis

Módulo python para converter arquivos no padrão shapefile da esri para arquivos sql que podem ser importados em bancos de dados postgresql/postgis.

Python module to convert esri shapefile format to sql files that can be imported into postgresql/postgis database.

Uso / Usage

primeiro é necessário instalar as dependências

First install dependencies

pip3 install -r requirements.txt

python3 na linha de comando / on command line

Uso detalhado pode ser visto usando:

Details about use are shown using:

python3 -m shp2postgis -h

ou / or

python3 -m shp2postgis --help

Para usar como biblioteca / as a library

from shp2postgis.Shp2Postgis import Shp2Postgis

process = Shps2Postgis(dictInput, outputPath, schema, encoding, verbose, columnsToLower)

process.run()

Parâmetros / parameters

  • dictInput:

dicionário python em que cada item tem chave sendo o nome da camada e valor sendo o caminho para o arquivo shapefile

python dictionary in which each item has a key being the layer name and value being the path to the shapefile

</code></pre>
</blockquote>
<p>dictInput = {
"airport": "/home/user/SHP/AIRPORT",
}</p>
<pre><code>
* >outputPath:
>>diretório onde será gravado o arquivo sql.
>
>>folder where the sql file will be saved.
>
>```python
outputPath = "/home/user/SQL/"
  • schema:

schema do banco de dados em que o sql será carregado.

database schema where sql file will be loaded.

</code></pre>
</blockquote>
<p>schema = "public"</p>
<pre><code>
* >encoding:
>>conjunto de caracteres do shapefile.
>
>>charset of the shapefile.
>
>```python
encoding = "latin1"
  • verbose:

deixe com valor False.

leave False.

</code></pre>
</blockquote>
<p>verbose = False</p>
<pre><code>
* >columnsToLower:
>>Faz com que os nomes das colunas fiquem em letra minúscula.
>
>>It makes the name of each column to be lower case.
>
>```python
columnsToLower = True

Release files for shp2postgis 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shp2postgis 0.3.1
File Size Uploaded
shp2postgis-0.3.1.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shp2postgis 0.3.1
File Interpreter ABI Platform
shp2postgis-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.1 kB

Release files / shp2postgis-0.3.1.tar.gz

Download URL shp2postgis-0.3.1.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b5ad0f3c0d20cd5948a34e2585c46dec5ed0081f879b40ab2198b309dd8fd421
BLAKE2b-256 checksum
How to use checksums
f2318817c6b096e07ec5e89b34f31f8161c9cd396744d75ae88547e735136088
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / shp2postgis-0.3.1-py3-none-any.whl

Download URL shp2postgis-0.3.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8453848f5f5a05708d6d6776ddaa15ac2d953dcf165f37db57342cab8cf3b34
BLAKE2b-256 checksum
How to use checksums
c99394a5b205a9117434812de6d88ed7f24588373a6887b35c154b05b1c80e66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.7.8

1 release file

0.2.7

2 release files

0.2.5

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page