POST
|
Hi Mark, Can we achieve that functionality using 3.x ?
... View more
05-07-2020
12:53 AM
|
0
|
2
|
465
|
POST
|
Can we draw a line by selecting Point A and PointB on a existing polyline which is not a straghit line using arcgis javascript Api?
... View more
05-06-2020
10:56 PM
|
0
|
4
|
585
|
POST
|
Can we do one to many relationship using javascript api if any one have any example please share.
... View more
06-28-2017
05:50 AM
|
0
|
0
|
466
|
POST
|
Can anyone share any code regarding Batch Editor for Free Hand Polygon for saving features?
... View more
06-20-2017
06:20 AM
|
0
|
0
|
336
|
POST
|
1.Differences Between query task and feature layer 2.Can we find features using query task?
... View more
03-16-2017
05:00 AM
|
0
|
5
|
1007
|
POST
|
how to give customized values in attributes while editing var newGraphic = new Graphic(point2, null, newAttributes);
... View more
02-14-2017
02:37 AM
|
0
|
4
|
716
|
POST
|
Hello Robert, I am unable to do applyedits for the second time when i click on map i am using javascript version 3.18 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="https://js.arcgis.com/3.18/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Landuse</title> <link rel="stylesheet" href="https://js.arcgis.com/3.18/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; overflow: hidden; } .btn { background: #3f3f3f; color: #fff; font-family: Tahoma; font-size: 11px; height: 18px; } .lbl { color: #000; font-family: Tahoma; font-size: 11px; font-weight: 200; } #header { border: solid 2px #462d44; background: #fff; color: #444; -moz-border-radius: 4px; border-radius: 4px; font-family: sans-serif; font-size: 1.1em padding-left:20px; } #map { padding: 1px; border: solid 2px #444; -moz-border-radius: 4px; border-radius: 4px; } #rightPane { border: none; padding: 0; width: 228px; } .templatePicker { border: solid 2px #444; } </style> <script src="https://js.arcgis.com/3.18/"></script> <script type="text/javascript"> var map; require([ "dojo/dom", "dojo/on", "esri/map", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/toolbars/draw", "esri/toolbars/edit", "esri/graphic", "esri/config", "esri/tasks/QueryTask", "esri/tasks/query", "esri/Color", "esri/geometry/Polyline", "esri/geometry/Point", "esri/layers/FeatureLayer", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol", "esri/symbols/CartographicLineSymbol", "esri/dijit/editing/TemplatePicker", "dojo/_base/array", "dojo/_base/event", "dojo/_base/lang", "dojo/parser", "dijit/registry", "dojo/_base/Color", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/form/Button", "dojo/domReady!" ], function ( dom, on, Map, ArcGISDynamicMapServiceLayer, Draw, Edit, Graphic, esriConfig, QueryTask, Query, Color, Polyline, Point, FeatureLayer, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol, CartographicLineSymbol, TemplatePicker, arrayUtils, event, lang, parser, registry, Color ) { parser.parse(); // refer to "Using the Proxy Page" for more information: https://developers.arcgis.com/javascript/3/jshelp/ags_proxy.html esriConfig.defaults.io.proxyUrl = "/proxy/"; // This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications. esriConfig.defaults.geometryService = new esri.tasks.GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); map = new Map("map", { center: [-83.244, 42.581], zoom: 15 }); var executeQueryTask; var line; var lineSymbol; var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/edit/MapServer"); map.addLayer(dynamicMapServiceLayer); //initialize query task var queryTask = new QueryTask("http://localhost:6080/ArcGIS/rest/services/edit/MapServer/20"); //initialize query var query = new Query(); query.returnGeometry = true; query.outFields = ["LTP_ID", "OBJECTID"]; symbol = new SimpleMarkerSymbol(); symbol.setStyle(SimpleMarkerSymbol.STYLE_SQUARE); symbol.setSize(10); symbol.setColor(new Color([255, 255, 0, 0.5])); on(dom.byId("execute"), "click", execute); on(dom.byId("ltext"), "click", ltext); var landusePointLayer = new FeatureLayer("http://localhost:6080/arcgis/rest/services/edit/FeatureServer/20", { mode: FeatureLayer.MODE_SNAPSHOT, outFields: ["*"] }); var landuseLineLayer = new FeatureLayer("http://localhost:6080/arcgis/rest/services/edit/FeatureServer/34", { mode: FeatureLayer.MODE_SNAPSHOT, outFields: ["*"] }); // map.on("layers-add-result",setupEditor); map.addLayers([landusePointLayer, landuseLineLayer]); function execute() { debugger; query.text = dom.byId("stateName").value; queryTask.execute(query, showResults); } function showResults(featureSet) { debugger; map.graphics.clear(); //Performance enhancer - assign featureSet array to a single variable. var resultFeatures = featureSet.features; //Loop through each feature returned for (var i = 0, il = resultFeatures.length; i < il; i++) { //Get the current feature from the featureSet. //Feature is a graphic var graphic = resultFeatures; graphic.setSymbol(symbol); //Set the infoTemplate. //graphic.setInfoTemplate(infoTemplate); //Add graphic to the map graphics layer. map.graphics.add(graphic); if (graphic.geometry.type === 'point') { map.centerAndZoom(graphic.geometry, 0.001); } } } function ltext() { debugger; line = new Polyline(map.spatialReference); lineSymbol = new CartographicLineSymbol( CartographicLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 10, CartographicLineSymbol.CAP_ROUND, CartographicLineSymbol.JOIN_MITER, 5 ); pointSymbol = new SimpleMarkerSymbol().setColor(new Color([255, 0, 0, 0.5])); dojo.connect(map, "onClick", addPt); } function addPt(e) { debugger; var pathCount = line.paths.length; console.log(pathCount); // console.log(e.mapPoint.y); // console.log(e.mapPoint.x); if (pathCount == 0) { var point1 = new Point(218966.696, 1173294.233, map.spatialReference); var point2 = new Point(e.mapPoint.x, e.mapPoint.y, map.spatialReference); line.addPath([point1, point2]); map.graphics.add(new Graphic(point1, pointSymbol)); map.graphics.add(new Graphic(point2, pointSymbol)); map.graphics.add(new Graphic(line, lineSymbol)); var template = landusePointLayer.templates[0]; var newAttributes = lang.mixin({}, template.prototype.attributes); var newGraphic = new Graphic(point2, null, newAttributes); landusePointLayer.applyEdits([newGraphic], null, null); var template1 = landuseLineLayer.templates[0]; var newAttributes = lang.mixin({}, template1.prototype.attributes); var newGraphicss = new Graphic(line, null, newAttributes); landuseLineLayer.applyEdits([newGraphicss], null, null); } else { var getX = line.paths[pathCount - 1][line.paths[pathCount - 1].length - 1][0], getY = line.paths[pathCount - 1][line.paths[pathCount - 1].length - 1][1], mapPointX = e.mapPoint.x, mapPointY = e.mapPoint.y; var pointS = new Point(getX, getY, map.spatialReference); var pointD = new Point(mapPointX, mapPointY, map.spatialReference); line.addPath([pointS, pointD]); /////////////////////////////////////////////////////////////////////////////////////////////// map.graphics.add(new Graphic(pointS, pointSymbol)); map.graphics.add(new Graphic(pointD, pointSymbol)); map.graphics.add(new Graphic(line, pointSymbol)); var template1 = landusePointLayer.templates[0]; var newAttributes = lang.mixin({}, template1.prototype.attributes); var newGraphic = new Graphic(pointD, null, newAttributes); landusePointLayer.applyEdits([newGraphic], null, null); var template1 = landuseLineLayer.templates[0]; var newAttributessss = lang.mixin({}, template1.prototype.attributes); var newGraphicss = new Graphic(line, null, newAttributessss); landuseLineLayer.applyEdits([newGraphicss], null, null); } } }); </script> </head> <body class="claro"> <div style="height: 30px; border: solid 1px; border-color: #e4e4e4; width: 100%; background: #f0ebff"> Header </div> <div style="height: 25px; border: solid 1px; border-color: #e4e4e4; width: 100%; background: #d2d2d2; text-align: center"> ToolBar </div> <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="gutters:true, design:'headline'" style="width: 100%; height: 100%;"> <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"> </div> <div id="rightPane" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'right'"> <span class="lbl">Enter Value :</span> <input type="text" id="stateName" > <input id="execute" type="button" value="Get Details"> <input id="ltext" type="button" value="Start LT Ext" /> </div> </div> </body> </html>
... View more
12-06-2016
02:20 AM
|
0
|
0
|
457
|
POST
|
Hi , i am unable to edit line feature on map click for the second time below is the code i have used landuselinelayer is line feature, landusepointlayer is point feature (for the second time i'm getting following error unable to complete operation) <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="https://js.arcgis.com/3.18/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Landuse</title> <link rel="stylesheet" href="https://js.arcgis.com/3.18/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; overflow: hidden; } .btn { background: #3f3f3f; color: #fff; font-family: Tahoma; font-size: 11px; height: 18px; } .lbl { color: #000; font-family: Tahoma; font-size: 11px; font-weight: 200; } #header { border: solid 2px #462d44; background: #fff; color: #444; -moz-border-radius: 4px; border-radius: 4px; font-family: sans-serif; font-size: 1.1em padding-left:20px; } #map { padding: 1px; border: solid 2px #444; -moz-border-radius: 4px; border-radius: 4px; } #rightPane { border: none; padding: 0; width: 228px; } .templatePicker { border: solid 2px #444; } </style> <script src="https://js.arcgis.com/3.18/"></script> <script type="text/javascript"> var map; require([ "dojo/dom", "dojo/on", "esri/map", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/toolbars/draw", "esri/toolbars/edit", "esri/graphic", "esri/config", "esri/tasks/QueryTask", "esri/tasks/query", "esri/Color", "esri/geometry/Polyline", "esri/geometry/Point", "esri/layers/FeatureLayer", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol", "esri/symbols/CartographicLineSymbol", "esri/dijit/editing/TemplatePicker", "dojo/_base/array", "dojo/_base/event", "dojo/_base/lang", "dojo/parser", "dijit/registry", "dojo/_base/Color", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/form/Button", "dojo/domReady!" ], function ( dom, on, Map, ArcGISDynamicMapServiceLayer, Draw, Edit, Graphic, esriConfig, QueryTask, Query, Color, Polyline, Point, FeatureLayer, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol, CartographicLineSymbol, TemplatePicker, arrayUtils, event, lang, parser, registry, Color ) { parser.parse(); // refer to "Using the Proxy Page" for more information: https://developers.arcgis.com/javascript/3/jshelp/ags_proxy.html esriConfig.defaults.io.proxyUrl = "/proxy/"; // This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications. esriConfig.defaults.geometryService = new esri.tasks.GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); map = new Map("map", { center: [-83.244, 42.581], zoom: 15 }); var executeQueryTask; var line; var lineSymbol; var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/edit/MapServer"); map.addLayer(dynamicMapServiceLayer); //initialize query task var queryTask = new QueryTask("http://localhost:6080/ArcGIS/rest/services/edit/MapServer/20"); //initialize query var query = new Query(); query.returnGeometry = true; query.outFields = ["LTP_ID", "OBJECTID"]; symbol = new SimpleMarkerSymbol(); symbol.setStyle(SimpleMarkerSymbol.STYLE_SQUARE); symbol.setSize(10); symbol.setColor(new Color([255, 255, 0, 0.5])); on(dom.byId("execute"), "click", execute); on(dom.byId("ltext"), "click", ltext); var landusePointLayer = new FeatureLayer("http://localhost:6080/arcgis/rest/services/edit/FeatureServer/20", { mode: FeatureLayer.MODE_SNAPSHOT, outFields: ["*"] }); var landuseLineLayer = new FeatureLayer("http://localhost:6080/arcgis/rest/services/edit/FeatureServer/34", { mode: FeatureLayer.MODE_SNAPSHOT, outFields: ["*"] }); // map.on("layers-add-result",setupEditor); map.addLayers([landusePointLayer, landuseLineLayer]); function execute() { debugger; query.text = dom.byId("stateName").value; queryTask.execute(query, showResults); } function showResults(featureSet) { debugger; map.graphics.clear(); //Performance enhancer - assign featureSet array to a single variable. var resultFeatures = featureSet.features; //Loop through each feature returned for (var i = 0, il = resultFeatures.length; i < il; i++) { //Get the current feature from the featureSet. //Feature is a graphic var graphic = resultFeatures; graphic.setSymbol(symbol); //Set the infoTemplate. //graphic.setInfoTemplate(infoTemplate); //Add graphic to the map graphics layer. map.graphics.add(graphic); if (graphic.geometry.type === 'point') { map.centerAndZoom(graphic.geometry, 0.001); } } } function ltext() { debugger; line = new Polyline(map.spatialReference); lineSymbol = new CartographicLineSymbol( CartographicLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 10, CartographicLineSymbol.CAP_ROUND, CartographicLineSymbol.JOIN_MITER, 5 ); pointSymbol = new SimpleMarkerSymbol().setColor(new Color([255, 0, 0, 0.5])); dojo.connect(map, "onClick", addPt); } function addPt(e) { debugger; var pathCount = line.paths.length; console.log(pathCount); // console.log(e.mapPoint.y); // console.log(e.mapPoint.x); if (pathCount == 0) { var point1 = new Point(218966.696, 1173294.233, map.spatialReference); var point2 = new Point(e.mapPoint.x, e.mapPoint.y, map.spatialReference); line.addPath([point1, point2]); map.graphics.add(new Graphic(point1, pointSymbol)); map.graphics.add(new Graphic(point2, pointSymbol)); map.graphics.add(new Graphic(line, lineSymbol)); var template = landusePointLayer.templates[0]; var newAttributes = lang.mixin({}, template.prototype.attributes); var newGraphic = new Graphic(point2, null, newAttributes); landusePointLayer.applyEdits([newGraphic], null, null); var template1 = landuseLineLayer.templates[0]; var newAttributes = lang.mixin({}, template1.prototype.attributes); var newGraphicss = new Graphic(line, null, newAttributes); landuseLineLayer.applyEdits([newGraphicss], null, null); } else { var getX = line.paths[pathCount - 1][line.paths[pathCount - 1].length - 1][0], getY = line.paths[pathCount - 1][line.paths[pathCount - 1].length - 1][1], mapPointX = e.mapPoint.x, mapPointY = e.mapPoint.y; var pointS = new Point(getX, getY, map.spatialReference); var pointD = new Point(mapPointX, mapPointY, map.spatialReference); line.addPath([pointS, pointD]); /////////////////////////////////////////////////////////////////////////////////////////////// map.graphics.add(new Graphic(pointS, pointSymbol)); map.graphics.add(new Graphic(pointD, pointSymbol)); map.graphics.add(new Graphic(line, pointSymbol)); var template1 = landusePointLayer.templates[0]; var newAttributes = lang.mixin({}, template1.prototype.attributes); var newGraphic = new Graphic(pointD, null, newAttributes); landusePointLayer.applyEdits([newGraphic], null, null); var template1 = landuseLineLayer.templates[0]; var newAttributessss = lang.mixin({}, template1.prototype.attributes); var newGraphicss = new Graphic(line, null, newAttributessss); landuseLineLayer.applyEdits([newGraphicss], null, null); } } }); </script> </head> <body class="claro"> <div style="height: 30px; border: solid 1px; border-color: #e4e4e4; width: 100%; background: #f0ebff"> Header </div> <div style="height: 25px; border: solid 1px; border-color: #e4e4e4; width: 100%; background: #d2d2d2; text-align: center"> ToolBar </div> <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="gutters:true, design:'headline'" style="width: 100%; height: 100%;"> <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"> </div> <div id="rightPane" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'right'"> <span class="lbl">Enter Value :</span> <input type="text" id="stateName" > <input id="execute" type="button" value="Get Details"> <input id="ltext" type="button" value="Start LT Ext" /> </div> </div> </body> </html>@@@#
... View more
12-06-2016
02:17 AM
|
0
|
0
|
1205
|
POST
|
Is there anything like apply edits works for only while drawing for me apply edits working when i draw a polyline but onclick i'm unable to apply edits
... View more
11-29-2016
07:14 AM
|
0
|
2
|
457
|
POST
|
Hi all, while applying edits to the polyline feature im getting the following (error:unable to complete operation index:15) even after attributes and geometry are filling here is the code im applying edits for point and line feature at the same time var newGraphic = new esri.Graphic(ltp, null, attributes); landusePointLayer.applyEdits([newGraphic]); var newGraphicss= new esri.Graphic(kkk,null,attributes1); landuseLineLayer.applyEdits([newGraphicss])
... View more
11-28-2016
10:50 PM
|
0
|
4
|
1247
|
POST
|
Robert, The stuff suggest by you was helpul now i'm able to edit point layer but unable to edit polyline i'm posting my code here please do the needful <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>LT ext</title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/esri/css/esri.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; overflow: hidden; } .btn { background: #3f3f3f; color: #fff; font-family: Tahoma; font-size: 11px; height: 18px; } .lbl { color: #000; font-family: Tahoma; font-size: 11px; font-weight: 200; } #header { border: solid 1px #e4e4e4; background: #fff; color: #749749; -moz-border-radius: 4em; border-radius: 4em; font-size: 14px; padding-left: 20px; font-weight: 700; } #map { padding: 1px; border: solid 1px #e4e4e4; -moz-border-radius: 4px; border-radius: 4px; } #rightPane { border: none; width: 250px; height: 95%; padding-bottom: 10px; top: 20px; border: solid 1px #e4e4e4; } .templatePicker { border: solid 2px #e4e4e4 !important; } </style> <script> var dojoConfig = { parseOnLoad: true };</script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); dojo.require("esri.dijit.editing.TemplatePicker-all"); dojo.require("esri.tasks.query"); dojo.require("esri.toolbars.draw"); dojo.require("esri.dijit.AttributeInspector-all"); var map, line, lineGraphic, toolbar, symbol, geomTask; var landuseLineLayer; var landusePointLayer; var drawToolbar; var fieldName1; var newFieldValue1; var newGraphic1; function init() { //This sample requires a proxy page to handle communications with the ArcGIS Server services. You will need to //replace the url below with the location of a proxy on your machine. See the 'Using the proxy page' help topic //for details on setting up a proxy page. esri.config.defaults.io.proxyUrl = "/proxy"; esri.config.defaults.io.alwaysUseProxy = false; //This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications. esri.config.defaults.geometryService = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); map = new esri.Map("map", { center: [-83.244, 42.581], zoom: 15 }); dojo.connect(map, "onLayersAddResult",setupEditor); queryTask = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/edit/MapServer/20"); // //initialize query query = new esri.tasks.Query(); query.returnGeometry = true; query.outFields = ["LTP_ID", "OBJECTID"]; // //create symbol for selected features symbol = new esri.symbol.SimpleMarkerSymbol(); symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE); symbol.setSize(10); //symbol.setColor(new esri.Color([255, 255, 0, 0.5])); var labels = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/edit/MapServer"); map.addLayer(labels); landusePointLayer = new esri.layers.FeatureLayer("http://localhost:6080/arcgis/rest/services/edit/FeatureServer/20", { mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, outFields: ["*"] }); landuseLineLayer = new esri.layers.FeatureLayer("http://localhost:6080/arcgis/rest/services/edit/FeatureServer/34", { mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, outFields: ["*"] }); map.addLayers([landusePointLayer, landuseLineLayer]); var ltline = landuseLineLayer; var ltpole = landusePointLayer; dojo.connect(map, "onLoad", function () { dojo.connect(dijit.byId("map"), "resize", map, map.resize); }); } var selectedTemplate; function LTEXT() { //var l = landuseLineLayer; var p1 = new esri.geometry.Point(218103.84229999967, 1172648.3827999998, map.spatialReference); line = new esri.geometry.Polyline(); line.addPath([p1]); dojo.connect(map, "onClick", addPt); } function addPt(e) { var selectedTemplate; var featureLayers; var geometryType; // create a new path using the current line endpoint and the click point //var p2 = esri.geometry.geographicToWebMercator(new esri.geometry.Point(e.mapPoint.x, e.mapPoint.y, map.spatialReference)); //line.addPath([p2]); var pathCount = line.paths.length; line.addPath([line.paths[pathCount - 1][line.paths[pathCount - 1].length - 1], [e.mapPoint.x, e.mapPoint.y]]); lineGraphic = map.graphics.add(new esri.Graphic(line, new esri.symbol.SimpleLineSymbol())); map.graphics.add(new esri.Graphic(e.mapPoint, new esri.symbol.SimpleMarkerSymbol())); var ltp = e.mapPoint; var k = landuseLineLayer; var p = landusePointLayer; saveedits(lineGraphic, landuseLineLayer, landusePointLayer,ltp) //lineGraphic.setGeometry(line); // var newGraphic = new esri.Graphic(lineGraphic, null); // landuseLineLayer.applyEdits([newGraphic], null, null); ///////////////////////////////////////////////////////////////////////////////////////////// } function saveedits(linegraphic,landuseLineLayer,landusePointLayer,ltp) { debugger; var template = landusePointLayer.templates[0]; var template1 = landuseLineLayer.templates[0]; var attributes = dojo.mixin({}, template.prototype.attributes); var attributes1 = dojo.mixin({}, template1.prototype.attributes); var newGraphic = new esri.Graphic(ltp, null, attributes); landusePointLayer.applyEdits([newGraphic]); var newGraphic1 = new esri.Graphic(pol, null, attributes1); landuseLineLayer.applyEdits([newGraphic1,null,null]); var ggg=pol; map.infoWindow.show(map.toScreen(pol)); updateAttributes(newGraphic,newGraphic1,ggg); } function updateAttributes(newGraphic,newGraphic1,ggg,fieldName, newFieldValue) { debugger; //update attributes for feature newGraphic.attributes[fieldName] = newFieldValue; landusePointLayer.applyEdits(null, [newGraphic]); updateltline(newGraphic1,fieldName1, newFieldValue1,ggg); } function updateltline(newGraphic1,fieldName1,newFieldValue1,ggg) { debugger; var fieldNamel; //update attributes for feature map.infoWindow.show(map.toScreen(ggg)); // map.infoWindow.show(map.toScreen(ggg)); newGraphic1.attributes[fieldName1] = newFieldValue1; // map.infoWindow.show(map.toScreen(ggg)); landuseLineLayer.applyEdits(null, [newGraphic1]); } function hideAttributes(){ if(map.infoWindow.isShowing){ map.infoWindow.hide(); } } function setupEditor(results){ //setup the draw toolbar and an event that will fire after the point has been drawn. // drawToolbar = new esri.toolbars.Draw(map); //dojo.connect("onClickEnd",saveedits); // map.on("click", myClickHandler); //dojo.connect(map, "onClick", saveedits); //Create the attribute inspector so we can update attributes //first lets get the feature layers to associate with the attribute inspector var layerInfos = dojo.map(results, function(result) { return { 'featureLayer':result.layer, 'showAttachments': false }; }); attributeInspector = new esri.dijit.AttributeInspector({ layerInfos: layerInfos, },dojo.create("div")); //display the attribute inspector in the popup map.infoWindow.setTitle("Edit Features"); map.infoWindow.setContent(attributeInspector.domNode); dojo.connect(attributeInspector, "onAttributeChange", updateAttributes); dojo.connect(attributeInspector, "onDelete", deleteFeature); } function executeQueryTask(sTownID) { query.where = "LTP_ID ='" + sTownID + "'"; //execute query queryTask.execute(query, showResults); } function showResults(featureSet) { //remove all graphics on the maps graphics layer map.graphics.clear(); //Performance enhancer - assign featureSet array to a single variable. var resultFeatures = featureSet.features; console.log(resultFeatures); //Loop through each feature returned for (var i = 0, il = resultFeatures.length; i < il; i++) { //Get the current feature from the featureSet. //Feature is a graphic var graphic = resultFeatures; graphic.setSymbol(symbol); //Set the infoTemplate. //graphic.setInfoTemplate(infoTemplate); //Add graphic to the map graphics layer. map.graphics.add(graphic); if (graphic.geometry.type === 'point') { map.centerAndZoom(graphic.geometry, 0.001); } } } dojo.ready(init); </script> </head> <body class="claro"> <div style="height: 30px; border: solid 1px; border-color: #e4e4e4; width: 100%; background: #f0ebff"> Header </div> <div style="height: 25px; border: solid 1px; border-color: #e4e4e4; width: 100%; background: #d2d2d2; text-align: center"> ToolBar </div> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="gutters:true, design:'sidebar'" style="width: 100%; height: 100%;"> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> </div> <div id="rightPane" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'right'"> <span class="lbl">Enter Value :</span> <input type="text" id="pop" style="width: 150px;" /> <input type="button" value="Zoom" onclick="executeQueryTask(dojo.byId('pop').value);" class="btn" /> <div id="templatePickerDiv1"> <input type="button" id="templatePickerDiv" value="Start LT Ext" onclick="LTEXT()" class="btn" /> </div> </div> </div> </body> </html>
... View more
11-18-2016
04:40 AM
|
0
|
1
|
750
|
Title | Kudos | Posted |
---|---|---|
1 | 10-14-2015 09:06 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|