POST
|
Here's another attempt at a jsfiddle that should work: http://jsfiddle.net/99vD9/5/ var elevationServiceUrl = "http://sampleserver4.arcgisonline.com/ArcGIS/rest/services/Elevation/ESRI_Elevation_World/MapServer/exts/ElevationsSOE/ElevationLayers/1/GetElevationAtLonLat"
dojo.connect(map, 'onClick', function (evt) {
esri.request({
url: elevationServiceUrl,
content: {
lon: evt.mapPoint.getLongitude(),
lat: evt.mapPoint.getLatitude(),
f: "json"
},
callbackParamName: "callback",
}).then(function (response, io) {
alert("Elevation = " + response.elevation.toFixed(1) + " meters");
}, function (error, io) {
console.error("Unable to get elevation", error);
alert("Unable to get elevation...");
});
});
... View more
04-04-2014
08:41 AM
|
0
|
0
|
723
|
POST
|
What I normally do in dojo classes and dijits to maintain scope is to make sure I use lang.hitch(...) for my inline or referenced methods. That way I can access the data-dojo-attach-point members directly. Here's a rough example: queryTask.execute(query, lang.hitch(this,postResults)); Then, inside of postResults you can access the members like so: this.fsCounty.set("store", store);
... View more
03-26-2014
09:51 AM
|
1
|
0
|
457
|
POST
|
What I've done in the past is to assign a value of 200px to the min-height and min-width properties to the map div via css. I believe this ensured that the map div sizes are not set to zero by external widgets when they are hidden.
... View more
02-06-2014
07:37 AM
|
0
|
0
|
330
|
POST
|
Jon is correct, you need to wait until after the map has finished moving to the new location before you can use .getDojoShape().moveToFront(). Here's a modified version of the jsfiddle with the updated code: http://jsfiddle.net/23tDs/
... View more
01-10-2014
07:17 AM
|
0
|
0
|
546
|
POST
|
It's been a while since I tried this, but if you have a Graphic that uses a TextSymbol: 1) call map.toScreen() to get x,y screen coordinates of graphic; you might have to make adjustments based on the symbol.xoffset and symbol.yoffset. 2) call graphic.getDojoShape().getTextWidth() for the width, and graphic.symbol.font.size for the height (you might have to make additional adjustments if size is not pixel based). Then add the desired padding. Finally you might have to make additional offset adjustments if any of the coordinates are outside of the map extent. 3) create screen extent based on x, y, width, height, then call map.toMap() to get back real-world coordinates of bounding box. I believe there were a few other minor tweaks that were specific to what I was doing in the app, but this is the overall concept.
... View more
12-11-2013
06:33 AM
|
1
|
0
|
1785
|
POST
|
Careful, the previous solution assumes the geometry is a single-part polyline, which seems to be ok for this use case, but might not work in all situations, like when the geometry is retrieved from an external source like a Map or Feature Service. var lastPartIdx = polyline.paths.length-1; var lastPntIdx = polyline.paths[lastPartIdx].length - 1; var lastPnt = polyline.getPoint(lastPartIdx , lastPntIdx);
... View more
09-27-2013
08:30 AM
|
1
|
0
|
1354
|
POST
|
Ken, Try sending 'newExtent' to the console; it's probably incorrect. Seems like the loop to find the selected well should come before you create the extent. Here's another possible approach:
function zoomRow(id){
var grid = dijit.byId('grid');
var clickedWell = grid.getItem(id);
var selectedWell = null;
dojo.forEach(map.graphics.graphics,function(graphic){
if((graphic.attributes) && graphic.attributes.FID === clickedWell.FID){
selectedWell = graphic.geometry;
return;
}
});
if(selectedWell != null){
var distance = 1000;
var newExtent = new esri.geometry.Extent({
"xmin": selectedWell.x - distance,
"ymin": selectedWell.y - distance,
"xmax": selectedWell.x + distance,
"ymax": selectedWell.y + distance,
"spatialReference":{"wkid":4326}
});
map.setExtent(newExtent);
}
}
... View more
09-01-2013
01:13 PM
|
0
|
0
|
305
|
POST
|
Stephen, also, you don't need to use esri.request, just listen for the layer 'onLoad' event and then the initialExtent is a property of the layer. Using a geometry service to project the extent is the way to go.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Zoom to non-WM dynamic layer</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css"/>
<style>
html, body, #mapDiv {
padding: 0;
margin: 0;
height: 100%;
}
</style>
<script src="http://js.arcgis.com/3.6/"></script>
<script>
dojo.require("esri.map");
dojo.require("esri.tasks.geometry");
var map;
var url = "http://loczy.mfgi.hu/ArcGIS/rest/services/TJAM/surf_ujfalu_t/MapServer/"
var gsUrl = "http://server.domain.com/arcgis/rest/services/Geometry/GeometryServer"; // url to your geometry service
function init(){
map = new esri.Map("mapDiv",{basemap: "gray"});
var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer(url);
dynamicMapServiceLayer.on('load',function(){
var projectParams = new esri.tasks.ProjectParameters();
projectParams.geometries = [dynamicMapServiceLayer.initialExtent];
projectParams.outSR = map.spatialReference;
var gs = new esri.tasks.GeometryService(gsUrl);
gs.project(projectParams).then(function(projectedGeometries){
var initialExtentWM = projectedGeometries[0];
map.setExtent(initialExtentWM);
});
});
map.addLayer(dynamicMapServiceLayer);
}
dojo.ready(init);
</script>
</head>
<body>
<div id="mapDiv"></div>
</body>
</html>
... View more
08-15-2013
07:38 AM
|
0
|
0
|
1161
|
POST
|
Import GeoFence changes string values by adding underscores for spaces (and other characters) which then causes the GeoTagger to add new field with a string value that the Field Enricher (from the same Feature Service that was used to import the geofences) to not work because the field values no longer match. Any suggestions on how to workaround this issue?
... View more
07-29-2013
12:05 PM
|
0
|
2
|
980
|
POST
|
It's expecting an array of geometries; try this: params.geometries = [mp];
... View more
03-06-2013
07:02 AM
|
0
|
0
|
1199
|
POST
|
If you want to modify the text displayed in the dialog, look at 'esri.bundle.identity.info' string. Event though the '${server}' and '${resource}' template parts must be present, but you can hide them via css. Also, the dialog and buttons are available to manipulate only after the dialog is created. esri.bundle.identity.info = "Please sign in to MYSITE.<span class='dijitOffScreen'>${server}${resource}</span>"; dojo.connect(esri.id,'onDialogCreate',function(){ esri.hide(esri.id.dialog.closeButtonNode); esri.hide(esri.id.dialog.btnCancel_.domNode); });
... View more
02-25-2013
07:21 AM
|
0
|
0
|
293
|
POST
|
Thank you everybody for the continued support; we're getting close to releasing the Elevations SOE for 10.1. We've had to make some breaking changes to accommodate requested use cases and it still needs some more testing. Also, we're currently trying to add support for elevation datasets that have NoData values, something we have not done in the past. We do not have a release date at this time, but I'll try to have it ready by the Dev Summit. Please do not use this sample code in production environments or in mission critical situations; it's just a sample.
... View more
02-13-2013
03:07 PM
|
0
|
0
|
332
|
POST
|
You probably don't need 'dojo.connect(featureLayerEdit, "onEditsComplete", addResultsComplete);', instead just use the inline callback function in the applyEdits call. Also, you're connecting this event many times, once for each map click; not sure if that is making a difference. I would also hitch the inline calls to make sure you have the proper context. Also, you need to get the updated feature from the feature layer again as the one currently in memory might not have the correct ObjectID that was assigned on the server. This last step might not be necessary depending on what you need to do; in your case the ObjectID is provided by the FeatureEditResult object.
featureLayerEdit.applyEdits([graphic], null, null, dojo.hitch(this, function(addResults){
if(addResult.success){
var query = new esri.tasks.Query();
query.objectIds = [addResult.objectId];
query.outFields = ["*"];
featureLayerEdit.queryFeatures(query, dojo.hitch(this, function(featureSet){
if(featureSet.features.length > 0){
var newFeature = featureSet.features[0];
newFeature.attributes["6"] = addResult.objectId + "_SOMEOTHERVAL";
featureLayerEdit.applyEdits(null, [newFeature], null);
}
}));
}
});
I have not tested this, but it should be close to what you need.
... View more
01-04-2013
07:46 AM
|
0
|
0
|
517
|
POST
|
I wonder if calling esri.geometry.normalizeCentralMeridian(...) would help in this situation?
... View more
12-19-2012
07:00 AM
|
0
|
0
|
239
|
POST
|
I haven't tested this with the latest api, but try this: editor._updateCurrentFeature(dojo.hitch(this,function(){
editor._clearSelection(false);
}));
... View more
12-06-2012
08:27 AM
|
0
|
0
|
794
|
Title | Kudos | Posted |
---|---|---|
1 | 03-07-2024 04:14 PM | |
1 | 02-23-2024 12:40 PM | |
1 | 03-01-2024 10:48 AM | |
2 | 08-03-2023 02:34 PM | |
2 | 07-19-2023 12:05 PM |
Online Status |
Offline
|
Date Last Visited |
Thursday
|