|
POST
|
I'm remembering there used to be a few samples for changing the styling on the zoom slider for navigating. Did I just dream this? I swear I've seen several different styles, but maybe those were removed because of the newest API version or because of the web page changes to the new resource pages. (I don't hate them as much as some people seem to, but I still can't always find what I'm looking for.) Specifically I would like to replace the icons on the top and bottom of the slider, which are currently up and down arrows, to be plus and minus icons instead. I think I can override these symbols with a different style, but I'm not sure which style to change. When looking at this component in Firebug, I see a style of
.tundra .dijitSliderDecrementIconH, .tundra .dijitSliderDecrementIconV, .tundra .dijitSliderIncrementIconH, .tundra .dijitSliderIncrementIconV {
background-image: url("images/spriteRoundedIconsSmall.png");
background-repeat: no-repeat;
cursor: pointer;
height: 14px;
width: 14px;
}
Is this even close to what I should be messing with? Also, does anyone have a good suggestion for where I can learn more about sprite images? I'm having a hard time grasping the concept of sprites.
... View more
03-22-2013
07:47 AM
|
0
|
2
|
2135
|
|
POST
|
So my polygon with hole isn't going to be valid, but these are steps I can take to make it valid? After I posted this, I learned they are planning to redraw these boundaries so they don't look like this.
... View more
03-07-2013
09:23 AM
|
0
|
0
|
1026
|
|
POST
|
I have a polygon layer I am using as a querytask based on regional boundaries. The polygon layer is our state, cut into 5 large pieces. The county where the state offices are is a region unto itself, called central, which is completely surrounded by northwest region. I have verified that the northwest region does exclude this central region, so I would call this a polygon with a hole in it, or maybe a multipart polygon. My problem is when I want to use the geometry of the northwest region polygon as input to a query and query task. I'm first selecting the region from a pick list and determining the geometry. This geometry is then used as input to a 2nd query task. The callback function from the initial queryTask:
function showRegionResults (results) {
region = results.features[0].geometry;
map.setExtent(region.getExtent(), true);
findStaffInRegion(region);
}
The 2nd query task which is populating a datagrid:
function findStaffInRegion(region) {
var staffQueryTask = new esri.tasks.QueryTask(serverPathName + "/arcgis/rest/services/myService/MapServer/2"); //EUSstaff
var staffQuery = new esri.tasks.Query;
staffQuery.outFields = ["*"];
if (region) {
staffQuery.geometry = region;
staffQuery.spatialRelationship = esri.tasks.Query.SPATIAL_REL_CONTAINS;
staffQueryTask.execute(staffQuery);
dojo.connect(staffQueryTask, "onComplete", function(results){
var items = dojo.map(results.features, function(feature){
return feature.attributes;
});
var data = {
identifier: "Contact_ContactId", //This field needs to have unique values
label: "ID", //Name field for display. Not pertinent to a grid but used elsewhere.
items: items
};
//Create data store and bind to grid.
store = new dojo.data.ItemFileReadStore({
data: data
});
var fp = dijit.byId('floater');
if (fp.style.visibility=="hidden") {
fp.style.visibility="";
fp.show();
}
var staffGrid = dijit.byId('staffGrid');
staffGrid.setStore(store);
openFloatingPane();
});
}else{
console.log("region variable not defined")
}
}
This code works fine for all regions, except for the one that has the hole in it. Is that type of polygon not a valid input geometry for a Query? Am I misunderstanding what spatial relationship I should choose? If I have to, I can run another function that excludes the features that are in the central region, but I'd rather not do that if I just have something wrong with this logic.
... View more
03-06-2013
05:06 AM
|
0
|
3
|
1574
|
|
POST
|
The first query function finds the geometry, which is then passed to another querytask, this one based on geometry as a search instead of by attributes. In my example, I am using region, but you should be able to follow the logic. I have a dropdown list instead of a text input field to make sure the input is valid. function findRegion(){ var e = document.getElementById("regionSelect"); //the component name of the region selection var regionQueryTask = new esri.tasks.QueryTask("http://myserverpathName/ArcGIS/rest/services/myService/MapServer/3"); var regionQuery = new esri.tasks.Query; regionQuery.text = e.options[e.selectedIndex].text;//this is my primary display field if you needed another field, use a where clause regionQuery.returnGeometry = true; regionQueryTask.execute(regionQuery,showRegionResults); } The result function of the initial query finds the geometry of the feature that is selected in findRegion function showRegionResults (results) { region = results.features[0].geometry; map.setExtent(region.getExtent(), true); //zooms to the region findFeatureInRegion(region); } function findFeatureInRegion(region) { var newQueryTask = new esri.tasks.QueryTask("http://myserverpathName/arcgis/rest/services/myService/MapServer/2"); //EUSstaff var newQuery = new esri.tasks.Query; newQuery.outFields = ["*"]; if (region) { newQuery.geometry = region; newQuery.spatialRelationship = esri.tasks.Query.SPATIAL_REL_CONTAINS; newQueryTask.execute(newQuery); dojo.connect(newQueryTask, "onComplete", function(results){ //whatever you wanted to do with the features that were selected in the 2nd query } }
... View more
03-06-2013
04:47 AM
|
0
|
0
|
1731
|
|
POST
|
Don't hold your breath. There is quite a bit of animation that easily used in FLEX that isn't there in JS. I actually started out with the FLEX version, but have had to move away from it because of lack of mobile support. Yes, I know it can be written as an app, but that's not a popular alternative in this office.
... View more
02-27-2013
11:25 AM
|
1
|
0
|
2143
|
|
POST
|
When I've done this, I start with a featureLayer that is defined with the mode esri.layers.FeatureLayer.SELECTION. I've even set an additional featurelayer up specifically for this purpose, calling it selectFeatureLayer if I also need to have it available ON_DEMAND. Also in my selectFeatures function, I am getting to a single features with
var feature = features[0]
Here is the function I have for my clickHandler. Not the same as yours, but maybe you will spot something:
function onRowClickHandler(evt){
map.graphics.clear();
map.infoWindow.hide();
var OID = grid.getItem(evt.rowIndex).OBJECTID;
var query = new esri.tasks.Query();
query.objectIds = [OID];
parcelFeatureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW, function (features) {
var parcelExtent = esri.graphicsExtent(features);
parcelExtent.expand(2);
map.setExtent(parcelExtent);
var feature = features[0];
var centerPt = parcelExtent.getCenter();
feature.setInfoTemplate(parcelInfoTemplate);
map.infoWindow.setTitle(feature.attributes.PID);
map.infoWindow.setContent(feature.getContent());//from the infoTemplate defined in the original featureLayer definition
var labelPt = new esri.geometry.Point(centerPt, spatialReference);
map.infoWindow.show(labelPt);
});
}
... View more
02-27-2013
11:23 AM
|
0
|
0
|
1798
|
|
POST
|
Thanks Kelly. I was not looking in the right place to find "getContent".
... View more
02-27-2013
10:26 AM
|
0
|
0
|
830
|
|
POST
|
I have an infoTemplate that is using a function to format the content of the infoWindow: parcelInfoContent = parcelInfoTemplate.setContent(parcelSetWindowContent); A lot of my fields don't have any data, so in my function I'm checking to see if there is data before I put the information for that field: function parcelSetWindowContent(graphic) { var addressTest = graphic.attributes.SITEADDRES; var legalTest = graphic.attributes.LEGAL1; var twpRangeSecString = "Township:" + graphic.attributes.TOWNSHIP + " Range:" + graphic.attributes.RANGE + " Section: " + graphic.attributes.SECTION_ + "<br>" +"Legal Description:<br>" + graphic.attributes.LEGAL1; var initString = ""; if (addressTest.length > 1) { initString = initString + "Site Address: :" + addressTest ; } if (legalTest) { initString = initString + "<br>" + twpRangeSecString; } return initString; } I am also populating a datagrid of these parcels and I also need to have an onclick which zooms to the parcel and opens the same infoWindow. I'd like to use the same function to format, but I'm not sure how to get there. I thought maybe there was a function for 'getInfoContent' on the featurelayer I'm using this for. I can't quite figure this out. I thought maybe I could set a variable parcelInfoContent when I set the definition initially, but that didn't do the trick. function onRowClickHandler(evt){ map.graphics.clear(); map.infoWindow.hide(); var OID = grid.getItem(evt.rowIndex).OBJECTID; var selectedParcel; var query = new esri.tasks.Query(); query.objectIds = [OID]; // query.where = "PID= '" + parcelId + "'"; parcelFeatureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW, function (features) { var parcelExtent = esri.graphicsExtent(features); parcelExtent.expand(2); map.setExtent(parcelExtent); var feature = features[0]; var centerPt = parcelExtent.getCenter(); feature.setInfoTemplate(parcelInfoTemplate); map.infoWindow.setTitle(feature.attributes.PID); var content = esri.substitute(feature.attributes, parcelInfoContent); map.infoWindow.setContent(content); // map.infoWindow.setFeatures([feature]); var labelPt = new esri.geometry.Point(centerPt, spatialReference); map.infoWindow.show(labelPt); }); }
... View more
02-27-2013
07:51 AM
|
0
|
2
|
2072
|
|
POST
|
I almost always use QueryTask, because I want to format the content of the infoWindow specific to the attributes that are available for a particular layer. You'll notice in the identify examples that they generically format that content based on all the fields that are available in a layer and you end up with something that works for all, but isn't very nice looking.
... View more
02-26-2013
10:38 AM
|
0
|
0
|
1204
|
|
POST
|
I'm doing something similar and started with a selection prepopulated with just the option 'Pick a county". I only have data for a few counties, so I have a layer that shows the status of whether or not there is data for that particular county. There is an attribute called status. These were the only options I wanted in my list. <select data-dojo-type="dijit.form.Select" id="mySelect" onchange="findCountyFromList();" title="Select a county to zoom to it on the map.">
<option>Pick a county</option>
</select> I run a querytask against that layer to find out which counties have the status of "Y". I've placed this in my init code so the list gets populated at start up. In my case, I needed the county names to be sorted alphabetically. I made an array of these names too because I have another use for them.
var queryTask = new esri.tasks.QueryTask("http://servername/arcgis/rest/services/countyStatus/MapServer/0")
var query = new esri.tasks.Query();
query.outFields = ["COUNTYNAME"];
query.where = "STATUS = 'Y'";
query.returnGeometry = false;
dojo.connect(queryTask, "onComplete", function (featureSet){
var select = dijit.byId("mySelect");
dojo.forEach(featureSet.features, function (feature){
var countyName = feature.attributes.COUNTYNAME;
countyList.push(countyName);
});
countyList.sort();
for (var i = 0; i < countyList.length; i++) {
var countyName = countyList;
// console.log(countyName);
select.addOption({
label: countyName,
value: countyName
});
}
queryTask.execute(query); Once I had my list populated, I was able to use some of the other examples that showed now to do a query based on selection from the list. I've not done anything with creating lists as the user types in a box and not seen too many examples of it either.
... View more
02-25-2013
10:10 AM
|
0
|
0
|
394
|
|
POST
|
In the FLEX API, there is something called a composite symbol. This let me layer two different lines or point symbols, which acted as one. I used this extensively as a way to highlight a feature the user had selected, because I could take the existing symbol, but add a yellow highlight by adding a symbol larger than the current symbol. I don't see that anything at all like this is available in the Javascript API. Am I missing this, or is this something that could possibly be added in the future?
... View more
01-17-2013
06:24 AM
|
0
|
0
|
526
|
|
POST
|
I had tried the enhanced grid for another project and I found it tricker to use than the original datagrid. Like you said it is dojox, although I've used others that worked just fine. For this particular project, I was trying to avoid having to make a bunch of changes just to get this last piece of functionality done. Still good suggestions though for the next time!
... View more
01-07-2013
06:36 AM
|
0
|
0
|
2123
|
|
POST
|
I switched it to text-align instead of just align. This is what worked for me. It assumes that your store variable is global. Mine was set when I created and populated the grid in an earlier function. function printIt() { var win = window.open(); self.focus(); win.document.open(); win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>'); win.document.write('body, td { font-family: Verdana; font-size: 12pt;}'); win.document.write(' th { font-weight: bold; text-align:left;}'); win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>'); win.document.write('<table style=\"width:100%\"><th >Facility</th><th >Address</th><th >City</th><th >Phone</th>'); store.fetch({ onComplete: function (items) { dojo.forEach(items, function (item, index) { win.document.write('<tr><td>' + item.FACILITY + '</td><td>' + item.ADDRESS + '</td><td>' + item.CITY + '</td><td>' + item.PHONE + '</td></tr>'); }); } }); win.document.write('</table>'); win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>'); win.document.close(); win.print(); win.close(); }
... View more
01-07-2013
06:16 AM
|
0
|
0
|
2123
|
|
POST
|
All the examples I've seen for showing a loading have a listener set to the map.
dojo.connect(map,"onUpdateStart",showLoading);
dojo.connect(map,"onUpdateEnd",hideLoading);
My project doesn't load the map at the beginning. Instead, the users runs a query or find which generates a list. Only after the list is displayed do they have the option to see the results of their query/find on a map. It takes a moment for the page to open. If the user selects a county or enters an address before it's fully initialized, they get errors. I feel like too much is still loading at the beginning. I tried commenting out the dojo.addOnLoad(init) that most examples have because I know I don't need the map until the user makes some sort of selection. Still it seems to be accessing the baselayers right when I start. I can add the loading image at start up by putting it in my top borderContainer, but I need to have something else besides the map's onUpdateEnd event to trigger the hideLoading function. http://wwwgis.dhss.mo.gov/Website/VCFprovider/provider.html
... View more
01-07-2013
05:40 AM
|
0
|
1
|
1596
|
|
POST
|
It was getting stuck on the myGrid.store.fetch, but I remembered I had set a variable 'store' in another function, which worked just fine.
function printIt()
{
var win = window.open();
self.focus();
win.document.open();
win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>');
win.document.write('body, td { font-family: Verdana; font-size: 12pt;}');
win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>');
win.document.write('<table style=\"width:100%\"><th style=\"font-weight:bold\">Facility</th><th style=\"font-weight:bold\">Address</th><th style=\"font-weight:bold\">City</th><th style=\"font-weight:bold\">Phone</th>');
store.fetch({
onComplete: function (items) {
dojo.forEach(items, function (item, index) {
win.document.write('<tr><td>' + item.FACILITY + '</td><td>' + item.ADDRESS + '</td><td>' + item.CITY + '</td><td>' + item.PHONE + '</td></tr>');
});
}
});
win.document.write('</table>');
win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>');
win.document.close();
win.print();
win.close();
}
The only thing that doesn't look quite right in this is the column headers look to be centered over the columns, leaving them looking offset to the right. I'm hoping there is an alignment I can set somewhere. I'm still trying to track that down.
... View more
01-07-2013
05:02 AM
|
0
|
0
|
2123
|
| 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
|