|
POST
|
The REST API has a "returnDistinct" option for Query in 10.1 SP1, but I have not tried it yyet. http://resources.arcgis.com/en/help/rest/apiref/query.html Maybe you could add it to the query object, and try it. If that doesn't work you could experiment with just using esri.request() to do the query manually.
... View more
02-20-2013
07:19 AM
|
0
|
0
|
2100
|
|
POST
|
For Firefox, you'll need to add an svg filter to your page. http://stackoverflow.com/questions/609273/convert-an-image-to-grayscale-in-html-css <svg xmlns="http://www.w3.org/2000/svg">
<filter id="grayscale">
<feColorMatrix type="matrix" values="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"/>
</filter>
</svg> And then the way I do it as I give my layers an "id", so something like osm = new esri.layers.OpenStreetMapLayer({
id: 'osmLayer'
}); Then in the CSS you can do this. #map_osmLayer img
{
filter: url(filters.svg#grayscale) !important; /* Firefox 3.5+ - notice the svg from above */
filter: gray !important; /* IE5+ */
-webkit-filter: grayscale(1) !important; /* Webkit Nightlies; Chrome Canary */
} That way you get control of individual layers, which is pretty cool. If you have chrome, there is a whole suite of cool css filters you could play with for your basemaps. http://www.odoe.net/apps/mapstyler/
... View more
02-19-2013
04:37 AM
|
0
|
0
|
2754
|
|
POST
|
What you're trying to do won't work that way. If you are using Node.js, you'll want to work directly against the ArcGIS Server REST API and not use the JS API. http://resources.arcgis.com/en/help/rest/apiref/
... View more
02-15-2013
09:54 AM
|
0
|
0
|
535
|
|
POST
|
ArcGIS Server 10.0 SP1 is the minimum requirements to use the legend dijit without needing a publicly available server. http://help.arcgis.com/EN/webapi/javascript/arcgis/jsapi/#legend If the layer is an ArcGISDynamicMapServiceLayer or ArcGISTiledMapServiceLayer created using ArcGIS Server 10.0 SP1 or higher the legend is generated using the REST Map Service legend resource. If the layers are version 10 or lower the legend is created using the ArcGIS.com legend service. In order to use the ArcGIS.com legend service your map service needs to be publicly accessible and your application must be able to access ArcGIS.com.
... View more
02-13-2013
07:52 AM
|
0
|
0
|
774
|
|
POST
|
Have you tried adding a console.log(); inside getStateCount to make sure it is firing?
... View more
02-07-2013
06:53 AM
|
0
|
0
|
1684
|
|
POST
|
I have a module that I use to accomplish this kind of thing for an InfoTemplate, but you could easily modify it to use in any DOM element. You just need to pass it the feature you want to display the attributes for. https://github.com/odoe/AGSModularDemo/blob/master/app/src/js/helpers/templateBuilder.js The meat is in iterating over the attributes.
// get the dom element for my infotemplate as a string
var content = [];
content[content.length] = '<table cellspacing="0" class="table table-striped table-condensed attr-info">';
if (feature.layerName) {
content[content.length] = '<tr><td class="fieldName">SOURCE: </td><td class="fieldName">' + feature.layerName + '</td></tr>';
}
/**
* Iterate over attributes to get field names.
* Ignore certain fields not needing to be displayed
* Order matters, so loop forward over keys.
**/
var keys = Object.keys(feature.attributes);
for (var i = 0, len = keys.length; i < len; i++) {
var _key = keys.toLowerCase();
if (!(_key.indexOf('shape') > -1 ||
_key === 'layername'||
_key === 'objectid' ||
_key === 'fid')) {
var name = keys;
content[content.length]= '<tr><td class="fieldName">' + name + '</td><td>${' + name + '}</td></tr>';
}
}
content[content.length] = '</table>';
Replace the InfoTemplate style ${} with the actual values and you can place the HTML into your DOM somewhere. I got a lot of this from somewhere and can't remember where. I think it was one of the samples.
... View more
02-06-2013
01:41 PM
|
0
|
0
|
1113
|
|
POST
|
I found this sample of using authentication with PhoneGap http://www.raymondcamden.com/index.cfm/2011/11/10/Example-of-serverbased-login-with-PhoneGap In this case, the sample appears to be using a Coldfusion server for the authentication, but you could easily replace it with PHP/ASP or whatever your preferred platform is. Like I said, that much is outside the scope of the JS API.
... View more
02-06-2013
05:25 AM
|
0
|
0
|
907
|
|
POST
|
I tried this in FF 18.0.1 and I don't think I'm seeing what you're seeing. I can see Polylines and tooltips as I draw them. What version of FF are you seeing this in?
... View more
02-05-2013
05:34 AM
|
0
|
0
|
1713
|
|
POST
|
Well, you secure your services on ArcGIS Server, but as far as a login screen to get to your app, that's outside the scope of the API. You could use something like .NET MVC to secure access to load your URL. Passing that authentication on to the secured services is something on my list of "you should look into this", but haven't gotten around to yet. If you dont need to actually secure the services, then just sitting the page behind some form of authentication like you would with any other web app would do the trick.
... View more
02-05-2013
04:47 AM
|
0
|
0
|
907
|
|
POST
|
Custom events won't work, but you can actually use dojo/on for native events on things like a "click" event and do some useful things. Other events, like "load" won't work yet. Here is a sample of how you might use dojo/on to handle multple map click events, like say you want to switch between identify on a map and draw on a map. https://gist.github.com/odoe/4542944
// Purely sample
// Just demonstrates how you may use the dojo/on method
// with the map click and other click events
define('identifyHandler', ['dojo/on', 'esri/tasks/identify'], function(on) {
var _idhandler = function(map) {
var task = new esri.tasks.IdentifyTask('url');
var idparams = new esri.tasks.IdentifyParameters();
idparams.tolerance = 3;
idparams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
// callback train, yeah yeah, it's a sample, jeez
this.handler = on.pausable(map, 'click', function(e) {
// blah blah, set up your Identify Parameters
var deferred = task.execute(idparams);
deferred.then(function(){
// blah blah, do something
});
});
};
return _idhandler;
});
define('mapView', ['dojo/connect', 'identifyHandler', 'esri/map', 'esri/toolbars/draw'], function(connect, IdHandler) {
var _mapview = function() {
var self = this;
this.start = function() {
self.map = new esri.Map('map');
/**
do a bunch of map stuff
**/
connect.connect(self.map, 'onLoad', function() {
// initialize my little identify helper module
var identify = new IdHandler(self.map);
/**
Now, let's say you have a drawtool that will add points
to your map for some reason. A common problem is you can add the point,
but the map click to add a point also triggers the identify.
Easy way to handle this now...
**/
var drawTool = new esri.toolbars.Draw(map);
/** draw nonsense stuff here somewhere **/
connect.connect(someButton, 'click', function() {
drawTool.activate(esri.toolbars.Draw.POINT);
// now pause the identify map click
identify.handler.pause();
});
connect.connect(drawTool, 'onDrawEnd', function(geom) {
drawTool.deactivate();
// turn the identify back on
identify.handler.resume();
});
});
};
};
return _mapview;
});
It can actually come in pretty handy. This has worked since the 3.0 release I think, because I tested it with 3.2. So I'm assuming since the upgrade to Dojo 1.7.
... View more
02-05-2013
04:40 AM
|
0
|
0
|
2032
|
|
POST
|
Taking a guess as to the why, the first time you make the grid, it's bound to the HTML dom node or "siteGrid". When you execute it again, you are trying to bind a new Grid to the same node, but like widgets, I think the Grid is already bound, so it can't properly refresh the data. Dojo keeps track of these elements. So, at first I tried a mySiteGrid.refresh(), but nope, the previous dom elements that make up the Grid are still there. So I moved the mySiteGrid declaration out of scope of the function, then do a check if it's null, if it is, initialize it, then refresh the old data and load new data. var mySiteGrid; function executeSite() { require(["dgrid/Grid", "dojo/_base/array"], function(Grid, array) { //define query task siteQueryTask = new esri.tasks.QueryTask(window.sitesUrl); //define query params siteQuery = new esri.tasks.Query(); siteQuery.returnGeometry = true; siteQuery.outFields = window.siteFields; siteQuery.where = "NAME LIKE '" + dojo.byId('stateText').value + "%'" + " OR " + "NAME LIKE '%" + dojo.byId('stateText').value + "%'"; siteQueryTask.execute(siteQuery, function(results) { var siteData = []; var siteData = array.map(results.features, function(feature){ return { "id": feature.attributes[window.siteFields[0]], "NAME": feature.attributes[window.siteFields[1]] } }); if (!mySiteGrid) { mySiteGrid = new Grid({ columns: { "id": "ZOOM", "NAME": "State Name" } }, "siteGrid"); } mySiteGrid.refresh(); mySiteGrid.renderArray(siteData); dojo.byId("siteInfo").innerHTML = siteData.length + " records found"; }); }); } This worked. I'm pretty sure trying to rebind a DGrid to a dom element that already has the DGrid is what was causing your issue.
... View more
01-28-2013
01:51 PM
|
0
|
0
|
1089
|
|
POST
|
Using Flex SDK 4.6 and ArcGIS API 3.1. I've spent all day uprading a current application from Flex 4.0/ArcGIS 2.3 to Flex 4.6/ArcGIS 3.1 to make it easier for me to maintain going forward. I've pretty much nailed everything down except now, my InfoWindows no longer display the label in the header. Our InfoWindows display a lot of varying information, so I have a class that looks like this. public class MyInfoWindowRenderer extends SkinnableComponent implements IGraphicRenderer {} This allows me to skin the InfoWindow and access the graphic to get access to it's source layer and so on. This has always worked just fine. When a Graphic is loaded, I set the infoWindow label.
public function set graphic(value:Graphic):void
{
// graphic stuff
_map.infoWindow.label = "Some info based on Graphic";
}
I even tried setting the label to a default text. If I debug, I can that the infoWindow.label is set correctly, and I can even see that infoWindow.labelText::m_label is set. infoWindow.labelVisible is true and I verified that to make sure nothing weird was going on. At this point, I'm at a loss. It's been quite some time since I've done Flex dev, I mostly maintain these days, so any tips on what could be causing this issue would be appreciated.
... View more
01-28-2013
11:21 AM
|
0
|
1
|
830
|
|
POST
|
I know, but I was hoping if I loaded it with ScriptBundle the helpers would get processed. This method is a quick fix, but not ideal for my situation. This will come in handy on prototyping though, thanks. The solution I found was to create a custom Router that added a trailing slash to the Url. http://stackoverflow.com/questions/1385265/add-a-trailing-slash-at-the-end-of-each-url This won't break my bundles like URL Rewrite will. Thanks again.
... View more
01-24-2013
03:00 AM
|
0
|
0
|
1964
|
|
POST
|
Ha, thanks! I'll give that a shot when I get home. It's much simpler than the method I used to do a custom router to add the slash. Will that work if I load the js file with the ScriptBundle then? I didn't think it would work in a standalone js file, but admittedly I didn't try.
... View more
01-23-2013
04:39 AM
|
0
|
0
|
1964
|
|
POST
|
Well this is weird. If my site url is http://<servername>/appname My loader is broken, but if my site url is http://<servername>/appname/ It works perfect because the regex is looking for the last "/" to start the replace. For some reason a vanilla html/js app will automatically append the "/" at the end of the URL, but MVC4 is not, probably because there is no index.html in the root of the app. So I think there is some sort of setting I need to adjust for this to happen, which I just find odd. I'll have to dig in further on this one. Just a heads up if anyone else comes across this problem. If I can figuer out a solution, I'll post it up.
... View more
01-18-2013
03:26 AM
|
0
|
0
|
1964
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 05-19-2026 02:12 PM | |
| 1 | 04-24-2026 11:01 AM | |
| 2 | 04-21-2026 07:06 AM | |
| 1 | 02-27-2026 06:31 AM | |
| 1 | 01-13-2026 02:15 PM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|