iitc-project / ingress-intel-total-conversion

ingress.com/intel total conversion user script with some new features. Should allow easier extension of the intel map.
http://iitc.jonatkins.com/
ISC License
991 stars 553 forks source link

Draw Tools and GeoJSON #873

Open Manriel opened 10 years ago

Manriel commented 10 years ago

Draw Tools in copy-paste-clear dialog need to support GeoJSON format and export data in GeoJSON format as default.

http://geojson.org/geojson-spec.html

3ch01c commented 9 years ago

The existing format may play nice with leaflet or whatever is doing the drawing, but just to be clear, this JSON

[
  {
    "type":"polygon",
    "latLngs":[
      {"lat":35.66440930916498,"lng":-106.00459098815917},
      {"lat":35.6898577188944,"lng":-105.95017433166504},
      {"lat":35.651647189415,"lng":-105.97197532653809}
    ],
    "color":"#a24ac3"
  },
  {
    "type":"polyline",
    "latLngs":[
      {"lat":35.64997331752026,"lng":-106.00064277648924},
      {"lat":35.63832498777987,"lng":-105.9587574005127}
    ],
    "color":"#a24ac3"
  }
]

would become this GeoJSON?

[
  {
    "type": "Polygon",
    "coordinates": [[
      [35.66440930916498, -106.00459098815917],
      [35.6898577188944, -105.95017433166504],
      [35.651647189415, -105.97197532653809]
    ]],
    "properties": {
      "color":"#a24ac3"
    }
  },
  {
    "type": "LineString",
    "coordinates": [
      [35.64997331752026,-106.00064277648924],
      [35.63832498777987,-105.9587574005127]
    ],
    "properties": {
      "color":"#a24ac3"
    }
  }
]
fkloft commented 9 years ago

I took a look at this, but although I support this, I didn't implement it yet, since it is more work than one would expect.

Actually, Leaflet already has an implementation for parsing GeoJSON, but it uses primitive map features instead of there geodesic counterparts. Also, for the L.Multi* classes, there is no geodesic implementation available.

strguntbr commented 9 years ago

I'm gonna take a look into that issue. I don't think we need perfect GeoJSON support, but it would be nice to be able to reuse exports from IITC with anything that is compatible to GeoJSON and to be able to import basic GeoJSON. Thus my plan would be the following: