Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

(feature request) Export to GeoJSON

A topic by Tom created 31 days ago Views: 151 Replies: 4
Viewing posts 1 to 4

Would it be possible to add an export option to GeoJSON? It's not difficult to make it if you have the data, but SVG does not always translate cleanly to it and my converter tool is giving me ok, but not perfect results.

I'm asking because I am working with GIS systems and want the actual polygon data to import. SVG doesn't work in that context.


Sorry, missed your post. This does look easy enough, I'll think about it.

(22 edits)

Because the source code on Github isn't updated to the latest generator one, i had no choice but to use the exported SVGs itself and analyse it myself via my own converter tool as well via some jquery like selectors, d3-delaunay /voronoi analysis, cdt2d triangulation, and yuka navmeshing/graphs.. Though my own purposes is not for GeoJSON usage but more for AI to analyse the SVG,  and re-identify the exact curtain wall boundary (ordered points), inside/out wall wards, neighborhood BSP tree alleyway splitters,  identify individual street/road section IDs (using Set of of adjacient wards' integer Ids for the key, convert Set to array, order sort  ascending numeric, then .join("_") for street region string ID key), highways vs roads, highway/road exit points, empty regions within neighborhoods,  ward adjaciency among wards,  street/ward distances between them,  and street/ward distances towards curtain wall or citadel, etc.

(oh mine, you updated the Medieval City generator just now, and now my default SVG jquery selectors aren't likely to match the new ones now.. :() ) I did notice you are now using <polygon> instead of <path> now for the ward's  buildings., which means i'll have to adjust my converter to match the new version now...unless there's an older version out there? I'd likely include a variable setting to support legacy version.

One thing you need to take note of regarding Building outlines. The BSP Cell subdivision algorithm causes extra collinear points to be formed along the edges of buildings. My converter cleans up those collinear points/edges via a threshold setting, to avoid excess redundant vertices and to re-get a clean convex hull per building. (or for complex non-convex buildings, multiple convex hulls..) 

I noticed the SVG export has a lot of empty `<g>` tags likely due to empty wards. It would quite useful if you included metadata attributes like `data-hull="..."` for those wards ,  whether they lack buildings or not. My converter has no way to retrieve back a reasonably sized convex hull based on those "empty" wards. Also, the convex hull i reverse-get back from an occupied ward cell may not be 100% accruate as well unless i view the SVG  option without buildings to get clean convex hull cells.

Talking about this - can we also have the roads inside the town as paths or linestrings, maybe? It would be really great to not have to trace them by hand. I assume you have them in the algorithm anyway, they just get culled from the SVG?


I replied to Glidias on this topic in general: :)