|
POST
|
Yes. We plan on supporting the ability to switch the Map's spatial reference in 4.0. It's not there yet, but it will be explored. As of now, it looks like this will only be possible with Maps that have NO basemap. The SpatialReference of the map and all of the dynamic layers and FeatureLayers would reproject after changing the SpatialReference directly on the Map.spatialReference property. map.spatialReference = new SpatialReference( {wkid: 4326} ); //or some other spatial reference object
... View more
07-24-2015
01:49 PM
|
1
|
1
|
2896
|
|
POST
|
How are you able to get the coded value from the queryResults? Is it the same field you tried referencing in the identifyResults?
... View more
07-16-2015
04:18 PM
|
0
|
1
|
2004
|
|
POST
|
Thanks, Akshay. In addition to understanding the differences between suggest() and findAddressCandidates(), I think the documentation currently doesn't do a good job at conveying the purpose of autoSelect. This will be updated so that it makes more sense. The purpose of autoSelect isn't to select the first suggestion, geocode it, and zoom to it. Rather, it is to geocode and zoom to the first result returned from entering the text exactly as it appears in the search box. This text is sent directly to findAddressCandidates() and doesn't necessarily return the same result as the top suggestion since both are sent to different endpoints. The suggestions listed below the text box as you type are merely that - suggestions. Those results will not be used to geocode unless you click on one of them or select it using your keyboard. Merely hitting enter will only take what is already inside the text box. autoSelect is set to true by default. If you set it to false, you will notice that the findAddressCandidates() function is called, but the top geocoded result is not selected or zoomed to. It is up to the developer to use the results however they want. The results can be accessed using the search-results event: Search | API Reference | ArcGIS API for JavaScript . autoSelect is true by default because in most cases the top result is what the user wants to zoom to.
... View more
07-07-2015
02:54 PM
|
2
|
1
|
1436
|
|
POST
|
Unfortunately, I'm not able to provide a BUG or NIM# for tracking. Whoever submits the issue to support should be able to provide that number. After looking into this issue further, it's worth noting that the suggest function behaves differently than the actual "search" or "findAddressCandidates" function. Typing "1021 N Grand Ave E, Sp" into the search bar automatically inputs that text to the suggest() function. When you hit ENTER or the search button, it sends that same exact text to the findAddressCandidates() function. Both suggest() and findAddressCandidates() have different logic and therefore yield different results. The reason, no results are returned in the above example is because the top result from findAddressCandidates() is located outside the searchExtent even though the top result from suggest() IS located inside the search extent. I know...it's weird behavior, but that's what's going on behind the scenes. So when autoSelect is set to true, it's not selecting the first suggestion, it's selecting the first result returned from the geocode. The documentation can be updated to make that more clear. To make sure the text from a suggestion is used for the findAddressCandidates() function, you must click on the text for it to search the suggestion properly. I hope this explanation helps.
... View more
07-06-2015
03:54 PM
|
0
|
0
|
1436
|
|
POST
|
With the <button id='myButton' onclick='myFunction();'>Label</button> approach, how are you defining the function? function myFunction(){
//this will probably be undefined
} Instead try: window.myFunction = function(){
//this may work
}
... View more
06-05-2015
09:34 AM
|
0
|
0
|
1086
|
|
POST
|
Migration can be tricky, especially with multiple JS files. In reference to a comment you made in your original post: But what about mapFunctions.JS and the other JS files? I’m assuming that I need to convert these into “modules” but I don’t understand some aspects such as how I set up a file like my reportFunctions.JS which contains functions that call each other within the JS file. I agree that defining your own modules would be the way to go. And, yes, you can call functions from other functions defined within the same module. I found these tutorials to be useful when learning how to do this: Writing a Class | Guide | ArcGIS API for JavaScript The Dojo Loader — The Dojo Toolkit - Reference Guide Introduction to AMD Modules - Archived Tutorial - Dojo Toolkit Classy JavaScript with dojo/_base/declare - Archived Tutorial - Dojo Toolkit These come directly from the ArcGIS JavaScript API Guide and Dojo Toolkit pages. There may be other useful blogs that address this topic as well. I'm not sure about JQuery integration with this, but I've been able to accomplish all of my tasks, functionality, requests, etc, using Dojo. Sorry this isn't a complete answer to your question, but hopefully you'll find the tutorials in the links above useful.
... View more
04-28-2015
10:41 AM
|
0
|
0
|
1907
|
|
POST
|
This is an issue we're aware of and have it in the plan to fix for the next release of the API.
... View more
04-27-2015
09:21 AM
|
0
|
0
|
988
|
|
POST
|
Hi Kevin, I'm not able to access your image services, so I'm not sure how much help I'll be, but there were a couple of things in your code that stuck out to me. 1. The Raster and Raster2 params in your functionArguments for suit are strings. They should be variables if you want to do map algebra between two rasters. Also, they're referring to the wrong variables. You're point to ImageServiceParamaters when they should be pointing to RasterFunctions. So instead of: functionArguments_alge.Raster @= "params"; //these are ImageServiceParameters functionArguments_alge.Raster2 = "params_land"; //and are strings, not variables It should be: functionArguments_alge.Raster = reclass_dem; //these should point to your functionArguments_alge.Raster2 = reclass_landcover; //RasterFunction variables The case where you'll see a string will probably be when using the original raster which is referenced like this: "$$". Or a constant: functionArguments_alge.Raster = "$$"; //this would use the values in the original raster functionArguments_alge.Raster2 = "100"; //and multiply/add/whatever the cells by 100 2. I'm not an expert on the Arithmetic function, but I don't think you would apply it to both layers as you do here: var dem = new ArcGISImageServiceLayer("http://indian.geo.msu.edu:6080/arcgis/rest/services/Piraino/dem_un8/ImageServer",{imageServiceParameters:params_suit}); var landcov = new ArcGISImageServiceLayer("http://indian.geo.msu.edu:6080/arcgis/rest/services/Piraino/Landcover/ImageServer", {imageServiceParameters:params_suit}); Try only applying it to just one of them. 3. Also, try experimenting with the ExtentType and CellsizeType functionArguments for Arithmetic. If you have different cell sizes, that perhaps could be giving you issues? I would also play around with the outputPixelType as well... Sorry I can't see your services, but that's the process I would go through. Maybe someone who's used this function can jump in and give a more authoritative answer.
... View more
04-09-2015
10:59 AM
|
1
|
1
|
2615
|
|
POST
|
There are a couple of options you can try. 1. The error you mentioned above (SEC7120: Origin http://localhost:3042 not found in Access-Control-Allow-Origin header) looks like a CORS issue. When consuming services that aren't hosted on a CORS enabled server, you can push them to esriConfig.defaults.io.corsEnabledServers. http://server.arcgisonline.com/ArcGIS/rest/services should work though since "server.arcgisonline.com" already exists in that array. I typically use "services.arcgisonline.com" instead for my applications and it has always worked fine for me. So you could try swapping it out in your app and proxy config file. I would also exclude the "/ArcGIS/rest/services" from the url in the config file. Again, it shouldn't really matter either way, but it could make a difference. 2. You can also use urlUtils.addProxyRule() to set up proxy rules within the app. This is the method I prefer. You can replace the snippet above with: // Setup Esri Config esriConfig.defaults.io.proxyUrl = "http://phunt-pc/EsriProxy/proxy.ashx" esriConfig.defaults.io.alwaysUseProxy = true; require(["esri/urlUtils", ... ], function(urlUtils, ...){
...
...
urlUltils.addProxyRule({
urlPrefix: "server.arcgisonline.com", //whatever you have in your config file here
proxyUrl: "http://phunt-pc/EsriProxy/proxy.ashx"
});
...
...
});
... View more
03-31-2015
01:44 PM
|
0
|
3
|
2684
|
|
POST
|
Peter Hunt Can you post code snippets/examples of how you're using the proxy inside your app?
... View more
03-31-2015
12:44 PM
|
0
|
5
|
2684
|
|
POST
|
Unfortunately RasterLayer only supports LERC format for image services. This was added in the 10.3 release. So yes, right now RasterLayer can only be used with 10.3 lerc services.
... View more
03-31-2015
12:01 PM
|
0
|
0
|
815
|
|
POST
|
Chaining raster functions is doable using the JavaScript API. You can read about it in the REST help documentation: ArcGIS REST API. See the Overview section starting with the paragraph that begins, "At 10.2 and later, a client can define a raster function template by chaining multiple well-known raster functions and can also specify output pixel types..." There's an example of this at the bottom of that page. Basically you would define both raster functions and set one of them in the Raster functionArgument. See snippets below and full sample here: JS Bin - Collaborative JavaScript Debugging var rf = new RasterFunction();
rf.functionName = "Remap";
rf.functionArguments = {
"InputRanges" : [-3,10,11,37],
"OutputValues" : [1,2],
"Raster" : "$$" //Use the image service
};
rf.variableName = "water_temp";
rf.outputPixelType = "U8";
var colorRF = new RasterFunction();
colorRF.functionName = "Colormap";
colorRF.variableName = "water_temp";
colorRF.functionArguments = {
"Colormap" : [
[1, 255, 0, 0],
[2, 0, 255, 0]
],
"Raster" : rf //use the output of the remap rasterFunction for the Colormap rasterFunction
};
imageServiceLayer.setRenderingRule(colorRF); This information is there, but it is buried. We'll update the JS reference to be more clear about how to chain raster functions. Thanks, again for the input!
... View more
03-30-2015
04:05 PM
|
0
|
4
|
2615
|
|
POST
|
You make a good point about chaining raster functions. We'll make that a discussion topic when documenting future versions of the API. Thanks for the suggestion!
... View more
03-30-2015
01:40 PM
|
0
|
0
|
2615
|
|
POST
|
I also was able to set the symbology using RasterLayer. You can view the sample here. This is a little more complicated but it renders the symbology quickly. Basically the important part of this code to look at is the pixelFilter property inside the rasterLayer constructor. It references a custom function: reclassifyPixels() that defines the color for each pixel based on it's value. Constructor: var rasterLayer = new RasterLayer(rasterUrl, {
opacity: 1,
pixelFilter: reclassifyPixels,
imageServiceParameters: params
}); pixelFilter: // The pixel filter
function reclassifyPixels(pixelData) {
if (pixelData == null || pixelData.pixelBlock == null) {
return;
}
var pixelBlock = pixelData.pixelBlock;
var pixels = pixelBlock.pixels;
var numPixels = pixelBlock.width * pixelBlock.height;
if (pixels == null) {
return;
}
var p = pixels[0];
var pr = new Uint8Array(p.length); //set up array for red values
var pg = new Uint8Array(p.length); //set up array for green values
var pb = new Uint8Array(p.length); //set up array for blue values
for (var i = 0; i < numPixels; i++) {
//apply color based on temperature value of each pixel
if (p>10) {
pr = 0; //red
pg = 255; //green
pb = 0; //blue
}
if(p<=10){
pr = 255; //red
pg = 0; //green
pb = 0; //blue
}
}
pixelData.pixelBlock.pixels = [pr, pg, pb]; //assign rgb values to each pixel
pixelData.pixelBlock.statistics = null;
pixelData.pixelBlock.pixelType = "U8";
return pixelData;
} Also keep in mind that RasterLayer is in beta right now, but you may find it very useful as it does processing/filtering on the client, thus speeding up your performance. See the following links for more information: RasterLayer | API Reference | ArcGIS API for JavaScript PixelBlock | API Reference | ArcGIS API for JavaScript
... View more
03-30-2015
01:34 PM
|
0
|
2
|
815
|
|
POST
|
To answer to your first question, I found this resources page from the REST API helpful. Click on "Remap" and look at the examples. I was able to successfully remap an image service of sea temperatures this way: var rf = new RasterFunction();
rf.functionName = "Remap";
rf.functionArguments = {
InputRanges: [-3,10,11,37], //temperature ranges (-3 to 10) and (11 to 37)
OutputValues: [1,35] //symbolize the above ranges using the colors //values 1 and 35 respectfully
};
rf.variableName = "water_temp";
var params = new ImageServiceParameters();
params.renderingRule = rf;
var imageServiceLayer = new ArcGISImageServiceLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/ScientificData/SeaTemperature/ImageServer", {
imageServiceParameters: params,
opacity: 0.75
});
map.addLayer(imageServiceLayer);
imageServiceLayer.refresh(); Now, while that allows you to reclassify pixel values, it obviously doesn't allow you to specify the colors, say red and green. I'm not sure how to answer your second question about accomplishing this, but perhaps the "Colormap" raster function would be useful for this. Try adapting the code snippet above in your code and see how that goes. I'll continue to read more about more easily rendering the values in a more customizable way.
... View more
03-27-2015
06:07 PM
|
0
|
8
|
2615
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-06-2025 03:09 PM | |
| 1 | 04-29-2025 08:36 AM | |
| 1 | 08-20-2024 08:06 AM | |
| 1 | 08-13-2024 11:53 AM | |
| 1 | 07-22-2024 11:04 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-06-2025
03:01 PM
|