|
POST
|
I see now that I still had all my references to version 2.5 of the API because that's what the forum post for clusters used. I changed my API references to 3.2 and I'm not getting the error on the dojo.require("extras.ClusterLayer"). The code still isn't working right, but at least I'm past the first error.
... View more
10-09-2012
08:01 AM
|
0
|
0
|
2780
|
|
POST
|
I'll just stick with my standard query task syntax then, which I'm more familiar with. I'm getting stuck at the very beginning with the dojo.Config, which is generating an error in Aptana (version 2). I got this error when I loaded the sample too:
<script>
var dojoConfig = {
parseOnLoad: true,
packages: [{
"name": "extras",
"location": location.pathname.replace(/\/[^/]+$/, '') + "/extras" }]
};
</script>
The error: Multiple items missing at this position: missing ) after argument list Bad regular expression: \/[^/]+$/, '') + "/extras" In the ESRI example, I changed this to have the location as just "/extras", which got rid of the error and then the sample ran. When I made the same changes in my own code for dojo.Config, it errors on the line
dojo.require("extras,ClusterLayer);
The error in Firebug is 'url is undefined', which I take to mean it's not finding ClusterLayer.js after all. I wouldn't call myself a novice programmer, but I am relatively new to JavaScript. I'm pretty comfortable with the coding of the functions, so probably the error toward the top. I don't know if my query task function is correct because it's not making it that far before it blows up!
... View more
10-09-2012
07:51 AM
|
0
|
0
|
2780
|
|
POST
|
I"m not sure why I would use an esri.request to the query endpoint as opposed to executing a standard query task. I usually execute my query tasks with a callback to generate my featureset. Is is faster to request the data or formatted differently if I use esri.request instead?
... View more
10-09-2012
05:41 AM
|
0
|
0
|
2780
|
|
POST
|
I have tried to implement the ESRI forum example for clustering "Clustering with Javascript API" http://www.arcgis.com/home/item.html?id=c546bc8d4f0b4c0fbdf149b92223e681 with mixed results. Sometimes the cluster layer draws fine and sometimes it doesn't draw at all. Even when it draws it's very slow and I'm not sure the users will be satisfied. There seems to be mixed reviews on this. The fact that it's display seem to be intermittent for me is enough for me to look to another clustering solution. More recently, the ESRI sample "Point Clustering" was posted. http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/layers_point_clustering.html I like the way this looks, but I'm having a hard time understanding how to make it work with a layer as input, since my data is already in a service. It seems like either I should add a function to step through all my features to create properly formatted input data, or I should edit the custom layer to handle features of a featureset or featurelayer instead. Has anyone modified ESRI's point clustering example to use something besides the input JSON file?
... View more
10-05-2012
08:32 AM
|
1
|
42
|
22307
|
|
POST
|
I am trying to do about the same thing. I want the user to either be able to click OR to enter an address and re-use my identifyTask. This is mostly working. If I use a map click, it returns just the polygons I would expect. When I pass the executeidentifytask function the geocoded point, it seems to be using too high of a tolerance on the identify parameters. It returns the polygons from the identify like I'd expect, but also several adjacent polygons to it. It seems like maybe because I'm zoomed out when I enter an address, that is still the map extent and tolerance that identify is using. I am zooming into the geocoded point and I would expect the identifyparameters to use this closer map extent, but maybe that's not what is happening. I think I might need to add something with a mapPoint/screenPoint conversion. function mapReady(map){ //identify task is the same layer as districtLayer added above identifyTask = new esri.tasks.IdentifyTask("http://ogitest.oa.mo.gov/ArcGIS/rest/services/legisDistrict/MapServer"); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 3; // identifyParams.returnGeometry = true; identifyParams.layerIds = [0,1,2]; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE; identifyParams.spatialReference = spatialReference; identifyParams.width = map.width; identifyParams.height = map.height; dojo.connect(map, "onClick", executeIdentifyTask); //resize the map when the browser resizes dojo.connect(dijit.byId('map'), 'resize', map, map.resize); dojo.connect(map.infoWindow, "onHide", function() {map.graphics.clear();}); } function executeIdentifyTask(evt) { identifyParams.mapExtent = map.extent; identifyParams.geometry = evt.mapPoint; if (identifyLocator) { // geometry is coming from address function identifyParams.geometry = evt; } var deferred = identifyTask.execute(identifyParams); //identify runs from geocoded point and not just click deferred.addCallback(function(response) { // response is an array of identify result objects // Let's return an array of features. return dojo.map(response, function(result) { var feature = result.feature; feature.attributes.layerName = result.layerName; feature.setInfoTemplate(plainTemplate); identifyLocator = false; return feature; }); }); // InfoWindow expects an array of features from each deferred // object that you pass. If the response from the task execution // above is not an array of features, then you need to add a callback // like the one above to post-process the response and return an // array of features. map.infoWindow.setFeatures([ deferred ]); map.infoWindow.show(evt.mapPoint); } function locate() { map.graphics.clear(); var address = {"SingleLine":dojo.byId("txtAddress").value}; locator.outSpatialReference= map.spatialReference; var options = { address:address, outFields:["Loc_name"] }; locator.addressToLocations(options); } function showResults(candidates) { var candidate; var symbol = new esri.symbol.SimpleMarkerSymbol(); var addressTemplate = new esri.InfoTemplate("Location", "Address: ${address}<br />"); symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE); symbol.setColor(new dojo.Color([255,0,0,0.75])); dojo.every(candidates,function(candidate){ console.log(candidate.score); if (candidate.score > 80) { console.log(candidate.location); var attributes = { address: candidate.address, score:candidate.score, pt:candidate.location }; geometryPt = candidate.location; var graphic = new esri.Graphic(geometryPt, symbol, attributes, addressTemplate); //add a graphic to the map at the geocoded location map.graphics.add(graphic); //add a text symbol to the map listing the location of the matched address. var displayText = candidate.address; map.infoWindow.show(geometryPt); // map.infoWindow.resize(200,100); map.infoWindow.setTitle("Address"); map.infoWindow.setContent(displayText); // identifyLocator = true; executeIdentifyTask(geometryPt); console.log("submitting address to executeIdentifyTask"); // return false; //break out of loop after one candidate with score greater than 80 is found. } }); if(geometryPt !== undefined){ var containsCountyPosition = (dojo.byId("txtAddress").value.toLowerCase().indexOf(" county")); if (containsCountyPosition > 0) { map.centerAndZoom(geometryPt,10); } else { map.centerAndZoom(geometryPt,12); } } }
... View more
09-28-2012
09:19 AM
|
0
|
0
|
1173
|
|
POST
|
I do have the District in the title with the curly braces, which doesn't come up. I added an entry to the popuptemplate for fieldName, but the district number never appears in any place I put it. senateTemplate = new esri.dijit.PopupTemplate({
title: "Senate District {District}",
mediaInfos: [{
"title": "{District}",
"caption": "{Name}",
"type": "image",
"value": {
"sourceURL": "{photoLink}",
"linkURL": "" }
}],
fieldInfos: [
{ fieldName: "District", label: "Senate District" , visible: true, format:{places: 0} } ,
{fieldName: "webLink", label: "Open Web Page" , visible: true }]
});
houseTemplate = new esri.dijit.PopupTemplate({
title: "House District {District}",
mediaInfos: [{
"title": "{District}",
"caption": "{Name}",
"type": "image",
"value": {
"sourceURL": "{photoLink}",
"linkURL": "" }
}],
fieldInfos: [
{ fieldName: "District", label: "House District" , visible: true, format:{places: 0} } ,
{ fieldName: "webLink", label: "Open Web Page" , visible: true }]
}); I set a breakpoint in my callback function on the feature variable and looked at the what is returned for attributes. I only see the attributes that are for the text fields. I don't understand why at this point in the code, it has anything to do with the format of my popup templates anyway. I don't think the values are ever found and that's why it doesn't appear in the popup template. I have control over this service, so I can change the District field to be text, but that's much of an answer and I won't always be able to control the field types.
function executeIdentifyTask(evt) {
identifyParams.mapExtent = map.extent;
identifyParams.geometry = evt.mapPoint;
var deferred = identifyTask.execute(identifyParams);
//identify runs from geocoded point and not just click
if (identifyLocator) { // geometry is coming from address function
identifyParams.geometry = evt;
}
deferred.addCallback(function(response) {
// response is an array of identify result objects
// Let's return an array of features.
return dojo.map(response, function(result) {
var feature = result.feature;
feature.attributes.layerName = result.layerName;
if(result.layerName === 'senate'){
console.log("Senate District: " & feature.attributes.District);
feature.setInfoTemplate(senateTemplate);
}
else if (result.layerName === 'house'){
console.log("House District: " & feature.attributes.District);
feature.setInfoTemplate(houseTemplate);
} else {
console.log("congress not defined - create template for it");
}
identifyLocator = false;
return feature;
});
});
// InfoWindow expects an array of features from each deferred
// object that you pass. If the response from the task execution
// above is not an array of features, then you need to add a callback
// like the one above to post-process the response and return an
// array of features.
map.infoWindow.setFeatures([ deferred ]);
map.infoWindow.show(evt.mapPoint);
}
... View more
09-27-2012
09:02 AM
|
0
|
0
|
708
|
|
POST
|
I'm fine with the buttons being on the map, so this solution works for me. Now that my identify is in the right place, I notice the returned feature doesn't contain all the attributes - only the text fields! I have fields for Population and District, both defined as numeric. When I look at the attributes from the identified feature, I only see name,photoLink and pageLink, which are defined as text. There's nothing explicit in identify that limits the fields returned is there? I have checked and rechecked the services and all fields are included at that point.
... View more
09-27-2012
06:42 AM
|
0
|
0
|
708
|
|
POST
|
I have a map service that contains 3 layers, representing the new house, senate and congressional districts. I have set up an identify task to open a popupTemplate that will show the district number, photo and link to their web page. The identify isn't executing where I click, it's using a point about 20 miles south. This is based on the sample "Display identify results in popup", the 2nd one in the samples list. Someone needs to rename one of these, there should be two sample by the same name!). I also want my identify to execute after an address is added. That seems to be working, but maybe my modifications to make that happen are part of the problem. I'm attaching my full code, since I might have chopped too much making it fit in this posting. <script type="text/javascript"> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); dojo.require("esri.tasks.locator"); dojo.require("esri.dijit.Popup"); dojo.require("esri.dijit.Legend"); dojo.require("dijit.form.CheckBox"); var map; var spatialReference; var locator; var identifyTask,identifyParams; var districtLayer; var pathName = "http://myserver/ArcGIS/rest/services"; var identifyLocator = false; var senateTemplate; var houseTemplate; var congressTemplate; function init() { spatialReference = new esri.SpatialReference({wkid: 102100 }); startExtent = new esri.geometry.Extent(-10583000, 4287025, -9979000, 4980462, spatialReference); //setup the popup window var popup = new esri.dijit.Popup({ fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.50])) }, dojo.create("div")); map = new esri.Map("map",{ infoWindow:popup, extent:startExtent }); locator = new esri.tasks.Locator("http://tasks.arcgis.com/ArcGIS/rest/services/WorldLocator/GeocodeServer"); dojo.connect(locator, "onAddressToLocationsComplete", showResults); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"); map.addLayer(basemap); districtLayer = new esri.layers.ArcGISDynamicMapServiceLayer(pathName+"/legisDistrict/MapServer",{id:'districts'}); map.addLayer(districtLayer); senateTemplate = new esri.dijit.PopupTemplate({ title: "Senate District {District}", mediaInfos: [{ "title": "{District}", "caption": "{Name}", "type": "image", "value": { "sourceURL": "{photoLink}", "linkURL": "" } }], fieldInfos: [ { fieldName: "webLink", label: "Open Web Page" , visible: true }] }); houseTemplate = new esri.dijit.PopupTemplate({ title: "House District {District}", mediaInfos: [{ "title": "{District}", "caption": "{Name}", "type": "image", "value": { "sourceURL": "{photoLink}", "linkURL": "" } }], fieldInfos: [ { fieldName: "webLink", label: "Open Representatives's Web Page" , visible: true }] }); dojo.connect(map,"onLoad",mapReady); } function mapReady(map){ //identify task is the same layer as districtLayer added above identifyTask = new esri.tasks.IdentifyTask(pathName + "/legisDistrict/MapServer"); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 3; // identifyParams.returnGeometry = true; identifyParams.layerIds = [0, 1, 2]; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE; identifyParams.spatialReference = spatialReference; identifyParams.width = map.width; identifyParams.height = map.height; dojo.connect(map, "onClick", executeIdentifyTask); //resize the map when the browser resizes dojo.connect(dijit.byId('map'), 'resize', map, map.resize); } function executeIdentifyTask(evt) { identifyParams.mapExtent = map.extent; identifyParams.geometry = evt.mapPoint; var deferred = identifyTask.execute(identifyParams); //identify runs from geocoded point and not just click if (identifyLocator) { // geometry is coming from address function identifyParams.geometry = evt; } deferred.addCallback(function(response) { // response is an array of identify result objects // Let's return an array of features. return dojo.map(response, function(result) { var feature = result.feature; feature.attributes.layerName = result.layerName; if(result.layerName === 'senate'){ console.log("Senate District: " & feature.attributes.District); feature.setInfoTemplate(senateTemplate); } else if (result.layerName === 'house'){ console.log("House District: " & feature.attributes.District); feature.setInfoTemplate(houseTemplate); } else { console.log("congress not defined - create template for it"); } identifyLocator = false; return feature; }); }); map.infoWindow.setFeatures([ deferred ]); map.infoWindow.show(evt.mapPoint); } dojo.connect(map.infoWindow, "onHide", function() {map.graphics.clear();}); } dojo.addOnLoad(init); </script> </head> <body class="claro"> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline'" style="width: 100%; height: 100%; margin: 0;"> <div id="mainHeader" dojotype="dijit.layout.ContentPane" region="top" > Missouri Legislative Districts <div id="subheader"> 2010 District Boundaries <div id="divAddress" style="position:absolute; top:10px; right:25px; z-index:999;"> <input id="txtAddress" style="width:250px" type="text" value="Find address or place" class="textBox" onclick="clearTextInput();" /> <button id="btnGO" dojotype="dijit.form.Button" onClick="locate();">GO</button> </div> </div> </div> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'" > <div dojoType="dijit.form.Button" id="btnHouse" class="togglebutton" onClick="toggleLayer(1);"> House Districts </div> <div dojoType="dijit.form.Button" id="btnSenate" class="togglebutton" onClick="toggleLayer(0);"> Senate Districts </div> <div dojoType="dijit.form.Button" id="btnCongress" class="togglebutton" onClick="toggleBaseLayer(2);"> Congressional Districts </div> </div> </div> </div> </body> </html>
... View more
09-26-2012
01:44 PM
|
0
|
4
|
1118
|
|
POST
|
That's exactly what I ended up doing, but for a different reason. I was asked to make the web page automatically open on click, rather than first opening the infoWindow. That meant the infoTemplate was never needed, so I took the reference out,which took care of my original problem. Round about way to get there. I suspect I'm having a very similar problem with an identify task that isn't doing its identify in the place I click. It is consistently doing the identify a couple of counties south of the original user click. It's not really related to this thread, but I think I"m having the same problem understanding how deferred call back function really work.
... View more
09-26-2012
12:43 PM
|
0
|
0
|
602
|
|
POST
|
I have a project which is just shaded counties indicating where events are scheduled. I have a column "scheduledEvent" in my data I'm populating elsewhere. There is a hyperlink to a web page where there is an event. I wanted to show a different popup if the user clicked a nonshaded county. My code checks to see the value of ScheduledEvent in an If statement. I thought I was done, but then I realized if I clicked a county a 2nd time, instead of getting the "Sorry no events" infoWindow, it reverts back to the other infoTemplate, which shows the county name and hyperlink instead. I tried adding a popup.clearFeatures() at the start of the OnClick function, but it still seems to be remembering my previous "click". What is the proper way to completely remove my selected features. Set my deferred variable to null? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title>Rural Health Day Events</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/css/esri.css"> <link rel="stylesheet" type='text/css' href='http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/dijit/css/Popup.css'/> <style type="text/css"> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ padding:0; } </style> <script type="text/javascript">var dojoConfig = {parseOnLoad: true};</script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2"></script> <script type="text/javascript" language="Javascript"> dojo.require("esri.map"); dojo.require("esri.layers.FeatureLayer"); dojo.require("esri.dijit.InfoWindow"); dojo.require("esri.dijit.Popup"); var map; var pathName = "http://gis.dhss.mo.gov/arcgis/rest/services"; var countyFeatureLayer; var featureInfoTemplate; var noEventTemplate; function init() { var popup = new esri.dijit.Popup({ fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NULL, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,255,0]), 3), new dojo.Color([255,255,0,0.35])) }, dojo.create("div")); var spatialReference = new esri.SpatialReference({wkid: 102100 }); startExtent = new esri.geometry.Extent(-10583000, 4287025, -9979000, 4980462, spatialReference); map = new esri.Map("mapDiv", {extent: startExtent , logo:false, infoWindow:popup }); dojo.connect(map,"onClick",function(evt){ popup.clearFeatures(); var query = new esri.tasks.Query(); query.geometry = pointToExtent(map,evt.mapPoint,5); var deferred = countyFeatureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function (selection) { var eventStatus = selection[0].attributes['ScheduledEvent']; if (eventStatus == "No") { map.infoWindow.setTitle("Sorry"); map.infoWindow.setContent("No Events Scheduled"); map.infoWindow.show(evt.mapPoint); }else { map.infoWindow.setFeatures([deferred]); map.infoWindow.show(evt.mapPoint); } }); }); dojo.connect(popup,"onHide",function(){ popup.clearFeatures(); }); var countyLayer = new esri.layers.ArcGISDynamicMapServiceLayer(pathName+"/RuralHealthDayEvents/MapServer",{id:'events'}); map.addLayer(countyLayer); featureInfoTemplate = new esri.InfoTemplate( "Events", "<b>${NAME}</b><br/><a href= ${pageLink} target=_blank ;'>See Rural Health Day Events for ${NAME} County</a>"); countyFeatureLayer = new esri.layers.FeatureLayer(pathName+"/RuralHealthDayEvents/MapServer/0", { mode: esri.layers.FeatureLayer.MODE_SELECTION, outFields: ["NAME", "ScheduledEvent", "PageLink"] , infoTemplate: featureInfoTemplate }); map.addLayer(countyFeatureLayer); dojo.connect(map, 'onLoad', function(theMap) { //resize the map when the browser resizes dojo.connect(dijit.byId('map'), 'resize', map,map.resize); }); } function pointToExtent(map, point, toleranceInPixel) { var pixelWidth = map.extent.getWidth() / map.width; var toleraceInMapCoords = toleranceInPixel * pixelWidth; return new esri.geometry.Extent( point.x - toleraceInMapCoords, point.y - toleraceInMapCoords, point.x + toleraceInMapCoords, point.y + toleraceInMapCoords, map.spatialReference ); } dojo.addOnLoad(init); </script> </head> <body class="claro"> Click a shaded county to get information on their Rural Health Day event. <div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div> </body> </html>
... View more
09-26-2012
07:05 AM
|
0
|
2
|
1081
|
|
POST
|
Those pesky styles! I guess it wasn't in the example I was working from because there were style definitions throughout that handled it. Thanks for the quick response. It's working now.
... View more
09-25-2012
07:42 AM
|
0
|
0
|
488
|
|
POST
|
I have an infoTemplate set on my featurelayer and the map set to show the infoWindow on click executing a query. The information returned is correct, however, instead of appearing where I clicked, it appears in the upper left corner of the map, without the standard information balloon - just as text. Comparing to the sample, Feature layer with popup, I think mine is the same, except for the style and the way I defined the content of the infoTemplate. I don't think anything I've done would cause my infoWindow not to be displayed where I click! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title>Rural Health Day Events</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/esri/css/esri.css"> <style type="text/css"> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ padding:0; } </style> <script type="text/javascript">var dojoConfig = {parseOnLoad: true};</script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.1"></script> <script type="text/javascript" language="Javascript"> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); dojo.require("esri.layers.FeatureLayer"); dojo.require("esri.dijit.InfoWindow"); dojo.require("esri.dijit.Popup"); var map; var pathName = "http://hl042990:8399/arcgis/rest/services"; var infoTemplate; function init() { var popup = new esri.dijit.Popup({ fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,255,0]), 3), new dojo.Color([255,255,0,0.35])) }, dojo.create("div")); var spatialReference = new esri.SpatialReference({wkid: 102100 }); startExtent = new esri.geometry.Extent(-10583000, 4287025, -9979000, 4980462, spatialReference); map = new esri.Map("mapDiv", {extent: startExtent , logo:false, infoWindow:popup }); // dojo.connect(map,"onClick",function(evt){ var query = new esri.tasks.Query(); query.geometry = pointToExtent(map,evt.mapPoint,5); var deferred = countyFeatureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW); map.infoWindow.setFeatures([deferred]); map.infoWindow.show(evt.mapPoint); }); // var countyLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://hl042990:8399/arcgis/rest/services/RuralHealthDayEvents/MapServer",{id:'events'}); infoTemplate = new esri.InfoTemplate("${NAME}", "<a href= ${pageLink} target=_blank ;'>Show Rural Health Day Events for ${NAME} County</a>"); var countyFeatureLayer = new esri.layers.FeatureLayer("http://hl042990:8399/arcgis/rest/services/RuralHealthDayEvents/MapServer/0", { mode: esri.layers.FeatureLayer.MODE_SELECTION, outFields: ["NAME", "ScheduledEvent", "PageLink"] , infoTemplate: infoTemplate }); map.addLayer(countyLayer); map.addLayer(countyFeatureLayer); // dojo.connect(map, 'onLoad', function(theMap) { //resize the map when the browser resizes dojo.connect(dijit.byId('map'), 'resize', map,map.resize); }); // } function pointToExtent(map, point, toleranceInPixel) { var pixelWidth = map.extent.getWidth() / map.width; var toleraceInMapCoords = toleranceInPixel * pixelWidth; return new esri.geometry.Extent( point.x - toleraceInMapCoords, point.y - toleraceInMapCoords, point.x + toleraceInMapCoords, point.y + toleraceInMapCoords, map.spatialReference ); } dojo.addOnLoad(init); </script> </head> <body class="claro"> Click a shaded county to get information on their Rural Health Day event. <div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div> </body> </html>
... View more
09-25-2012
06:23 AM
|
0
|
2
|
1368
|
|
POST
|
I haven't quite got this working because I don't have the syntax right on the "open part of the grid. I have my collapse function as function collapseList() {
dojo.byId("rightPane").style.display = 'none';
dojo.style(dojo.byId("mapDiv"), "width", "100%");
dijit.byId("mapDiv").resize();
map.resize();
map.reposition();
} This did both hide the pane where my grid was loaded as well as expand my map to fill the screen. Now all I have to do is find the opposite of .style.display = 'none' and find a better place to put my 'hide' and 'show' buttons. I'm thinking I want to style them with an image of << and >>.
... View more
08-22-2012
01:39 PM
|
0
|
0
|
1133
|
|
POST
|
It's several hours later and it's not working for me either. Doesn't anyone ever look at it? I also contacted support.:mad:
... View more
08-08-2012
11:03 AM
|
0
|
0
|
372
|
|
POST
|
We have a query tool currently being designed outside the GIS environment which will allow the user to select a variety of health related parameters: collection year, gender, age etc. Most of the work is getting done in .NET and they are looking at Javascript for the mapping. Once the query runs, the user will have the option to see the results displayed on a map. Since it is still being designed, I do have some input on the most "GIS friendly" way to have this data formatted. I'm thinking something like JSON as a format they should be able to create out of their .NET and also be able to use with Javascript. Although the output fields may vary, there are limited geometry choices. Most queries will be county based, but a few maybe be ZIP code tabulation areas (ZCTA). I already have existing "plain" map services I've created for other projects for these boundaries. My thought is that I should be able to create a featureLayer out of the existing map service, and somehow step through the featureSet and query the Json data to create the infoTemplate and renderer? All the examples I see discuss 'linking to an existing table'. In this scenario, there will never be a table. If I can get to the featureSet of my featureLayer, does it help me somehow to convert it to Json? Does it make sense to create a JSON file and send to the developers and allow them to populate the attributes and bring the whole thing back in as a featureCollection? That sounds very inefficient, but that seems to be how people are managing KML data. All this data is maintained outside the GIS environment and creating a whole series of map services to duplicate it is not an option.
... View more
07-23-2012
08:58 AM
|
0
|
0
|
561
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-02-2017 02:38 PM | |
| 2 | 03-18-2022 10:14 AM | |
| 2 | 02-18-2016 06:28 AM | |
| 1 | 03-18-2024 07:29 AM | |
| 4 | 08-02-2023 06:08 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-25-2025
01:56 PM
|