# prompt2map
**prompt2map** is a Python package that generates dynamic maps based on natural language prompts, utilizing Retrieval-Augmented Generation (RAG).
# Quickstart
## Initialize the mapper with geospatial data
To get started, initialize Prompt2Map by providing a geospatial data file, embeddings, and descriptions of the fields in your dataset:
```python
from prompt2map import Prompt2Map
# Example with portuguese 2021 Census
p2m = Prompt2Map.from_file(
"censo2021portugal",
"data/censo_pt_2021/geodata.parquet", # Main geospatial data source that will be queries and mapped
"data/censo_pt_2021/embeddings.parquet", # Embedding for string literals
"data/censo_pt_2021/variable_descriptions.csv" # Description of fields in geodata.parquet
)
```
## Make a query
Once initialized, you can generate maps by making natural language queries. For example, to create a population density map:
```python
prompt = "Population density map of the district of Setúbal by parish in inhabitants / km2"
generated_map = p2m.to_map(prompt)
```
![Screenshot of a web choropleth map of Setúbal district with parish polygons](docs/images/example_map_censo_pt.png)
Raw data
{
"_id": null,
"home_page": null,
"name": "prompt2map",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Jos\u00e9 Miguel Cordero Carvacho <josemcorderoc@gmail.com>",
"keywords": "maps, mapping, cartography, gis, webgis, geospatial, llm, nlp, prompt",
"author": null,
"author_email": "Jos\u00e9 Miguel Cordero Carvacho <josemcorderoc@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/f1/cc/ffe80948ccdd6cc4ea6be13fed629c3f8cc9612b0a04b2794bdb119bcb65/prompt2map-0.1.3.tar.gz",
"platform": null,
"description": "# prompt2map\n\n**prompt2map** is a Python package that generates dynamic maps based on natural language prompts, utilizing Retrieval-Augmented Generation (RAG).\n\n# Quickstart\n\n## Initialize the mapper with geospatial data\n\nTo get started, initialize Prompt2Map by providing a geospatial data file, embeddings, and descriptions of the fields in your dataset:\n\n```python\nfrom prompt2map import Prompt2Map\n\n# Example with portuguese 2021 Census\np2m = Prompt2Map.from_file(\n \"censo2021portugal\", \n \"data/censo_pt_2021/geodata.parquet\", # Main geospatial data source that will be queries and mapped \n \"data/censo_pt_2021/embeddings.parquet\", # Embedding for string literals\n \"data/censo_pt_2021/variable_descriptions.csv\" # Description of fields in geodata.parquet \n)\n```\n\n## Make a query\n\nOnce initialized, you can generate maps by making natural language queries. For example, to create a population density map:\n\n```python\nprompt = \"Population density map of the district of Set\u00fabal by parish in inhabitants / km2\"\ngenerated_map = p2m.to_map(prompt)\n```\n\n![Screenshot of a web choropleth map of Set\u00fabal district with parish polygons](docs/images/example_map_censo_pt.png)\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Dynamic maps generation based on natural language prompts using Retrieval-Augmented Generation (RAG)",
"version": "0.1.3",
"project_urls": {
"Repository": "https://github.com/josemcorderoc/prompt2map"
},
"split_keywords": [
"maps",
" mapping",
" cartography",
" gis",
" webgis",
" geospatial",
" llm",
" nlp",
" prompt"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f011dd2574348fff77c37ad93c301686ab9450d8a980009f127a88e17b3af2d3",
"md5": "e842fd83a75c00ee7ecd5d1ea051495d",
"sha256": "f9f7fb6e13ddf15a62791168cba145e81c7cbb2e6d54827ee2a7642261972531"
},
"downloads": -1,
"filename": "prompt2map-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e842fd83a75c00ee7ecd5d1ea051495d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 1223924,
"upload_time": "2024-09-28T23:41:09",
"upload_time_iso_8601": "2024-09-28T23:41:09.083285Z",
"url": "https://files.pythonhosted.org/packages/f0/11/dd2574348fff77c37ad93c301686ab9450d8a980009f127a88e17b3af2d3/prompt2map-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f1ccffe80948ccdd6cc4ea6be13fed629c3f8cc9612b0a04b2794bdb119bcb65",
"md5": "93826f932d287fb9801ca6d83237b3ff",
"sha256": "ca57843f026fcb74216eecc93bf8b71e17cf72091584a49444fccf8f920f64bd"
},
"downloads": -1,
"filename": "prompt2map-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "93826f932d287fb9801ca6d83237b3ff",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 2585117,
"upload_time": "2024-09-28T23:41:11",
"upload_time_iso_8601": "2024-09-28T23:41:11.659135Z",
"url": "https://files.pythonhosted.org/packages/f1/cc/ffe80948ccdd6cc4ea6be13fed629c3f8cc9612b0a04b2794bdb119bcb65/prompt2map-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-28 23:41:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "josemcorderoc",
"github_project": "prompt2map",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "bidict",
"specs": [
[
"~=",
"0.23"
]
]
},
{
"name": "click",
"specs": [
[
"~=",
"8.1"
]
]
},
{
"name": "folium",
"specs": [
[
"~=",
"0.17"
]
]
},
{
"name": "geopandas",
"specs": [
[
"~=",
"1.0"
]
]
},
{
"name": "jsonlines",
"specs": [
[
"~=",
"4.0"
]
]
},
{
"name": "matplotlib",
"specs": [
[
"~=",
"3.9"
]
]
},
{
"name": "pandas",
"specs": [
[
"~=",
"2.2"
]
]
},
{
"name": "plotly",
"specs": [
[
"~=",
"5.23"
]
]
},
{
"name": "psycopg",
"specs": [
[
"~=",
"3.2"
]
]
},
{
"name": "Shapely",
"specs": [
[
"~=",
"2.0"
]
]
},
{
"name": "SQLAlchemy",
"specs": [
[
"~=",
"2.0"
]
]
},
{
"name": "sqlglot",
"specs": [
[
"~=",
"25.8"
]
]
},
{
"name": "sqlparse",
"specs": [
[
"~=",
"0.5"
]
]
},
{
"name": "openai",
"specs": [
[
"~=",
"1.38"
]
]
},
{
"name": "mapclassify",
"specs": [
[
"~=",
"2.8"
]
]
},
{
"name": "duckdb",
"specs": [
[
"~=",
"1.1"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
"~=",
"4.12"
]
]
},
{
"name": "pyarrow",
"specs": [
[
"~=",
"17.0"
]
]
}
],
"lcname": "prompt2map"
}