POST
|
Here's an example of the only thing I could get to work.... and even then, it rearranges the draw order of the graphics... which I couldn't figure out a way to prohibit. I'm using a slider to hide or peal through graphics. var searchslider = new RangeSlider({ name: "slider", value: [ 0, 500000 ], minimum: 0, maximum: 500000, intermediateChanges: true, //discreteValues:100, //The number of possible discrete slider values (make increments of 10) no worky skip:1000, showButtons: false, // false by default? style: "width:300px;", onChange: function(values){ console.log( values[0]+", "+values[1] ); var min = addCommas( values[0].toFixed(0) ); // cutt off all decimals var max = addCommas( values[1].toFixed(0) ); $("#rngMin").html("1:"+min); $("#rngMax").html("1:"+max); //console.log(graphicsLayer.graphics); console.log(graphicsLayer.graphics.length); if (graphicsLayer.graphics.length > 0){ var tempFeatures = graphicsLayer.graphics.items; dojo.forEach(tempFeatures, function(g){ console.log(g); if (g.visible = true && g.attributes.scale_1 > values[1]){ //console.log("true!"); graphicsLayer.remove(g); var hiddenGraphic = new Graphic({ geometry: g.geometry, attributes: g.attributes, popupTemplate: template, symbol: hiddensymbol, visible: false }); graphicsLayer.add(hiddenGraphic); } else if (g.visible == false && g.attributes.scale_1 < values[1]){ graphicsLayer.remove(g); var visibleGraphic = new Graphic({ geometry: g.geometry, attributes: g.attributes, popupTemplate: template, symbol: fillSymbol, visible: true }); graphicsLayer.add(visibleGraphic); } }); //end .each } // end if } // end onchange() }, "mapbib-slider");
... View more
12-07-2017
11:09 AM
|
0
|
0
|
1714
|
POST
|
setting the symbol to null does not seem to dynamically hide the symbol. You'd still have to remove and add the graphic to the map for it to take effect?
... View more
12-07-2017
10:35 AM
|
0
|
1
|
1714
|
POST
|
That example returns graphics properties only in MapView (and even then only .length is available... the geometry and attributes seem to be private and inaccessible) I need to access map graphics in SceneView. Is there ANY native way to do this? Will a getter function be available in the official release? using getCanvas3DGraphics() or something? I'd rather not hit the server with a query/identifyTask when the info from the featureclass is already on the map. Something like, var fLayerView; view.on("layer-view-create", function(evt) { //unlike view.then, this fires as EACH layer is converted to a layerview if (evt.layer.id === "myFeatureClassId") { var fLayerView = evt.layerView; var graphics = fLayerView.getCanvas3DGraphics(); graphics.forEach(function(item, i){ console.log(item+", "+i); //get attributes for custom mouse-over events or custom search }); } });
... View more
03-01-2016
10:00 AM
|
0
|
0
|
438
|
POST
|
Just to clarify, I'm hoping to loop through the graphics to modify them (like the old API did with "map.graphics", perhaps with something like this.... var mapgraphics = view.getLayerView(myFeatureLayer); dojo.forEach(mapgraphics, function(g){ //console.log(g); if (g.attributes.pub_title == var"){ change style }; }); Right now I can't even find a way to access graphics when clicking them ---like the old view.on("click", function(evt) { graphic = evt.graphic }); help please...
... View more
02-26-2016
07:14 AM
|
0
|
0
|
438
|
POST
|
I can't seem to access the graphics on the Map in 4.0Beta. In the documentation, it says graphics are no longer stored in 'map' or 'featureLayer', but "as graphics inside a LayerView" But I can't seem to get View.getLayerView() or any other construct to work in order to access the graphics in my featureLayer loaded from Arc Server. I don't even see them in the console under console.log(view.layerViews.item[]...) Can someone show me just a simple example of how to access the graphics on a map?
... View more
02-26-2016
07:02 AM
|
0
|
3
|
2070
|
IDEA
|
Idea or Bug. Time functionality in ArcGIS desktop and ArcGIS Server requires times in UTC. This is very limiting for displaying historical, archaelogical, geological or futuristic data. UTC has an earliest date of 1700-01-01T00:00:00Z GMT, or just after midnight on January 1, 1700. There really needs to be a way to deal with time data from any date, both in arcmap and arc server js api. This is a huge issue for us at the Utah Geological Survey in Utah.
... View more
05-16-2014
08:50 AM
|
7
|
1
|
776
|
IDEA
|
Idea or Bug. Time functionality in ArcGIS desktop and ArcGIS Server requires times in UTC. This is very limiting for displaying historical, archaelogical, geological or futuristic data. UTC has an earliest date of 1700-01-01T00:00:00Z GMT, or just after midnight on January 1, 1700. There really needs to be a way to deal with time data from any date, both in arcmap and arc server js api. This is a huge issue for us at the Utah Geological Survey in Utah.
... View more
05-16-2014
08:50 AM
|
6
|
0
|
583
|
IDEA
|
Idea or Bug. Time functionality in ArcGIS desktop and ArcGIS Server requires times in UTC. This is very limiting for displaying historical, archaelogical, geological or futuristic data. UTC has an earliest date of 1700-01-01T00:00:00Z GMT, or just after midnight on January 1, 1700. There really needs to be a way to deal with time data from any date, both in arcmap and arc server js api. This is a huge issue for us at the Utah Geological Survey in Utah.
... View more
05-16-2014
08:50 AM
|
6
|
0
|
580
|
POST
|
Basically I am trying to duplicate the Google Maps, Picasa images layer... in an arcgis javascript application Here's an example of it working in Google maps... http://geology.utah.gov/testing/fieldtrip/index.html (it is dynamically pulling a Picasa feed of thousands of images, and then clustering them on the google map, using the top picture in the stack as the cluster marker symbol.) [ATTACH=CONFIG]15923[/ATTACH] Using the new point clustering class (http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/layers_point_clustering.html) I'v pretty much got it working in the arcgis javascript api.... I just need to replace the default renderer picture marker symbol with a dynamic image from the attributes of the marker on the top of the markercluster stack. Any Ideas? Here's my ArcGIS application so far... http://geology.utah.gov/testing/fieldtrip/esrimap_1.html The code that manages the marker symbols looks like this function addClusters(response) {
var photoInfo = {};
var wgs = new esri.SpatialReference({ "wkid": 4326 });
//photoInfo.data = dojo.map(resp, function(p) {
photoInfo.data = dojo.map(response.feed.entry, function(p) {
try {
var pos = p["georss$where"]["gml$Point"]["gml$pos"]["$t"] ;
var lat = pos.substr(0,pos.search(" "));
var lng = pos.substr(pos.search(" "));
} catch (e) {
//console.log("not there: "+e.message);
}
var latlng = new esri.geometry.Point(parseFloat(lng), parseFloat(lat), wgs);
var webMercator = esri.geometry.geographicToWebMercator(latlng);
var attributes = {
"Caption": p.summary["$t"],
"Title": p.title["$t"],
"NumberComments": p.gphoto$commentCount["$t"],
"Tags": p["media$group"]["media$keywords"]["$t"],
"Name": "none",
"Image": p["media$group"]["media$thumbnail"][4].url,
"Link": p.link[1].href
};
//console.log(attributes);
return { "x": webMercator.x, "y": webMercator.y, "attributes": attributes };
});
// popupTemplate to work with attributes specific to this dataset
var popupTemplate = esri.dijit.PopupTemplate({
"title": "Virtual Field Guide",
"description":'<div class="popupDiv">' +
'<div class="popupImage"><a href="{Link}" target="_blank"><img src="{Image}" ></a></div>' +
'<br><span class="popupField">File Name: </span> <span class="popupValue">{Title} </span>' +
'<br><span class="popupField">Tags: </span> <span class="popupValue">{Tags} </span>' +
'<br><span class="popupField">Caption: </span> <span class="popupValue">{Caption} </span>' +
'<br><span class="popupField">User Comments: </span> <span class="popupValue">{NumberComments} </span>' +
'<br><small><a href="{Link}" target="_blank"> Open in Picasa </a></small>' +
'</div>'
});
// cluster layer that uses OpenLayers style clustering
clusterLayer = new extras.ClusterLayer({
"data": photoInfo.data,
"distance": 30,
"id": "clusters",
"labelColor": "#fff",
"labelOffset": 0,
"resolution": map.extent.getWidth() / map.width,
"singleColor": "#888",
"showSingles": true,
"singleTemplate": popupTemplate
});
var defaultSym = new esri.symbol.SimpleMarkerSymbol().setSize(4);
var renderer = new esri.renderer.ClassBreaksRenderer( defaultSym,"clusterCount" );
console.log("hi");
console.log(photoInfo.data);
var one = new esri.symbol.PictureMarkerSymbol("http://geology.utah.gov/testing/fieldtrip/img/pic-stack-80px.png", 32, 32).setOffset(0, 15);
var two = new esri.symbol.PictureMarkerSymbol("http://geology.utah.gov/testing/fieldtrip/img/pic-stack2-80px.png", 44, 44).setOffset(0, 5);
var three = new esri.symbol.PictureMarkerSymbol("http://geology.utah.gov/testing/fieldtrip/img/pic-stack5-80px.png", 60, 60).setOffset(0, 5);
var four = new esri.symbol.PictureMarkerSymbol("http://geology.utah.gov/testing/fieldtrip/img/pic-stack6-80px.png", 72, 72).setOffset(0, 5);
renderer.addBreak(0, 2, one);
renderer.addBreak(2, 100, two);
renderer.addBreak(100, 200, three);
renderer.addBreak(200, 1001, four);
clusterLayer.setRenderer(renderer);
map.addLayer(clusterLayer);
map.infoWindow.resize(270, 316);
... View more
07-10-2012
07:49 AM
|
0
|
0
|
486
|
POST
|
here's a tricky one. I'm creating a Custom display scale range control with a dojo horizontal range slider. Seems the cleanest way to do this would be attach a function to the range slider that simply changes the TiledMapServiceLayer's 'displayLevels' property. But in testing it appears that the displayLevels property has to be set when the layer is created. After its added to the map it appears that it becomes ._displayLevels and is not changeable? Am I missing something? I guess I could remove the layer, redefine it, and re-add it to the map. But it would be nice if there was an easier way to set the display Levels of a Tiled Layer after its added to the map and then just refresh it. I see that the FeatureLayer has a setScaleRange(min,max) method, and min/maxScale property. Can there be something like this for a Tiled Layer? Or better add the min/maxScale to the esri.layers.Layer class so its available on all layers. Or is there an easier way of doing this that i'm missing? I dont want to have to listen for zoom changes and loop through all my layers adding and removing them... If it helps here's a link to my application. If you click the arrow next to the layer, the range slider appears which im trying to make control the display levels... http://geology.utah.gov/testing/marshall/jstest/indexTest.html
var rangeslider = new dojox.form.HorizontalRangeSlider({
name: "rangeSlider",
value: [min, max],
minimum: 0,
maximum: 19,
discreteValues: 20,
intermediateChanges: false,
showButtons: true,
onChange: function(n) {
layer._displayLevels = Array.range(n[0],n[1]);
layer.refresh();
}
I'm actually kind of surprised ArcGIS.com doesnt have this functionality next to the set opacity control on each layer. It would be a cool feature.
... View more
05-23-2012
08:11 AM
|
0
|
0
|
568
|
POST
|
my bad. .add() can be used on all graphic layer classes.
... View more
05-23-2012
06:13 AM
|
0
|
0
|
819
|
POST
|
.add() is not a supported method for the featureLayer Class. see http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm The response above is the correct one. The feature collection is exactly for this purpose, it is a featureLayer designed to add features to manually. I did not realize this when i made the post. It has essentially all the same methods, properties and events as a featureLayer.
... View more
05-23-2012
05:53 AM
|
0
|
0
|
819
|
POST
|
You would think this would be easy. I want to manually add features (from results of a FindTask) to my feature layer. All examples in the help add such results as graphics directly to the Map [with map.graphics.add() ]. But I would like to add them to one of my FeatureLayers. [esri.layers.FeatureLayer[myFeatureLayer].graphics] This is what the help does (which I dont want to do)
var items = dojo.forEach(results,function(rslt){
var desc = "<p>Name :"+rslt.attributes.TITLE+"<br>State:</p>";
var graphic = rslt;
graphic.setSymbol(defaultSymbol);
graphic.setInfoTemplate(infoTemplate);
map.graphics.add(graphic);
return rslt.attributes;
});
This is what I want to do. The features are added, but they do not display on the map even if I call .refresh() or readd the featureLayer.
var items = dojo.map(results,function(rslt){
return rslt.feature;
});
myFeatureLayer.graphics = items;
Is this not possible? It seems to me that adding features/graphics to a featureLayer is more flexible than just adding them roguely to the map. Can they only be added with featureLayer.selectFeatures() or at creation of the new FeatureLayer? I would like to add my featureLayer with MODE_SELECTION so nothing is fetched from the server, and then query the server with a FindTask and then add the results to my feature Layer. I know how to do it with a .selectFeatues(query) but I want to do it with a findTask not a query.
... View more
04-13-2012
10:52 AM
|
0
|
5
|
7619
|
POST
|
I have been confused about this, so I am posting a chart and explanation. Hope it helps -Query is designed to best search/manipulate features ON THE FEATURELAYER you have already added to the map. [with the .selectFeatures() method ] Also it is best for spatial Queries on the server. -Query is not designed for searching accross multiple layers. (it would take a loop and huge SQL expression). No dynacmicLayerInfos, no LayerDefinitions, LayerIds, LayerOption. ---------------------------------- -Identify is designed to manipulate features ON THE MAP, so it has lots of DOM properties like dpi, width, height, etc.. --------------------------------------- -Find is designed to search ON THE SERVER accross multiple fields of multiple Layers without having to create your own loop or SQL expressions. Find is limited as it can NOT do spatial filtering. [ATTACH=CONFIG]13498[/ATTACH]
... View more
04-13-2012
10:23 AM
|
3
|
0
|
6252
|
POST
|
I thought I would post this to the forums since it took me hours to solve. I could not get the proxy.php page to work on my setup (WAMP server). The request fired from the Attribute Inspector or Editor would simply time out. Firebug gave an error of "XML Parsing Error: no element found Location: moz-nullprincipal:{78a64f8b-a468-4122-8af0-356a8e931a72} Line Number 1, Column 1:" Which is just a default Mozilla error meaning the request timed out. I read a number of old esri forums post that said things like your application had to be on the same machine as your ArcGIS server (not true, you dont need a proxy in that situation. Your application and your proxy.php have to be on the same server, but they can/will be on a different server than your ArcGIS Server). The solution for me ended up being a firewall issue where proxy requests had to be made to the ArcGIS server's externally facing IP address. Its host name would not work. nor would its internally facing IP. So I created a function to place in the proxy.php which solved the problem.
// this function replaces the domain in serverURL's with the IP if it is defined. this way we dont have to expose our IP in our webpages featureLayer definition
$replacementIP = $serverUrls[$pos]['ip'];
if ($replacementIP) {
$host = parse_url($targetUrl, PHP_URL_HOST); //parse out the host or domain from url
$targetUrl = str_replace($host,$replacementIP,$targetUrl); //replace host with ip in url string
}
I placed this function directly below the following function
// add token (if any) to the url
$token = $serverUrls[$pos]['token'];
if ($token) {
$targetUrl .= (stripos($targetUrl, "?") !== false ? '&' : '?').'token='.$token;
}
You then must add a 'ip' variable in the $serverUrls Array. for example array( 'url' => 'http://myArcServerDomain.com/ArcGIS/rest/services/', 'ip' => '192.168.1.3', 'matchAll' => true, 'token' => '' ) Works like a charm hope that helps someone
... View more
04-11-2012
01:35 PM
|
0
|
0
|
886
|
Title | Kudos | Posted |
---|---|---|
3 | 04-13-2012 10:23 AM | |
6 | 05-16-2014 08:50 AM | |
6 | 05-16-2014 08:50 AM | |
7 | 05-16-2014 08:50 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|