POST
|
In your revised snippet you don't need to convert the point to web mercator if your featurelayer is in geographic. I ran a quick test using the code below and was able to add a point with no errors. Here's the code:
function addData(){
var x = dojo.byId('xval').value;
var y = dojo.byId('yval').value;
var point = new esri.geometry.Point(x,y,new esri.SpatialReference({wkid:4326}));
var graphic = new esri.Graphic(point,null,null);
featureLayer.applyEdits([graphic],null,null, function(addResults,updateResults,deleteResults) {
console.log("ObjectId = " + addResults[0].objectId);
},function(error){
console.log("error occurred");
});
}
... View more
08-25-2010
11:15 AM
|
0
|
0
|
464
|
POST
|
Perhaps there are some required attributes? If there are try setting them to see if it resolves the error. Here's an example that shows how to set attributes for the graphic.
var attributes = {};
attributes.SPEED = location.coords.speed;
attributes.ACCURACY = location.coords.accuracy;
attributes.DATETIME = now.getTime();
var pt = esri.geometry.geographicToWebMercator(new esri.geometry.Point(location.coords.longitude, location.coords.latitude));
var graphic = new esri.Graphic(new esri.geometry.Point(pt, map.spatialReference), null, attributes);
featureLayer.applyEdits([graphic], null, null, function(adds) {
... View more
08-25-2010
08:21 AM
|
0
|
0
|
464
|
POST
|
Yes you can build editing applications using the compact build. Some of the modules you need are not included but you can load them using dojo.require. For example to work with feature layers you would need to add the following: dojo.require("esri.layers.FeatureLayer");
... View more
08-25-2010
08:16 AM
|
0
|
0
|
194
|
POST
|
It's probably just a typo but thought I'd check just in case, in the code snippet below it looks like there's a space in Utility? esriDojo.require("MyModules.Utilities.MyTestUtilit y"); Hi, I can't get local modules to reload anymore with the namespace change. In the code below I can not get into init_2 (I get cross-domain loading errors), though the in-line dijit is created just fine. Hoping you can see where I have gone wrong without having to create your own test utility resource to try this one out. <!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> <title>(esriDojo Testing)</title> <!-- styling --> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.0/js/dojo/dijit/themes/tundra/tundra.css"/> <!-- Set dojo configuration --> <script type="text/javascript"> djConfig = { isDebug: true, parseOnLoad: true, xdWaitSeconds: 10, scopeMap: [ ["dojo", "esriDojo"], ["dijit", "esriDijit"], ["dojox", "esriDojox"] ], baseUrl: "./", modulePaths: { "MyModules": "./MyModules" } }; </script> <!-- v2.0 uses Dojo v1.4.2 --> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0"></script> <script type="text/javascript"> esriDojo.require("dijit.form.DropDownButton"); esriDojo.require("dijit.Menu"); esriDojo.addOnLoad(init_1); function init_1() { console.log("in init_1()"); esriDojo.require("MyModules.Utilities.MyTestUtility"); esriDojo.addOnLoad(init_2); } function init_2(){ console.log("in init_2()"); } </script> </head> <body class="tundra"> <button esriDojoType="dijit.form.DropDownButton"> <span>Test DDBtn</span> <div esriDojoType="dijit.Menu"> <div esriDojoType="dijit.MenuItem" label="Some menu item 1"> <script type="dojo/method" event="onClick" args="evt"> console.log("ok 1"); </script> </div> <div esriDojoType="dijit.MenuItem" label="Some menu item 2"> <script type="dojo/method" event="onClick" args="evt"> console.log("ok 2"); </script> </div> </div> </button> </body> </html> Loren
... View more
08-19-2010
08:39 AM
|
0
|
0
|
315
|
POST
|
Alex, Not sure if this is the issue but it's something to check out. In the showResults function the address candidates returned by the locater are converted from geographic to Web Mercator. However it looks like your map is using wkid 2264 not Web Mercator.
var geom = esri.geometry.geographicToWebMercator(candidate.location);
var graphic = new esri.Graphic(geom, symbol, attributes, infoTemplate);
... View more
08-17-2010
12:50 PM
|
0
|
0
|
181
|
POST
|
Loren, I ran a quick test and it works if you change the attribute dojoType to esriDojoType. Here's the revised code: <!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>
<title>testing dojo Scope</title>
<!-- styling -->
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.0/js/dojo/dijit/themes/tundra/tundra.css"/>
<!-- Set dojo configuration -->
<script type="text/javascript">
djConfig = {
parseOnLoad: true,
scopeMap: [
["dojo", "esriDojo"],
["dijit", "esriDijit"],
["dojox", "esriDojox"]
]
};
</script>
<!-- v2.0 uses Dojo v1.4.2 -->
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0"></script>
<script type="text/javascript">
esriDojo.require("dijit.form.DropDownButton");
esriDojo.require("dijit.Menu");
</script>
</head>
<body class="tundra">
<button esriDojoType="dijit.form.DropDownButton">
<span>Test DDBtn</span>
<div esriDojoType="dijit.Menu">
<div esriDojoType="dijit.MenuItem" label="Some menu item 1">
<script type="dojo/method" event="onClick" args="evt">
console.log("ok");
alert("ok");
</script>
</div>
<div esriDojoType="dijit.MenuItem" label="Some menu item 2">
<script type="dojo/method" event="onClick" args="evt">
console.log("ok");
alert("ok");
</script>
</div>
</div>
</button>
</body>
</html>
... View more
08-17-2010
12:25 PM
|
0
|
0
|
235
|
POST
|
Rob, It looks like the accordion pane you want to display the editor on is not visible when the application first loads. In cases like this you can create the editor widget the first time you show the editor panel, here's a snippet that shows this: var accordion = dijit.byId("myAccordionContainer");
dojo.connect(accordion, "selectChild", function(childPane) {
if(childPane.id === "paneEditor"){
if(!editorWidget){
var featureLayerInfos = dojo.map(results, function(result) {
return {'featureLayer':result.layer};
});
var layers = dojo.map(results,function(result) {
return result.layer;
});
var settings = {
map: map,
geometryService: new esri.tasks.GeometryService("http://sampleserver3.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer"),
layerInfos:featureLayerInfos
};
var params = {settings: settings};
editorWidget = new esri.dijit.editing.Editor(params,'editorDiv');
editorWidget.startup();
}
}
});
... View more
08-16-2010
09:43 AM
|
0
|
0
|
362
|
POST
|
John, You can download a local copy of v2.0 of the api from the ArcGIS Resource Center. http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_faq.htm
... View more
08-16-2010
09:41 AM
|
0
|
0
|
579
|
POST
|
There are a few issues that browsers like Chrome and Firefox don't have problems with that IE does, for example, trailing commas. I've found tools like JSLint helpful in finding these issues, there's an online version of the tool here: http://www.jslint.com/
... View more
08-09-2010
09:03 AM
|
0
|
0
|
145
|
POST
|
The Identify Task sample from the help, shows how to highlight a feature from an info window. http://help.arcgis.com/EN/webapi/javascript/arcgis/demos/identify/identify_drilldown.html
... View more
08-03-2010
07:36 AM
|
0
|
0
|
164
|
POST
|
Version 2.0 of the ArcGIS API for Javascript is now also available for download from the ArcGIS Resource Center. http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_faq.htm
... View more
07-30-2010
03:39 PM
|
0
|
0
|
286
|
POST
|
It looks like you are creating a string that looks like an array from your x,y values. You should be able to do something like this instead:
var coords = [];
var polyline = new esri.geometry.Polyline(new esri.SpatialReference({wkid:102100}));
for (i=0;i < xPoints.length -1;i++){
coords.push([xPoints, yPoints]);
}
polyline.addPath(coords);
... View more
07-23-2010
09:17 AM
|
0
|
0
|
680
|
POST
|
There is a sample on the Code Gallery that uses the 1.5 version of the JS API to display data over time, perhaps it will help you setup something similar? http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=codeGalleryDetails&scriptID=16642
... View more
07-22-2010
08:44 AM
|
0
|
0
|
175
|
POST
|
Clint, Is this problem only occurring in a particular browser? Maybe IE? If so we added a sample that may help, take a look at the autofocus and refocus code. http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/map_dialog.html
... View more
07-14-2010
10:07 AM
|
0
|
0
|
198
|
POST
|
Here is a link to a help topic that explains how to work with the bing maps keys. http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/ve_getting_started.htm And here's a link to a sample that shows this in action: http://help.arcgis.com/EN/webapi/javascript/arcgis/demos/ve/ve_layer.html
... View more
06-30-2010
10:52 AM
|
0
|
0
|
657
|
Title | Kudos | Posted |
---|---|---|
1 | yesterday | |
1 | Friday | |
1 | a week ago | |
2 | 05-29-2024 10:03 AM | |
1 | 05-24-2024 11:46 AM |
Online Status |
Offline
|
Date Last Visited |
yesterday
|