Skip to content

Created SVG to JSON Python Script#51

Open
vnguyen727 wants to merge 8 commits intomainfrom
svg-to-json
Open

Created SVG to JSON Python Script#51
vnguyen727 wants to merge 8 commits intomainfrom
svg-to-json

Conversation

@vnguyen727
Copy link
Contributor

Created a python script that

  1. parses svg files
  2. calculate absolute coordinates
  3. declares node types (halls, doors, elevator)
  4. generates JSON objects to match the template format
  5. organizes the nodes by type

I tested this with the first floor of the IST with the script.
python3 svg_to_graph.py istF1.svg 1

Created a Python Script that
- parses svg files
- calculates coordinates
- declares node types
- generates JSON objects
- organizes nodes and types

and tested the script with the IST first floor svg by using:

python3 svg_to_graph.py istF1.svg 1
@vnguyen727 vnguyen727 requested review from a team as code owners November 11, 2025 17:48
ekuhhirte
ekuhhirte previously approved these changes Nov 11, 2025
Copy link
Collaborator

@ekuhhirte ekuhhirte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks nice

Copy link
Member

@DJFreer92 DJFreer92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not believe there should not be any negative coordinates. The values are also all very small while I'd expect them to be more spread out. The range for the coordinates in Inkscape is 0 - ~695 for x, and 0 - ~458 for y. This may have been caused by a miscalculation of the points relative to their parent(s). You could try plotting the coordinates with (0, 0) in the top left corner as a way to verify the correct translation.

I'd suggest putting the svg_to_graph.py file in a new scripts/ directory in the root directory of the project instead of with the data.

I like your code, it has good documentation and type annotations 👍🏻

@DJFreer92 DJFreer92 requested a review from a team November 24, 2025 22:06
Signed-off-by: Daniel Freer <deletes_minimal.0w@icloud.com>
Signed-off-by: Daniel Freer <deletes_minimal.0w@icloud.com>
@DJFreer92 DJFreer92 enabled auto-merge (squash) March 1, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Python Script to Convert SVG Circles into JSON Graph Nodes

3 participants