GithubHelp home page GithubHelp logo

capesean / topojson.net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freddixx/topojson.net

0.0 2.0 0.0 1.06 MB

.Net library for TopoJSON based on Jörg Battermann's GeoJSON.Net

License: Other

C# 100.00%

topojson.net's Introduction

TopoJSON.NET NuGet Version

TopoJSON.Net is a fork of Jörg Battermann's wonderful GeoJSON.Net library. It extends the original lib with TopoJSON features and uses Newtonsoft Json.NET converters for serialization and deserialization.

What's in this version?

The current release features only deserialization (which might be buggy and I'll write more tests once I have the time). Serialization will come in the next weeks.

TopoJSON.Net aims to maintain full compatibility to GeoJSON.Net. You'll find classes prefixed with TopoJSON (such as TopoJSONPolygon) that work the same way as their GeoJSON.Net equivalents. Should be easy to exchange data between GeoJSON.Net and TopoJSON.Net.

Wait! Can I see an example?

Yup.

string topology_string = 
   @"
    {
        'type':'Topology',
        'transform':{
        'scale': [1,1],
        'translate': [0,0]
    },
    'objects':{
        'two-squares':{
            'type': 'GeometryCollection',
            'geometries':[
            {'type': 'Polygon', 'arcs':[[0,1]],'properties': {'name': 'Left_Polygon' }},
            {'type': 'Polygon', 'arcs':[[2,-1]],'properties': {'name': 'Right_Polygon' }}
            ]
        },
        'one-line': {
            'type':'GeometryCollection',
            'geometries':[
            {'type': 'LineString', 'arcs': [3],'properties':{'name':'Under_LineString'}}
            ]
        },
        'two-places':{
            'type':'GeometryCollection',
            'geometries':[
            {'type':'Point','coordinates':[0,0],'properties':{'name':'Origine_Point'}},
            {'type':'Point','coordinates':[0,-1],'properties':{'name':'Under_Point'}}
            ]
        }
        },
        'arcs': [
        [[1,2],[0,-2]],
        [[1,0],[-1,0],[0,2],[1,0]],
        [[1,2],[1,0],[0,-2],[-1,0]],
        [[0,-1],[2,0]]
        ]
    }
";
var topology = JsonConvert.DeserializeObject<Topology>(topology_string);

Installation & Usage

Well all you basically have to do is install the TopoJSON.Net NuGet package:

PM> Install-Package TopoJSON.Net

Contributing

Highly welcome! Just fork away and send a pull request.

Thanks

This library would be NOTHING without its contributors - thanks so much!!

Copyright

GeoJSON.Net: Copyright © 2014 Jörg Battermann & Contributors TopoJSON.Net: Copyright © 2015 Friedrich Politz

License

GeoJSON and TopoJSON.Net are licensed under MIT. Refer to LICENSE.md for more information.

topojson.net's People

Contributors

joergbattermann avatar gzuri avatar philo avatar vincentsels avatar matt-lethargic avatar freddixx avatar jhuntoo avatar xfischer avatar

Watchers

Sean Walsh avatar James Cloos 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.