Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var data = <?php echo $defaultvaluepath ?>;
- var mygeojson = {"type": "FeatureCollection","features":[data]};
- // console.log(mygeojson);
- var layerwilayah = L.geoJson(null);
- layerwilayah.addData(mygeojson);
- layerwilayah.addTo(map);
- // create fullscreen control
- var fsControl = L.control.fullscreen();
- // add fullscreen control to the map
- map.addControl(fsControl);
- // detect fullscreen toggling
- map.on('enterFullscreen', function(){
- if(window.console) window.console.log('enterFullscreen');
- });
- map.on('exitFullscreen', function(){
- if(window.console) window.console.log('exitFullscreen');
- });
- var featureGroup = new L.FeatureGroup().addTo(map);
- console.log(featureGroup);
- map.addLayer(featureGroup);
- var drawControl = new L.Control.Draw({
- edit: {
- featureGroup: featureGroup,
- edit : true,
- },
- draw: {
- polyline: false,
- polygon: true,
- rectangle: false,
- circle: false,
- marker: false,
- circlemarker: false,
- },
- });
- map.addControl(drawControl);
- map.on(L.Draw.Event.CREATED, function (event) {
- var layer = event.layer;
- });
- map.on('draw:created', function (e) {
- var type = e.layerType,
- layer = e.layer;
- var drawnJSONObject = layer.toGeoJSON();
- var objectGeometry = Terraformer.WKT.convert(drawnJSONObject.geometry);
- if (type === 'polyline') {
- $('#path').val(JSON.stringify(drawnJSONObject));
- } else if (type === 'polygon') {
- $('#path').val(JSON.stringify(drawnJSONObject));
- } else {
- console.log('__undefined__');
- }
- featureGroup.addLayer(layer);
- });
- map.on('draw:edited', function(e){
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement