> 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/fr/astuces-rapides-sig/qgis-convertir-des-valeurs-de-chaine-en-valeurs-numeriques-dans-le-shapefile.md).

# QGIS : convertir des valeurs de chaîne en valeurs numériques dans le shapefile

Convertissez les attributs textuels en valeurs numériques dans QGIS pour l’analyse et l’importation.

Dans QGIS, vous pouvez convertir une chaîne de caractères en nombre à l’aide de l’outil « Calculatrice de champs ». Commencez par ouvrir la table attributaire de la couche que vous souhaitez modifier. Ensuite, cliquez sur le bouton « Ouvrir la calculatrice de champs ». Dans la zone « Expression », saisissez « to\_real( » suivi du nom du champ contenant la chaîne que vous voulez convertir, puis la parenthèse fermante. Par exemple, pour convertir un champ texte nommé « string\_field » en champ numérique, saisissez « to\_real("string\_field") » dans la zone Expression. Vous pouvez aussi modifier le nom du champ de sortie et le type de données en sélectionnant les options appropriées. Enfin, cliquez sur « OK » pour terminer la conversion. Le champ texte d’origine restera dans la table attributaire, tandis que le nouveau champ numérique sera ajouté à la table.

<figure><img src="https://690567185-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. Ouvrir « Propriétés »
2. Aller à « Calculatrice de champs »
3. Cocher « Mettre à jour le champ existant »
4. to\_real("attributeName")
5. Enregistrer les modifications
6. Répétez la même opération pour chaque attribut

   <figure><img src="https://690567185-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>


---

# 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/fr/astuces-rapides-sig/qgis-convertir-des-valeurs-de-chaine-en-valeurs-numeriques-dans-le-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.
