areaeditor

An editor integrated with Google Maps for editing GeoJSON MultiPolygons

npm install areaeditor
12 downloads in the last week
21 downloads in the last month

AreaEditor

An editor integrated with Google Maps for editing GeoJSON MultiPolygons

Installation

npm install areaeditor

Usage / example

  # Require the module
  AreaEditor = require("areaeditor")

  # Have a div somewhere for the Map
  myMapCanvasDiv = document.getElementById("map_canvas")

  # Set up Google Map as you like
  myGMap = new window.google.maps.Map(myMapCanvasDiv, {
    center: new window.google.maps.LatLng(-34.397, 150.644),
    zoom: 8,
    mapTypeId: window.google.maps.MapTypeId.ROADMAP
  })

  # Have some GeoJSON to input (or not) - can be both string or object
  myGeoJSON = '{"type":"MultiPolygon","coordinates":[[[[7.13287353515625,63.0355375118036],[7.66021728515625,63.2044210747013],[7.73162841796875,63.5294602771458],[8.13812255859375,63.5539348700531],[8.33038330078125,63.3649377897456],[8.72589111328125,63.4436336294534],[8.88519287109375,63.3575489817461],[8.81378173828125,63.2662640323993],[8.85772705078125,63.2217504450349],[8.81378173828125,63.1498897138285],[8.85223388671875,63.1201020510924],[9.1571044921875,63.132020754569],[9.22027587890625,63.214324843286],[9.34112548828125,63.2242252219395],[9.51141357421875,63.1697311764632],[9.43450927734375,63.0454990414301],[9.59381103515625,63.0106187868796],[9.44000244140625,62.9282358140151],[9.45648193359375,62.8481273410528],[9.27520751953125,62.7677998835366],[9.06097412109375,62.7451682700597],[8.92364501953125,62.7099290155062],[8.98956298828125,62.6620370316591],[9.17633056640625,62.5812014868792],[9.25323486328125,62.5660202941802],[9.17633056640625,62.4315827237481],[8.95660400390625,62.3577657713579],[8.31390380859375,62.3526682408084],[8.1353759765625,62.3036878433398],[7.899169921875,62.4564866375814],[8.3056640625,62.7886558451373],[8.140869140625,62.8375968257987],[7.6519775390625,62.8300727408915],[7.28668212890625,62.8801969531428],[7.13287353515625,63.0355375118036]]]]}'

  # Set up an AreaEditor for your map
  myEditor = new AreaEditor(myGMap, myGeoJSON, {jQuery: $})

  # Do some editing and get the new GeoJSON by:
  myEditor.json()

License

Copyright (C) 2013 Per-Kristian Nordnes

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

npm loves you