> For the complete documentation index, see [llms.txt](https://docs.geopard.tech/geopard-tutorials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.geopard.tech/geopard-tutorials/pt-br/dicas-rapidas-de-gis/qgis-change-string-to-number-values-in-the-shapefile.md).

# QGIS: converta um campo de texto em número em um shapefile

Use to\_real() ou to\_int() na Calculadora de Campo do QGIS para converter valores de texto em números, manter as casas decimais e corrigir colunas de taxa ou produtividade que não são importadas.

Abra a tabela de atributos, inicie a Calculadora de Campo, crie um novo campo decimal e insira `to_real("your_field")`. Use `to_int()` para números inteiros. Se as casas decimais desaparecerem após salvar, defina o comprimento do campo de saída como 0 ou uma precisão maior que zero. Números armazenados como texto são o motivo mais comum para uma coluna de produtividade ou taxa não colorir um mapa nem ser importada como taxa.

{% hint style="success" %}
Envie o arquivo corrigido e visualize-o como um mapa: [Comece grátis](https://app.geopard.tech/auth/sign-up?utm_source=docs\&utm_medium=cta\&utm_campaign=qgis-change-string-to-number-values-in-the-shapefile)
{% endhint %}

No QGIS, você pode converter uma string em número usando a ferramenta "Calculadora de Campo". Primeiro, abra a tabela de atributos da camada que deseja modificar. Em seguida, clique no botão "Abrir Calculadora de Campo". Na caixa "Expressão", digite "to\_real(" seguido pelo nome do campo que contém a string que você quer converter e, depois, um parêntese de fechamento. Por exemplo, para converter um campo de string chamado "string\_field" em um campo numérico, insira "to\_real("string\_field")" na caixa Expressão. Você também pode modificar o nome e o tipo de dado do campo de saída selecionando as opções apropriadas. Por fim, clique em "OK" para concluir a conversão. O campo de string original permanecerá na tabela de atributos, enquanto o novo campo numérico será adicionado à tabela.

<figure><img src="https://1397135423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYICBELdyAXXebKAzfLOR%2Fuploads%2Fi3rxrGu9XbcEMSGWGGEX%2FScreenshot%202023-04-03%20at%2017.22.03.png?alt=media&amp;token=1425fbc0-f7fa-4d0d-b794-b50c8db37b8d" alt=""><figcaption></figcaption></figure>

1. Abra "Propriedades"
2. Acesse "Calculadora de Campo"
3. Marque "Atualizar campo existente"
4. to\_real("attributeName")
5. Salve as edições
6. Repita o mesmo procedimento para cada atributo

   <figure><img src="https://1397135423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYICBELdyAXXebKAzfLOR%2Fuploads%2Fc6LPt5wG8QlPkfn1B00s%2FScreenshot%202023-04-03%20at%2017.29.49.png?alt=media&amp;token=86437f74-6d54-4cae-8e04-ff319e4769a6" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
Envie o arquivo corrigido e visualize-o como um mapa: [Comece grátis](https://app.geopard.tech/auth/sign-up?utm_source=docs\&utm_medium=cta\&utm_campaign=qgis-change-string-to-number-values-in-the-shapefile)
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.geopard.tech/geopard-tutorials/pt-br/dicas-rapidas-de-gis/qgis-change-string-to-number-values-in-the-shapefile.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
