Giter VIP home page Giter VIP logo

geosvg's Introduction

GeoSVG

GeoSVG is a simple GUI to help with mapping SVG on top of a geographic map. You push some vector onto it, mess with a few boxes and get GeoJSON without any sweat.

There are a few other tools to do this, but they all kinda suck, and the majority are browser based with quite some limitations. This is a standalone desktop app, and with a few easy tweaks you can throw the GUI away and automate it.

Converter

Requirements

This is python based, I think that python 3.6+ will do just fine. If you edit the code and throw away stuff such as f-strings it is probably safe to go down a few versions. You'll need the following libraries:

beautifulsoup4, numpy

In case you run it as it is, GUI included, you'll also need:

gtk, libchamplain, libglade (in case gtk doesn't bundle it)

Considerations

Both standard and Inkscape's SVG is fine. Everything has to be a path. Other elements are discarded. Only polygons made of straight lines are supported, curves are flattened. Lucky you, Inkscape easily turns everything into paths.

Ratios aren't preserved. It is up to you to insert proper coordinates, and/or click on the correct places.

Rotation support isn't properly baked in, bounds aren't properly considered when a polygon is rotated. A few algorithm tweaks are needed. You can manually adjust rotated stuff. In case you need precision rotate the SVG itself. Once again, Inkscape excels with that kinda stuff.

Anything with a translation attached to it will mess up with the output. Ideally you'd have no groups. Layers might or might not work. In case you have translations messing up with your stuff please buy this guy a coffee.

MultiPolygons are buggy as hell, and cropped polygons are read as MultiPolygons. Their coordinates are fine, it's just the array hierarchy that isn't correct. A few brackets here and there and it's all good.

There's some weird bug with the boundary fields if you want to manually insert coordinates. Try to position with the mouse and insert the correct coordinates after it.

Sometimes part of the figure is not drawn. Worry not, the json output is good. Adjusting the positioning back and forth will sometimes make it draw properly. I'm not even sure that bug is mine or some issue with libchamplain's/clutter's drawer.

While these remaining bugs aren't nice, all of them have workarounds. This tool has already served the purpose I had for it, I'll probably leave them unsolved until someone complains. Pull requests accepted.

geosvg's People

Contributors

claudioap avatar

Stargazers

Krcr avatar Pavel Rid avatar haopf avatar 胡实 avatar Bob Blanchett avatar D. Starr avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.