What is vector data? GIS vector data, vector database data, storage, and why vector DBs

Vector data in GIS and in AI, vector data models and examples, how vector databases store data and chunks, why and how to use one, LangChain, and IVs.

Pranjul Rathour
Pranjul Rathour

Key takeaways

  • In GIS, vector data represents features as points, lines and polygons with attributes.
  • In AI, vector data means embeddings: arrays of numbers that represent meaning for similarity search.
  • Vector databases store vectors with IDs, metadata and usually the original chunk text, plus indexes such as HNSW.
  • You need a vector database when you search large collections by meaning; small projects can use Postgres or a library.
  • In encryption, the key is secret and the initialisation vector is a unique, non-secret value per message.

"Vector data" means two different things. In geography and GIS, vector data represents real-world features as points, lines and polygons with attributes, such as wells, roads and district boundaries. In AI, vector data means embeddings: lists of numbers that represent the meaning of text, images or audio so software can search by similarity. I work with the AI kind in RAG.NextUpgrad and FaceVision, so this page covers both meanings, examples, how vector databases store data, why and how to use one, LangChain, and initialisation vectors in encryption.

What is vector data?

In GIS, vector data stores geographic features as geometry, coordinates forming points, lines or polygons, plus attribute tables describing them. In machine learning, vector data is numerical arrays, embeddings, representing items in a high-dimensional space.

Also asked as: example of vector database data

The two share the mathematical idea of vectors but serve different purposes. GIS vector data answers "where is it and what is it?", such as the boundary of a farm and its crop type. AI vector data answers "what is similar to this?", such as finding documents related to a question. Context usually makes the meaning clear: shapefiles and GeoJSON are GIS; embeddings and vector databases are AI.

What is the vector data model?

In GIS, the vector data model represents the world as discrete features: points for single locations, lines for linear features such as rivers and roads, and polygons for areas such as lakes and administrative boundaries. Each feature links to attributes in a table.

Also asked as: what is vector data model

It contrasts with the raster model, which represents the world as a grid of cells, suited to continuous data such as elevation, rainfall or satellite imagery. Vector data is precise, compact for discrete features and good for network analysis and maps with sharp boundaries. Common formats include shapefiles, GeoJSON, GeoPackage and spatial databases such as PostGIS.

What are some vector data examples?

GIS examples: schools and hospitals as points, roads, railways and rivers as lines, and state boundaries, land parcels and lakes as polygons. AI examples: sentence embeddings for search, image embeddings for visual similarity, and face embeddings for recognition.

Concretely, a GeoJSON file of bus stops is GIS vector data, each stop a point with a name and route attributes. A 384-number embedding of the sentence "How do I apply for a scholarship?" is AI vector data. In FaceVision, each enrolled face becomes an embedding vector, stored without the original image, and recognition compares a new face's vector against stored ones.

What does data in a vector database look like?

Each record typically has an ID, a vector of numbers, metadata such as source, title, page and date, and often the original text chunk. For example: ID "handbook-p12-c3", a 768-number embedding, metadata about the hostel rules section, and the chunk text.

{"id": "handbook-p12-c3",
 "vector": [0.021, -0.113, 0.087, "..."],
 "metadata": {"source": "student-handbook.pdf", "page": 12, "section": "Hostel rules"},
 "text": "Students must return to the hostel by 10 pm..."}

Queries send a vector, plus optional metadata filters, and receive the most similar records with scores.

How do vector databases store data?

Vector databases store vectors with IDs and metadata in segments on disk or in memory, and build approximate nearest-neighbour indexes, commonly HNSW graphs or inverted-file indexes, so searches check only promising candidates instead of every vector.

Many also compress vectors with quantisation to save memory, keep payload or metadata indexes for filtering, and use write-ahead logs for durability. Database extensions such as pgvector store vectors in ordinary table columns, with indexes managed by PostgreSQL. Storage design trades off memory, speed and accuracy, so most systems let you tune index parameters and choose in-memory or disk-based storage.

Does a vector database keep the original chunked text for RAG?

