|
POST
|
From the JS API side of things, this is roughly what you would do: Take your lat/long location and create a new point geometry Buffer the point's geometry slightly and then provide the buffered geometry as the geometry parameter for a new query Finally, use queryTask to query your appropriate data layer (I'm assuming it's a featureLayer)
... View more
04-22-2013
09:16 AM
|
0
|
0
|
1161
|
|
POST
|
I primarily use Firebug with Firefox but also use Chrome and IE when I come across errors. I don't know why but sometimes one debugger may expose more information about a JS error than the other two. There have been times when it was more help to use the debugger in IE than Firebug. Of course, you SHOULD test your application in different browsers to ensure consistency and that everything works. One example that comes to mind is if your application works with dates. I had some date formatting code that worked fine in Firefox and IE but returned "undefined" in Chrome. The same will also apply to any CSS styling that you do (even more so if you alter the CSS properties using javascript).
... View more
04-18-2013
07:23 AM
|
0
|
0
|
1149
|
|
POST
|
Thanks for the suggestion, Husen, but I'm a little puzzled about it. My services seem to have 2048 pixels as image widths/heights. Are you suggesting that I change those numbers to match the dimensions I use in my JS code? In the example code I posted in this thread, I'm specifying a 600x400 printTask JPEG. Are you suggesting that I specify 600x400 instead of the current 2048x2048 for my services under the paramaters tab? [Side note- where is this option documented? I sure couldn't find it under the ArcGIS Server 10.1 help]
... View more
04-18-2013
07:09 AM
|
0
|
0
|
1892
|
|
POST
|
You should review this ESRI sample to get you started. Although the sample's tabbed interface inside the infoWindow complicates a little, the basic workflow is there- Create a dojo container Create your chart DIV create your chart (last line of this code block would be your chart.render() Insert the chart element into your dojo container Finally, at the end of your infoWindow content function, return the dojo container's node: return dContent.domNode; Here's a full showContent function example of mine that inserts a chart into an infoWindow. I'm sorry it's a little complex but hopefully you can see what you need to see from it: function raceByBlockgroupContent(graphic) { var theTextContent; theTextContent = "<table cellpadding=\"3\"><tr><td colspan=\"3\" style=\"background:#5495D6; font-weight:bold;font-size:125%;color:white\">" + graphic.attributes.pctMinor + "% of the population within this block group identified with a race other than white.</td></tr>"; theTextContent = theTextContent + "<tr><td>1.</td><td>White Alone:</td><td>" + dojo.number.format(graphic.attributes.B02001004) + "</td></tr>"; theTextContent = theTextContent + "<tr><td>2.</td><td>Black or African American Alone:</td><td>" + dojo.number.format(graphic.attributes.B02001007) + "</td></tr>"; theTextContent = theTextContent + "<tr><td>3.</td><td>American Indian and Alaska Native Alone:</td><td>" + dojo.number.format(graphic.attributes.B02001010) + "</td></tr>"; theTextContent = theTextContent + "<tr><td>4.</td><td>Asian Alone:</td><td>" + dojo.number.format(graphic.attributes.B02001013) + "</td></tr>"; theTextContent = theTextContent + "<tr><td>5.</td><td>Native Hawaiian and Other Pacific Islander Alone:</td><td>" + dojo.number.format(graphic.attributes.B02001016) + "</td></tr>"; theTextContent = theTextContent + "<tr><td>6.</td><td>Some Other Race Alone:</td><td>" + dojo.number.format(graphic.attributes.B02001019) + "</td></tr>"; theTextContent = theTextContent + "<tr><td>7.</td><td>Two or More Races:</td><td>" + dojo.number.format(graphic.attributes.B02001022) + "</td></tr>"; theTextContent = theTextContent + "<tr><td>8.</td><td>Two Races Including Some Other Race:</td><td>" + dojo.number.format(graphic.attributes.B02001025) + "</td></tr>"; theTextContent = theTextContent + "<tr><td>9.</td><td style=\"border-bottom: 1px solid #000000\">Two Races Excluding Some Other Race, and Three or More Races:</td><td style=\"border-bottom: 1px solid #000000\">" + dojo.number.format(graphic.attributes.B02001028) + "</td></tr>"; theTextContent = theTextContent + "<tr><td colspan=\"2\" style=\"font-weight:bold;font-style:italic;font-size:115%\">TOTAL POPULATION:</td><td style=\"font-weight:bold;font-style:italic;font-size:115%\">" + dojo.number.format(graphic.attributes.B02001001) + "</td></tr></table>"; var cp1 = new dijit.layout.ContentPane({ title: "Details", style: "height: 100%; width: 97%", }); //Left Panel (population table) var cp2 = new dijit.layout.ContentPane({ title: "Details", style: "height: 100%; width: 47%; background: #D6EAFF; border: 4px solid #478FB2; float: left", content: theTextContent }); //Right Panel (percentage pie chart) var cp3 = new dijit.layout.ContentPane({ title: "Details 2", style: "height: 100%; width: 48%; float:right", content: "" }); cp1.containerNode.appendChild(cp2.domNode); cp1.containerNode.appendChild(cp3.domNode); var theChartDiv = dojo.place("<div></div>",cp3.containerNode); var theLegendDiv = dojo.place("<div></div>",cp3.containerNode); //create the chart var pieChart = new dojox.charting.Chart2D(theChartDiv, { title: "Breakdown of Total Population By Race", titlePos: "top", titleGap: 20, titleFont: "bold normal normal 15pt Arial", titleFontColor: "black" }); //set the theme pieChart.setTheme(dojox.charting.themes.Distinctive); //add plot pieChart.addPlot("default", { type: "Pie", radius: 100, startAngle: 45, labels: true, font: "normal normal 12pt Arial", labelWiring: "grey", labelStyle: "columns", fontColor: "black", labelOffset: "-10" }); //add the data series var pieData = [{ "x": "White", "y": graphic.attributes.B02001004, tooltip: "White: " + dojo.number.format(graphic.attributes.B02001004), legend: " 1. " }, { "x":"Black", "y":graphic.attributes.B02001007, tooltip: "Black / African American: " + dojo.number.format(graphic.attributes.B02001007), legend: " 2. " }, { "x": "Native American", "y": graphic.attributes.B02001010, tooltip: "Native American: " + dojo.number.format(graphic.attributes.B02001010), legend: " 3. " }, { "x": "Asian", "y": graphic.attributes.B02001013, tooltip: "Asian: " + dojo.number.format(graphic.attributes.B02001013), legend: " 4. " }, { "x": "Pacific Islander", "y": graphic.attributes.B02001016, tooltip: "Pacific Islander: " + dojo.number.format(graphic.attributes.B02001016), legend: " 5. " }, { "x": "Other", "y": graphic.attributes.B02001019, tooltip: "Other: " + dojo.number.format(graphic.attributes.B02001019), legend: " 6. " }, { "x": "Two or More", "y": graphic.attributes.B02001022, tooltip: "Two or More Races: " + dojo.number.format(graphic.attributes.B02001022), legend: " 7. " }, { "x": "Two Races (including Some Other Race)", "y": graphic.attributes.B02001025, tooltip: "Two or More Races (including Other): " + dojo.number.format(graphic.attributes.B02001025), legend: " 8. " }, { "x": "Two Races (excluding Some Other Race), Three or More Races", "y": graphic.attributes.B02001028, tooltip: "Two or More Races (Excluding Other): " + dojo.number.format(graphic.attributes.B02001028), legend: " 9. "} ]; pieChart.addSeries("January",pieData); //slice animation! new dojox.charting.action2d.MoveSlice(pieChart,"default"); //tooltips! new dojox.charting.action2d.Tooltip(pieChart,"default"); //render the chart pieChart.render(); //Add the legend ONLY if there is more than one category with values. If not, the DOJO code will fail var numOks = 0; if (graphic.attributes.B02001004 > 0) {numOks++;} if (graphic.attributes.B02001007 > 0) {numOks++;} if (graphic.attributes.B02001010 > 0) {numOks++;} if (graphic.attributes.B02001013 > 0) {numOks++;} if (graphic.attributes.B02001016 > 0) {numOks++;} if (graphic.attributes.B02001019 > 0) {numOks++;} if (graphic.attributes.B02001022 > 0) {numOks++;} if (graphic.attributes.B02001025 > 0) {numOks++;} if (graphic.attributes.B02001028 > 0) {numOks++;} if (numOks > 1) { var legend1 = new dojox.charting.widget.Legend({chart: pieChart}, theLegendDiv); } else { var catDesc; if (graphic.attributes.B02001004 > 0) { catDesc = '<SPAN style=\"font-style:italic\">\"White\"</SPAN>';} if (graphic.attributes.B02001007 > 0) { catDesc = '<SPAN style=\"font-style:italic\">\"Black\"</SPAN>';} if (graphic.attributes.B02001010 > 0) { catDesc = '<SPAN style=\"font-style:italic\">\"Native American\"</SPAN>';} if (graphic.attributes.B02001013 > 0) { catDesc = '<SPAN style=\"font-style:italic\">\"Asian\"</SPAN>'; } if (graphic.attributes.B02001016 > 0) { catDesc = '<SPAN style=\"font-style:italic\">\"Pacific Islander\"</SPAN>';} if (graphic.attributes.B02001019 > 0) { catDesc = '<SPAN style=\"font-style:italic\">\"Other\"</SPAN>';} if (graphic.attributes.B02001022 > 0) { catDesc = '<SPAN style=\"font-style:italic\">\"Two or More Races\"</SPAN>';} if (graphic.attributes.B02001025 > 0) { catDesc = '<SPAN style=\"font-style:italic\">\"Two Races (including Some Other Race)\"</SPAN>';} if (graphic.attributes.B02001028 > 0) { catDesc = '<SPAN style=\"font-style:italic\">\"Two Races (excluding Some Other Race), Three or More Races\"</SPAN>';} theLegendDiv.innerHTML = '<SPAN style=\"font-weight:bold\">NOTE:</SPAN> ' + catDesc + ' contains all values<br/><br/>'; } return cp1.domNode; }
... View more
04-17-2013
07:37 AM
|
0
|
0
|
848
|
|
POST
|
@Husen- No, unfortunately, I have not resolved this (or worked on it lately). I experience the symbology swelling like you describe.
... View more
04-17-2013
06:55 AM
|
0
|
0
|
1892
|
|
POST
|
Have you verified your JS code through JSLint or something similar to make sure there aren't any other syntax issues? I was migrating a v2.8 app to 3.3 that loads Jquery 1.8.2 and I was getting an error like you described and it was driving me crazy. Turns out I had some other sort of JS syntax error that manifested itself as this jquery error inside the javascript API. Good luck! Steve
... View more
04-16-2013
11:54 AM
|
0
|
0
|
2408
|
|
POST
|
Random suggestion but how about adding your button "fix" code into a dojo.connect for your print button's onClick event?
... View more
04-16-2013
11:44 AM
|
0
|
0
|
3103
|
|
POST
|
I specify the sorting over on the HTML side of things for filteringSelect by adding the following: searchAttr="<your field name>" fetchProperties="{sort:[{attribute:'<your field name>', descending:false}]}" The full HTML reference looks like this: <input id="cboCrossStEnd" dojoType="dijit.form.FilteringSelect" checked="checked" searchAttr="CROSSST" name="WidgetName" pageSize="6" fetchProperties="{sort:[{attribute:'CROSSST', descending:false}]}" placeHolder="Select a road from the list" onChange="<your function here>" /> Here's my JS code for populating the filteringSelect (this is triggered via dojo.connect during the onLoad event): function populateRdNameCbo(results) { //Populate the dropdown list box with unique values values = []; testVals = {}; features = results.features; dojo.forEach (features, function(feature) { curName = feature.attributes.FULLNAME; if (!testVals[curName]) { testVals[curName] = true; values.push({"OBJECTID":feature.attributes.OBJECTID,"RDNAME":feature.attributes.FULLNAME}); } }); dataItems = { identifier: "OBJECTID", label: "RDNAME", items: values }; theStore = new dojo.data.ItemFileReadStore({data:dataItems}); dijit.byId("cboRdName").set("store", theStore); } My code also eliminates duplicate entries as it adds items to the list. Seems to work for me.
... View more
04-16-2013
07:13 AM
|
0
|
0
|
1371
|
|
POST
|
Thanks, John. The documentation for routeParam is pretty vague so I wasn't sure about that. I think as a work around, I'll prompt the user to click along the desired street and then add the clicked point as a third stop along the desired route.
... View more
04-16-2013
06:58 AM
|
0
|
0
|
750
|
|
POST
|
I haven't dealt with this but a quick Google search revealed this.
... View more
04-12-2013
02:42 PM
|
0
|
0
|
1682
|
|
POST
|
Just came across this. We have a development sever within our organization (let's call it DMC) that is used for development web maps. I've mostly used v2.8 of the API but recently upgraded one app to v3.3 Yesterday I started developing a completely new app using one of the ESRI v3.4 samples as a starting point. I finally got around to adding in the basemap selection dropdown button as shown in this ESRI sample. I've modified it slightly but my modified version has run fine under v2.8 and v3.3: var map, initExtent, basemapGallery;
basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: true,
map: map
});
//Manually add the USGS Topo basemap into the basemap gallery
var usgsLayer = new esri.dijit.BasemapLayer({
url: "http://server.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer"
});
var usgsBasemap = new esri.dijit.Basemap({
layers: [usgsLayer],
title: 'USGS Topoography'
});
basemapGallery.add(usgsBasemap);
// Populate the basemap gallery widget with the list of ESRI basemaps
dojo.connect(basemapGallery, 'onLoad', function () {
//add the basemaps to the menu but exclude the "Oceans" basemap
dojo.forEach(basemapGallery.basemaps, function (basemap) {
if (basemap.title != 'Oceans') {
dijit.byId("basemapMenu").addChild(new dijit.MenuItem({
label: basemap.title,
onClick: dojo.hitch(this, function () {this.basemapGallery.select(basemap.id);})
}));
}
});
});
When I just added this code into my v3.4 based app, it would throw an error during the "new esri.dijit.BasemapGallery" line of code. Under IE, it would just say "Access Denied" but Firefox returned: "Error: Permission denied for <file://> to create wrapper for object of class UnnamedClass
http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/
Line 15" I spent some time verifying that my code hadn't copy/pasted wrong and then zero'd in on the reference to "file" in the Firefox error. In the address bar of my browser, the path to the HTML was a UNC format path ala "\\dmc\appName\index.html" but the minute I changed the URL to "http:\\dmc\appName\" the basemapGallery no longer threw an error. and loaded successfully. Very strange. This did not throw an error in previous versions of the API. Steve
... View more
04-10-2013
10:37 AM
|
0
|
0
|
765
|
|
POST
|
I just started playing with routeTask and, although it works great, it can produce some unintended routes. I can't see an obvious way to do this so I'll just ask- can you specify a parameter to the route task so that any route that is calculated MUST utilize a specific street? I'm considering using the routeTask to help map road segments by specifying the starting and ending locations. The problem occurs if there's a major road that parallels the actual road I want because the calculated route will jump onto the major road instead of following the local road. In my simple tests, the route task would create the route I wanted if I was able to add another stop along the road I'm interested in and between the two end points. Thanks! Steve
... View more
04-09-2013
07:15 PM
|
0
|
3
|
1272
|
|
POST
|
I just got rid of mine. It was a bear to find in the CSS but I finally did. Here's what I had to add to my CSS file to finally eliminate it: .claro .dijitTooltipConnector { background:none !important; } [I was using the CLARO dojo style. Change that reference to whatever style you're using] Good luck! Steve
... View more
04-09-2013
02:08 PM
|
0
|
0
|
1398
|
|
POST
|
It would certainly be ideal if ESRI provided a method of retrieving this information. If Ken's TOC widget suggestion doesn't work for you, there's always the option of scraping the REST service description page using AJAX and YQL. I used the code in the link above as a base in order to extract file names from an HTML version of a FTP file directory listing. I suppose you could pass the URL to the REST Service directory of the layer you're interested in (what you previously described such as this) and the process the results to extract the info you need. Not pretty- but doable. Steve
... View more
04-09-2013
07:15 AM
|
0
|
0
|
1165
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-12-2026 01:43 PM | |
| 1 | 03-12-2026 08:41 AM | |
| 2 | 03-10-2026 10:10 AM | |
| 1 | 02-18-2026 09:20 AM | |
| 3 | 01-22-2026 02:03 PM |