How to Convert a Floor Plan PDF to JSON
By Floor Plan Analyzer, an AxcelerateAI practice
The practical challenge is making every exported object traceable to the right view, coordinate frame and drawing revision. This walkthrough follows a fictional room from crop pixels to a reviewable JSON record.

At a glance
Select the relevant page and view, extract geometry and positioned text, link rooms and openings to their evidence, and serialize the records with an explicit coordinate frame. Convert to physical units only after validating scale. Check both JSON structure and the overlay before using the result.
Download the fictional PDF-to-JSON example
Inventory the drawing before extracting objects
Record the file revision, page index, printed sheet label and view crop. A sheet can include a floor plan, an enlarged bathroom and a detail at different scales. Extract the intended view rather than counting objects from the entire sheet. Keep a coverage list for skipped and unreadable views.
Inspect native text and paths, then compare their position with a rendered page. A scanned page can contain an invisible OCR layer; native-looking text does not prove the geometry is vector. Conversely, a vector export can outline letters as paths, leaving no useful text objects. Choose the extraction method per region.
| Input evidence | Starting method | Check before export |
|---|---|---|
| Selectable text and clean linework | Read positioned text and vector paths | Hatches and furniture are not walls |
| Raster scan | Render or decode; segment and OCR | Skew, erased openings and faint labels |
| Hybrid sheet | Combine native evidence with targeted raster passes | No double count across the two sources |
References: PyMuPDF Page reference: paths, text and coordinate transforms
Keep the coordinate transforms explicit
PyMuPDF exposes positioned text, drawing paths and rotation matrices. Its page reference distinguishes coordinates returned in unrotated page space from the rotated display frame. Record the actual render transform and crop offset used by your pipeline. A visually correct overlay at one zoom can still be wrong on a different rendition if coordinates are mixed.
In the fictional fixture, crop-local pixel point (200, 300) maps to (320, 380) on the full render by adding the crop origin (120, 80). This example has no rotation or resampling after cropping. For a deskewed or resized image, store the full affine transform and its direction; adding an offset alone is insufficient. Check at least three non-collinear control points before trusting the overlay.
References: PyMuPDF Page reference: paths, text and coordinate transforms
Build rooms and walls from evidence, then link openings
Separate boundary reconstruction from object classification. Close room outlines only where evidence supports a boundary; keep ambiguous gaps for review rather than filling every gap. Distinguish wall faces, centerlines and room-boundary proxies. In the fixture W1 and W2 are boundary reference segments, not measured wall thicknesses. The other room edges exist as polygon edges without separate wall records.
Represent a door or window span on its host boundary and keep symbol evidence separately if available. A swing arc can suggest handing, but the arc radius is not a verified clear opening. A plan window span does not establish sill height or glazing type. Join schedule values only after comparing tag, revision, and the meaning of the field.
For labels, retain the raw text and its region before normalizing it. A text region inside a polygon is a candidate association, not proof of its meaning: a dimension, keynote, or label for an adjacent room can fall inside. Store an unresolved association when competing labels cannot be distinguished.
Work through the example and verify scale
The crop contains a fictional studio polygon from (100, 100) to (500, 300). The reference segment is 400 pixels and is stipulated to represent 4 metres. That gives 0.01 metres per pixel; at the same scale in both directions the room measures 4 × 2 m, or 8 m² under the drawn-boundary definition. The door span is 90 pixels or 0.90 m; the window span is 120 pixels or 1.20 m. These are geometric spans, not certified quantities.
On a real sheet, use an explicit dimension or other trusted reference in the same view. Cross-check a second dimension, preferably in the other axis, and investigate discrepancies before assigning one uniform scale. Image DPI measures the render, not the building. If scale cannot be confirmed, keep pixel coordinates and set physical dimensions to null. Do not apply a detail scale to the whole sheet.
Validate JSON structure and drawing semantics separately
RFC 8259 defines JSON syntax and its value types. A parser accepting a file tells you nothing about whether the polygon is closed by convention, whether IDs resolve or whether a dimension was converted correctly. Define a versioned schema for your importer and validate relationships and geometry separately.
| Check | Example failure | Disposition |
|---|---|---|
| Required fields and types | A width contains a formatted string | Reject or migrate explicitly |
| Geometry and references | Door points do not lie on its host segment | Flag the association for review |
| Scale and provenance | Metric area lacks a calibration source | Withhold the metric field |
| Coverage and release | One skipped view imported as empty | Keep skipped status and require review |
References: RFC 8259: JSON interchange format
Run an overlay check before handing off the file
Reproject the exported objects onto the exact revision and inspect room edges, wall references, opening endpoints and text boxes. Include at least one rotated or cropped view, one missing scale and one ambiguous label in the acceptance set. Ask the receiver to verify that null stays unknown and that the review state is not lost during import.
Use stable local IDs within a result and maintain a separate cross-revision mapping only when justified. Keep rejected observations with source references instead of silently repairing them. Store the original and reviewed exports separately so a later re-extraction cannot overwrite a human decision.
Choose a manual, hybrid or tuned workflow
For a single simple drawing, manually tracing the required fields may be quicker than building an extractor. For repeated clean exports, vector and text parsing can give a useful starting point. Scanned or mixed archives often require segmentation, OCR and a reviewer to resolve uncertain labels and gaps. Compare the cost of review on representative drawings, not just the speed of export.
For a recurring workflow, bring a representative drawing family and the JSON fields your receiver actually uses. We fine-tune our drawing models on your conventions and engineer the validation and handoff. The sample file is an educational fixture, not a published API contract or model result.
Frequently asked questions
Can I convert a scanned PDF?
Yes, with a raster extraction and OCR workflow. Inspect the resulting overlay and retain unresolved boundaries and labels for review.
Is the sample a BIM model?
No. It is a simple drawing evidence record. The sample does not establish wall assemblies, elevations or a verified building model.
References and illustration notes
Sources support the terminology and interpretation notes cited above. Worked examples and diagrams are our own educational material, not client drawings or measured project results.