POST
|
Can some one help me with a sample which shows how to use RecordSet(FeatureSet without Geometries) as an input for a GP using ArcGIS Javascript API. Thanks, Ranga You can look at the sample provided by ESRI on Tutorial DVD. if you stalled it. it's under %arcgis\ArcTutor\GP Service Examples\ClipAndShip. Specifically look at the clipUsingLayerTable script and models. Basically, RecordSet in GP is a registered table that resides in Geodatabase or a layer table on the mxd that you can interact with.
... View more
12-29-2010
05:19 AM
|
0
|
0
|
267
|
POST
|
try use the json expression to create a spatialReference, like the following: var spatialReference = new esri.SpatialReference({ "wkt": "GEOGCS[\"wgs\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]" }); Hi everybody, I'm using Buffer Service of Geometry Server what set up in ArcGIS Server over ArcGIS Javascript API version 1.6. My Spatial Reference is specific for my region and it have WKT format. I can not request buffer with My Spatial Reference and recieve results. Anybody have solution for my problem ? This is my Spatial Reference: GEOGCS["wgs",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] I hope I'll receive your answer soon. Thank you. Ps: Sorry about my English. It's not good.
... View more
12-22-2010
12:04 PM
|
0
|
0
|
210
|
POST
|
I will really appreciate if anybody can help me with this problem... Im working under Visual Studio for VisualBasic asp.net web aplication. I working on a tool which take a Coordinates from map image in JAVASCRIPT API a insert them in Oracle table. I found code in samples which return coordinates from image and I know how to insert another values(for example from string) to table. But i really freezing on solution how to get it everything together. I cannot export variable (coordinate) from javascript to VBscript(or directly to sql string). I found many answers thats not possible to do that on this way. So my question is how to do that? Is better to get everything under VBscript? or Is there any trick which i still dont seeing? This is code for Default.aspx.vb [HTML] Imports System Imports System.Data Imports Oracle.DataAccess.Client Partial Public Class _Default Inherits System.Web.UI.Page 'I need get coordinates for these two public variables(there are values just only for showing,thats code works) Public S As String = "5" Public D As String = "2" Dim con As OracleConnection = New OracleConnection() Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load con.ConnectionString = "User Id=sde;Password=esprit;Data Source=TURACEK2/ORCL;" '''''''''''''''' '2. Open database connection through ODP.NET: '''''''''''''''' Try ' Open the connection con.Open() Debug.Print("DATabase connected!") Catch ex As Exception Debug.Print(ex.Message) End Try '''''''''''''''' End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click '3. Create command object to perform a query against the database: '''''''''''''''' 'SURADNICE is my table Dim cmdQuery As String = "INSERT INTO SURADNICE (X, Y)VALUES(" & S & ", " & D & ")" ' Create the OracleCommand object Dim cmd As OracleCommand = New OracleCommand(cmdQuery) cmd.Connection = con cmd.CommandType = CommandType.Text '''''''''''''''' '4. Fetch data into an OracleDataReader object and display the data. Then, close the connection object: '''''''''''''''' Try ' Execute command, create OracleDataReader object Dim reader As OracleDataReader = cmd.ExecuteReader() While (reader.Read()) ' Output Employee Name and Number Debug.Print("Employee Number : " & _ reader.GetDecimal(0) & _ " , " & _ "Employee Name : " & _ reader.GetString(1)) End While Debug.Print("Values were added") Catch ex As Exception Debug.Print(ex.Message) Finally ' Dispose OracleCommand object cmd.Dispose() ' Close and Dispose OracleConnection object con.Close() con.Dispose() End Try End Sub End Class [/HTML] and this is code for Default.aspx [HTML]<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="Javascript_samotne_pripojenie2._Default" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="Oracle.DataAccess.Client" %> <% Dim MyServerSideVariable As String = ""%> <% Dim MyServerSideVariable2 As String = ""%> <!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"/> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <title>Project a point</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.6/js/dojo/dijit/themes/tundra/tundra.css"> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.6" type="text/javascript"></script> <script type="text/javascript"> dojo.require("esri.map"); dojo.require("esri.tasks.geometry"); var map = null; var gsvc = null; var pt = null; function initialize() { map = new esri.Map("map"); var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"); map.addLayer(layer); map.setExtent(new esri.geometry.Extent(-144.13584773952124, 7.981485927970198, -52.76454682003924, 68.8956865409582, new esri.SpatialReference({ wkid: 4326 }))); gsvc = new esri.tasks.GeometryService("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); dojo.connect(map, "onClick", projectToWebMercator); } function projectToWebMercator(evt) { map.graphics.clear(); var point = evt.mapPoint; var symbol = new esri.symbol.SimpleMarkerSymbol().setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND); var graphic = new esri.Graphic(point, symbol); var outSR = new esri.SpatialReference({ wkid: 102113 }); map.graphics.add(graphic); gsvc.project([graphic], outSR, function(features) { pt = features[0].geometry; var MyClientSideVariable = pt.x; var MyClientSideVariable2 = pt.y; graphic.setInfoTemplate(new esri.InfoTemplate("Coordinates", "<p> X: " + MyClientSideVariable + "<br/> Y: " + MyClientSideVariable2 + "</p>")); map.infoWindow .setTitle(graphic.getTitle()) .setContent(graphic.getContent()) .show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint)); }); } dojo.addOnLoad(initialize); </script> </head> <body class="tundra"> <b>Click a location on the map to Project from LatLng -> Web Mercator:</b> <div id="map" style="width:600px; height:400px; border:1px solid #000";></div> <input type="hidden" name="S" value="MyClientSideVariable"> <input type="hidden" name="V" value="MyClientSideVariable2"> add data: <form id="form1" runat="server" onclick="return form1_onclick()"> <div> <asp:Button ID="Button1" runat="server" Text="Button" /> </div> </form> </body> </html> [/HTML] My approach would be: create a web service that can be accessed by javascript. In that web service, create a logic to insert coordinates to oracle table. Reference some .net AJax articles to how to create a web service that can be accessed by javascript.
... View more
12-21-2010
04:01 AM
|
0
|
0
|
269
|
POST
|
I recently installed firebug and I'm still getting used to it. I've been debugging it the old fashion way with alerts. To answer some of the questions, I'm using the following: JavaScript API v2.1 ArcGIS Server 10.0 ArcMap 10.0 I've added to my code to get the attributes, and I can get all the visible fields and field attributes in a table (like parcel ids, owners, addresses, etc.), but no geography. I've set alerts to show graphic.geometry, and they return null. Looking through the examples ESRI provides, I dug into their mapservers and found the fields had a supported operation: Query Layer, while my layers only supported Query. I had your problem exactly one time. i found out that my query task in not set as globe variable. I corrected it and it works fine ever since. like this: var queryTask; function init(){ queryTask =new esri.....; }
... View more
12-17-2010
11:33 AM
|
0
|
0
|
1252
|
POST
|
Hi yall, I'm still a bit confused after doing a bit of research as to what my capabilities are at this point. I've got a couple basic maps up and going with the javascript api and others with the google api. But I've been 'envisioning' a map that uses google's map, script generated kml's (bus stops), and my own arcserver geocoding service. Can I do that? using my geocoder is a must. So, I guess: A) can I add kml through the javascript api? or B) can I use my own geocoder in a google map? Thanks!!! yes you can use your geocoder in a google map.
... View more
12-17-2010
11:11 AM
|
0
|
0
|
190
|
POST
|
Hi Forum, I have tried to implement VisibleLayers="0,1" to the widget 'Legend with Visible Layers' without any luck. Do you know how to set VisibleLayers in that sample? /Lars try this VisibleLayers=[0,1];
... View more
12-17-2010
11:06 AM
|
0
|
0
|
202
|
POST
|
I have a similar question. What control does the user have on drawing circles or ellipses? It appears in the one sample you can click a point and a circle or ellipse will be drawn at a specific size (and orientation). Are there plans to enhance this? using esri.toolbars.Draw.POINT in conjunction with geometry services's buffer operation will do it
... View more
12-17-2010
11:03 AM
|
0
|
0
|
700
|
POST
|
So to load a layer is straight forward as taken from the "JavaScript API Concepts" page. Sniplet below... function init() { var layer = new esri.layers.ArcGISDynamicMapServiceLayer(...); dojo.connect(layer, "onLoad", printInitialExtent); } How do you catch an event if the layer never gets loaded? Maybe the service is down. If the layer does not get loaded I want to inform the user (rather than a blank map). try this: function init() { var layer = new esri.layers.ArcGISDynamicMapServiceLayer(...); dojo.connect(layer, "onLoad", printInitialExtent); dojo.connect(layer, "onError", function(error){ alert ("There is a problem on loading the layer!"); }); }
... View more
12-17-2010
10:33 AM
|
0
|
0
|
904
|
POST
|
Hi lowgas, Thanks for the replay! I tried your code. But that does not display the attributes and geometry. And Firefox Firebug shows me no errors. I do not understand what the problem is. I saw many examples in internet. and I downloaded one of they and tried without the images. e.g. http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=codeGalleryDetails&scriptID=16041. I just wanted to try with attrubutes and geometry. I published the file PhotoLocations.mxd to my arcgisserver as map service and used for javascript code. I think basically this shoud work. I see the map, but no infowindow with attributes as before. I wonder.... if this example works right with you, I pehaps have problem with the publishing of map service. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>QueryTask with geometry, results as an InfoWindow onHover containg image</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.2/js/dojo/dijit/themes/tundra/tundra.css"> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.2"></script> <script type="text/javascript" language="Javascript"> dojo.require("esri.map"); dojo.require("esri.tasks.query"); function init() { var startExtent = new esri.geometry.Extent(-117.197, 34.035, -117.183, 34.045, new esri.SpatialReference({wkid:4326})); //create map var map = new esri.Map("mapDiv",{extent:startExtent}); //listen for when map is loaded and then add query functionality dojo.connect(map, "onLoad", initFunctionality); //create and add new layer var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"); map.addLayer(layer); var overlaymap=new esri.layers.ArcGISDynamicMapServiceLayer("http://myserver/ArcGIS/rest/services/PhotoLocations/MapServer"); map.addLayer(overlaymap); } function initFunctionality(map) { //build query task var queryTask = new esri.tasks.QueryTask("http://myserver/ArcGIS/rest/services/PhotoLocations/MapServer/0"); //build query filter var query = new esri.tasks.Query(); query.returnGeometry = true; query.outFields = ["OID", "EXIF_ImageDescription", "EXIF_Copyright", "SourceFileName"]; query.where = "OID >= 0"; var infoTemplate = new esri.InfoTemplate(); infoTemplate.setTitle("${SourceFileName}"); infoTemplate.setContent("<b>Description: </b>${EXIF_ImageDescription}<br/>" + "<b>Copyrights: </b>${EXIF_Copyright}<br/>"); map.infoWindow.resize(225,350); //Can listen for onComplete event to process results or can use the callback option in the queryTask.execute method. dojo.connect(queryTask, "onComplete", function(featureSet) { map.graphics.clear(); var highlightSymbol = new esri.symbol.PictureMarkerSymbol("images/i_camera.png", 40, 40); var symbol = new esri.symbol.PictureMarkerSymbol("images/i_camera.png", 40, 40); //QueryTask returns a featureSet. Loop through features in the featureSet and add them to the map. for (var i=0, il=featureSet.features.length; i<il; i++) { //Get the current feature from the featureSet. //Feature is a graphic var graphic = featureSet.features; graphic.setSymbol(symbol); graphic.setInfoTemplate(infoTemplate); //Add graphic to the map graphics layer. map.graphics.add(graphic); } map.graphics.enableMouseEvents(); dojo.connect(map.graphics, "onMouseOver", function(evt) { var content = evt.graphic.getContent(); map.infoWindow.setContent(content); var title = evt.graphic.getTitle(); map.infoWindow.setTitle(title); evt.graphic.setSymbol(highlightSymbol); map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)); }); dojo.connect(map.graphics, "onMouseOut", function(evt) { map.infoWindow.hide(); evt.graphic.setSymbol(symbol); }); }); queryTask.execute(query); } dojo.addOnLoad(init); </script> </head> <body class="tundra"> Hover over a camera icon to see image thumbnail and image description. <div id="mapDiv" style="width:1000px; height:800px; border:1px solid #000;"></div> </body> </html> I looked at your code. It seems that queryTask is a local variable not a globel one. put it in your init function like this: var queryTask, query; function init() { var startExtent = new esri.geometry.Extent(-117.197, 34.035, -117.183, 34.045, new esri.SpatialReference({wkid:4326})); //create map var map = new esri.Map("mapDiv",{extent:startExtent}); //listen for when map is loaded and then add query functionality dojo.connect(map, "onLoad", initFunctionality); //create and add new layer var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"); map.addLayer(layer); var overlaymap=new esri.layers.ArcGISDynamicMapServiceLayer("http://myserver/ArcGIS/rest/services/PhotoLocations/MapServer"); map.addLayer(overlaymap); queryTask = new esri.tasks.QueryTask("http://myserver/ArcGIS/rest/services/PhotoLocations/MapServer/0"); }
... View more
12-17-2010
10:23 AM
|
0
|
0
|
719
|
POST
|
Hi All, What are the limitations of ArcGIS JavaScript API? I mean can we do all the things what we can do with .NET web ADF? Which one I need to choose ArcGIS JavaScript API or .NET web ADF(Iam familiar with .net and arcobjects). we are using ArcGIS Server 10. Thanks, Uday yes with conjunction of gp services
... View more
12-17-2010
10:07 AM
|
0
|
0
|
288
|
POST
|
I have to use my national projection system which does not have corresponding WKID listed for ArcGIS REST API. Without it I am unable to use this projection system for my web application. Any pointers which can help me out to use my data in its native projection format? Thanks use the wkt (The well-known text of a spatial reference) instead. Example: var spatialReference = new esri.SpatialReference({"wkt": "PROJCS[\"NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601\", GEOGCS[\"GCS_North_American_1983_HARN\",DATUM[\"D_North_American_1983_HARN\", SPHEROID[\"GRS_1980\",6378137.0,298.257222101]], PRIMEM[\"Greenwich\",0.0], UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Lambert_Conformal_Conic\"], PARAMETER[\"False_Easting\",8202099.737532808],PARAMETER[\"False_Northing\",0.0], PARAMETER[\"Central_Meridian\",-120.5], PARAMETER[\"Standard_Parallel_1\",44.33333333333334], PARAMETER[\"Standard_Parallel_2\",46.0], PARAMETER[\"Latitude_Of_Origin\",43.66666666666666],UNIT[\"Foot\",0.3048]]" });
... View more
12-17-2010
10:04 AM
|
0
|
0
|
210
|
POST
|
Hi, How do I add a button to my javascript api website, that when the user clicks it, the query functionality is activated, and the user can click on a polygon to retrieve a list of results. I already know how to create the query functionality, but just not how to activate it with a button. Help please! Nat Create a drawtoolbar and activate it when user click on button. Then when use click on a polygon ( i assume the polygon is on the graphic layer), you can start do the query... Code should something like this: dojo.connect(map.graphics, "onclick", function(evt){ var polygon =evt.graphic.geometry; //you query function go here }); drawToolbar = new esri.toolbars.Draw(map); drawToolbar.activate(esri.toolbars.Draw.POINT); dojo.connect(drawToolbar, "onDrawEnd", function(point){ drawToolbar.deactivate(); // when you draw a point, it with fire the graphic layer's onclick event... }); let me know if you have any quetions on my answer...
... View more
12-17-2010
09:45 AM
|
0
|
0
|
308
|
POST
|
have you put alert(featureSet.features.length) at the beginning of the function to test if there is any feature returns. If it helps, here is the code for the function that calls my query. When I test the graphic.geometry, it comes back null. That may be why the graphic.geometry.type will grind the code to a halt. I don't know why it would be null, though, because I set the returnGeometry = true.
function queryExecute(layerLoc, layerID, qText) {
// layerLoc is location of map file, starting with "http:/"...
// layerID is the layer number the query is performed on.
var queryTask = new esri.tasks.QueryTask(layerLoc + layerID);
var queryParams = new esri.tasks.Query();
queryParams.returnGeometry = true;
queryParams.outFields = ["*"];
queryParams.where = qText;
queryTask.execute(queryParams, queryShowResults);
}
function queryShowResults(featureSet) {
//show results on map
map.graphics.clear();
var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color([0, 255, 0, 0.25]));
var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 1);
var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.25]));
//QueryTask returns a featureSet. Loop through features in the featureSet and add them to the map.
for (var i = 0, il = featureSet.features.length; i < il; i++) {
//Get the current feature from the featureSet.
var graphic = featureSet.features;
alert('graphic geometry: '+graphic.geometry);
switch (graphic.geometry.type) {
case "point":
graphic.setSymbol(markerSymbol);
break;
case "polyline":
graphic.setSymbol(lineSymbol);
break;
case "polygon":
graphic.setSymbol(polygonSymbol);
break;
}
//Add graphic to the map graphics layer.
map.graphics.add(graphic);
}
}
... View more
12-17-2010
06:43 AM
|
0
|
0
|
1252
|
POST
|
use map.destroy() to destroy the map instance when you remove the tiled layer. After the map is destroyed. it is no longer valid, however you can re-use the div element of the map to create a new map instance. Thanks for the replies so far, interesting, but I don't think they help me. Imagine my API uses 2 services, a dynamic service with my layers, and a cached service cached at scales 1:50,000, 1:25,000, 1:10,000 and 1:2,500 for example. I want to be able to remove/hide the cached service and zoom to any scale on the dynamic service, for example 1:38,536. My problem isn't one of just wanting to zoom in further than the cahced scales allow, I need to zoom to any scale by removing/hiding the cached service and so stopping the snap-to-scale that happens when using a cached service. Thank you. Mark.
... View more
12-17-2010
06:25 AM
|
0
|
0
|
451
|
POST
|
Hi. I am want to create a form for route printing. With maps for each route direction. I have wrote a functio to create a simple map for html node with layers I need and extent, but I have one problem - map graphics is not displayed on map, despite map.graphics object has all graphic it needs (with geometry and symbols). Can someone help me? Here is my code:
function createMap(srcNodeRef, pExtent, pLayers){
// CREATE MAP
var map = new esri.Map(srcNodeRef, {
extent: pExtent,
logo : false,
slider: false
});
dojo.connect(map, "onLoad", addGraphicsPrint);
try {
for (var i=0; i<pLayers.length - 1; i++) {
map.addLayer(pLayers);
};
} catch (e) {
alert(e.message);
}
map.graphics.refresh();
return map;
}
function addGraphicsPrint(map) {
try {
for(var i = 0, il = route.features.length; i<il; i++) {
var feat = route.features;
feat.setSymbol(routeSymbol);
map.graphics.add(feat);
}
}
catch (e) {
alert(e.message);
}
}
Instead of using default graphic layer: map.graphics, explicitly create a graphic layer and add graphic to it. Example: var gLayer = new esri.layers.GraphicsLayer(); map.addLayer(gLayer); gLayer.add(graphic);
... View more
12-16-2010
12:11 PM
|
0
|
0
|
214
|
Title | Kudos | Posted |
---|---|---|
1 | 04-11-2011 12:16 PM | |
1 | 05-25-2017 08:26 AM | |
1 | 06-02-2017 07:37 AM | |
1 | 06-28-2011 07:02 AM | |
1 | 06-12-2017 10:10 AM |
Online Status |
Offline
|
Date Last Visited |
a week ago
|