It can, and for RAG it usually should. Most vector databases let you store the chunk text and metadata alongside each vector, so retrieval returns the text needed for the prompt. Alternatively, store only IDs and fetch text from another database.

Also asked as: does a vector database maintain pre-vector chunked data for rag systems

Storing text with vectors is simpler; keeping text in a separate store suits large documents, strict access control or existing databases. Either way, keep the original documents and chunk text somewhere durable, because you will need to re-embed everything when you change embedding models. Vectors alone cannot be reliably turned back into exact text, and you need the text for citations.

Why do we need a vector database?

We need vector databases to search large collections by meaning quickly, with filtering, updates and persistence. Comparing a query against millions of vectors one by one is too slow; vector indexes make it fast.

Also asked as: why do we need vector db

You may not need a dedicated one: for small collections, an in-memory library or a few thousand vectors in a NumPy array works; for apps already on PostgreSQL, pgvector is often enough. Dedicated vector databases help with very large scale, heavy filtering, multi-tenancy and high query volumes. Choose based on data size, latency needs and what your team already operates.

How do I use a vector database?

Choose an embedding model, embed your data in chunks, insert vectors with IDs, metadata and text, create an index, then embed each query with the same model and search for the nearest vectors, optionally with filters.

Also asked as: how to use vector db

Steps for a RAG app:

  • Chunk documents and embed each chunk.
  • Upsert vectors with metadata such as source and page.
  • Create an HNSW or similar index.
  • At query time, embed the question and retrieve the top 5 to 20.
  • Optionally combine with keyword search and rerank.
  • Pass the best chunks to a language model with citation instructions.

Record the embedding model name with your index so you never mix models.

Does LangChain have a vector database?

LangChain is not a vector database, but it provides a common vector store interface with integrations for many databases, including pgvector, Chroma, FAISS, Qdrant, Pinecone, Weaviate and Milvus, plus a simple in-memory store for testing.

Also asked as: does langchain have vector db

This lets you write retrieval code once and switch backends with minimal changes. For production, choose the underlying database deliberately for scale, filtering and operations, and consider writing direct queries when you need features the abstraction does not expose, such as hybrid search tuned in SQL. LangChain's retriever interface then connects the store to chains and agents.

What is the difference between an initialisation vector and a key in encryption?

The key is the secret that encrypts and decrypts data and must be protected. The initialisation vector, or IV, is a random or unique value used with the key so the same plaintext encrypts differently each time; it is not secret but must not be reused improperly.

Also asked as: encryption: use of initialization vector vs key

For example, with AES in GCM mode, each message needs a unique nonce or IV with the same key; reusing one can break security badly. The IV is usually stored or sent alongside the ciphertext. This "vector" is simply a block of bytes and has nothing to do with embeddings or GIS vector data. Use well-tested libraries rather than implementing encryption yourself.

Sources

  1. QGIS Documentation, Vector datadocs.qgis.org
  2. pgvector, repositorygithub.com
  3. LangChain, Vector storespython.langchain.com
  4. Malkov & Yashunin, Efficient and robust approximate nearest neighbor search using HNSW graphs (2016)arxiv.org
  5. Wikipedia, Initialization vectoren.wikipedia.org
Pranjul Rathour
Pranjul Rathour
GenAI Engineer · India

GenAI engineer and AI product builder with 2+ years shipping production-grade AI systems: RAG pipelines, fine-tuned LLMs, hybrid retrieval and multi-modal apps across vision, speech and OCR, architected end to end from ingestion to deployment. Leads engineering for SCULT INDIA's 14-member team, founded the 500+ member TechVerse Enclave community and has mentored 200+ students. Three hackathon first prizes: Changethon 2025 (IIT Roorkee), Product Genesis at Vividhotsava 2025 (CSJMU) and BYTEBATTLE (MeetKats).

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way. Email pranjulrathour41@gmail.com.

Keep reading

More on RAG & retrieval

All RAG & retrieval guides →
Campus talks · hackathon judging · mentoring

Want this as a live session at your college?

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way.

Pranjul Rathour, GenAI engineer in India