{
  "id": 3494293,
  "title": "A Shapefile Is Four Files, and the Important One Is Optional",
  "url": "https://urgent.news/2026/08/26/a-shapefile-is-four-files-and-the-important-one-is-optional",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-26T11:10:44.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/srdjan_poppovic/a-shapefile-is-four-files-and-the-important-one-is-optional-hc9"
  },
  "original_language": "en",
  "account": "A shapefile is made up of four files that only make sense when used together. The most important file, though, is optional and often missing. This becomes apparent when building a web GIS to handle large shapefile uploads.\n\nInitially, Django's synchronous endpoint was used for uploads, but this quickly led to problems with large files. The endpoint would occupy a worker for minutes, causing timeouts and making it impossible to know if the import had succeeded. To solve this, the imports were moved to a separate FastAPI service. Even though FastAPI isn't inherently faster, the async model allowed for better concurrency control.\n\nA Semaphore is used to limit the amount of concurrent geospatial work, preventing out-of-memory errors. The endpoint returns a job ID, and the client polls for progress. This job-plus-poll method is now used for raster mosaics and exports, providing a consistent user experience.\n\nA shapefile consists of several components: .shp holds geometry, .shx is an index, and .dbf contains attributes. If any of these are missing, the parser will throw an error. To handle this, validation checks for the required components before parsing.\n\nMost users upload a ZIP file, which the service extracts and validates. The error message specifies the missing extension, providing clear instructions to the user. The .prj file, which defines the coordinate system, is not required but frequently absent. This is because most surveying data is delivered in a coordinate system that users already understand.\n\nAn important consideration is the coordinate system. While most data has a defined CRS, it's not always declared in the shapefile. The service asks users to select a coordinate system, and handles the data accordingly. The database schema is also typed, with 3D geometry being the default. This ensures consistency and prevents errors when querying the data.",
  "summary": "A user clicks \"upload\" and picks a file. In most systems that sentence is the whole story. In a geospatial system, the thing they picked is one of four files that only mean something together, the one carrying the most important piece of information is optional and frequently absent, and the geometry inside it almost certainly doesn't match your database schema. This is what I learned building…",
  "key_points": [
    "A shapefile comprises four files: .shp, .shx, .dbf, and .prj",
    "The .shp file holds geometry, .shx is an index, and .dbf contains attributes",
    "The .prj file defining coordinate system is optional but often missing"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}