|
POST
|
JPEG doesn't support transparency, which is why you are seeing the white. If you switch to png32 this might help. Your solution of two map services working together is novel and i think has potential. I dont know how irregular you land is, but clipping to it still generates a square tile. You might instead try clipping at the tile boundary (since it is fixed) and putting the transition from land to water on a tile seam, if possible, this will of course depend on scale and whether or not it is worth that much effort.
... View more
05-14-2012
06:02 AM
|
0
|
0
|
1924
|
|
POST
|
dojo.connect(saveButton, "onClick", function () {
updateFeature.getLayer().applyEdits(null, [updateFeature], null, function(results){$('#alert').jGrowl("Road obstruction saved");
map.infoWindow.hide();
}, function (error) {
$('#alert').jGrowl("Could not save obstruction due to " + error.message, {
header : 'Error'
});
});
map.infoWindow.hide();
});
I think you have a syntax error in here that IE cares about but mozilla can get past.
... View more
05-14-2012
05:48 AM
|
0
|
0
|
1071
|
|
POST
|
You are doing everything correctly. If you can log map.spatialReference your scope is correct its amazing that map.graphics.clear() works but map.graphics.remove(g), when g is a valid graphic, does not. Thank you for the help thus far. Im going to be bald by the end of the day if I keep up all this hairpulling... map.graphics.clear(); works, (and worked previously) but map.graphics.remove(g); does nothing. as a test, within the IF i tried console.log(map.spatialReference), and it reported back to the console just fine. what version of the API are you on? do you get any error in firebug?
function onClicker(evt){
dojo.forEach(map.graphics.graphics, function(g) {
if ( g && g.id === "highlight" ) {
//remove graphic with specific id
map.graphics.remove(g);
console.log(map.spatialReference)
}
}, this);
identifyTaskReps = new esri.tasks.IdentifyTask("http://172.26.197.91/ArcGIS/rest/services/IndivTerritoriesOnly/SalesReps_simple/MapServer/");
identifyParamsReps = new esri.tasks.IdentifyParameters();
identifyParamsReps.tolerance = 5;
identifyParamsReps.returnGeometry = true;
identifyParamsReps.layerIds = [0];
identifyParamsReps.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParamsReps.width = map.width;
identifyParamsReps.height = map.height;
identifyParamsReps.geometry = evt.mapPoint;
identifyParamsReps.mapExtent = map.extent;
var deferred = identifyTaskReps.execute(identifyParamsReps);
deferred.addCallback(function(response){
if (response.length > 0) {
// console.log("response length ", response.length)
// response is an array of identify result objects
// Let's return an array of features.
return dojo.map(response, function(result){
var selFeature = result.feature;
var selFeatureSymbol = new esri.symbol.SimpleMarkerSymbol();
selFeatureSymbol.style = esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE;
selFeatureSymbol.setSize(10);
selFeatureSymbol.setColor(new dojo.Color([0,255,0, 1]));
selFeature.setSymbol(selFeatureSymbol);
selFeature.attributes.layerName = result.layerName;
var infoTemplate = new esri.InfoTemplate();
selFeature.setInfoTemplate(infoTemplate);
var name = selFeature.attributes.NAME;
var rep_no = selFeature.attributes.rep_no;
var address = selFeature.attributes.ADDR1;
var city = selFeature.attributes.CITY;
var state = selFeature.attributes.ST_ABBR;
var zipcode = selFeature.attributes.ZIP_CODE;
var leader = selFeature.attributes.Ldr_type;
var prez = selFeature.attributes.PCText;
var content = "<b>Rep # : </b>" + rep_no + "<br><b>Address : </b>" + address + "<br><b>City : </b>" + city + "<br><b>State : </b>" + state + "<br><b>Zip : </b>" + zipcode + "<br><b> Leader : </b>" + leader + "<br><b>Presidents Club :</b>" + prez;
var title = "<b>Name : </b>" + name;
map.infoWindow.setTitle(title);
map.infoWindow.setContent(content);
map.graphics.add(selFeature);
map.infoWindow.show(selFeature.geometry);
highlightGraphic = new esri.Graphic(selFeature, selFeatureSymbol);
highlightGraphic.id = "highlight";
highlightGraphic.setSymbol(selFeatureSymbol);
map.graphics.add(highlightGraphic);
});
};
});
};
... View more
05-11-2012
08:35 AM
|
1
|
0
|
1797
|
|
POST
|
Okay i think i might have over generalized, and i am sorry for the frustration dojo.forEach(map.graphics.graphics, function(g) {
console.log(g.id)
if ( g && g.id === "highlight" ) {
//remove graphic with specific id
map.graphics.remove(g); // <-- this doesn't remove anything.
}
}); the console see's g because you are passing it into the function, however it no longers knows what "map" is because the scope has changed so dojo.forEach(map.graphics.graphics, function(g) {
console.log(g.id)
if ( g && g.id === "highlight" ) {
//remove graphic with specific id
map.graphics.remove(g); // <-- this doesn't remove anything.
}
}, this); will keep the function in "this" scope which is aware of the "map" variable. alternatively (same, just different syntax) dojo.forEach(map.graphics.graphics, dojo.hitch(this, function(g) {
console.log(g.id)
if ( g && g.id === "highlight" ) {
//remove graphic with specific id
map.graphics.remove(g); // <-- this doesn't remove anything.
}
})); once you are in your "if", make sure you can alert map. if not, you still have scope issues
... View more
05-11-2012
07:18 AM
|
1
|
0
|
1806
|
|
POST
|
all the points should have a graphic. if you click on a point, a new "highlight point" should appear. if you click on a second point, a new highlight point needs to appear, and the the first one needs to disappear. thanks. That makes more sense. First, remove the old graphic before you create the new one. (the forEach loop) Second, remove all the "this"'s. Looking at your code, you dont need them.
... View more
05-10-2012
11:22 AM
|
0
|
0
|
1806
|
|
POST
|
help help? 🙂 please? looking at your code (the last 3 blocks) you create the graphic, remove the graphic, then add the graphic. I dont think that is the logic you want is you onclick supposed to add a graphic or remove one?
... View more
05-10-2012
11:06 AM
|
0
|
0
|
1806
|
|
POST
|
Well not at all an accurate solution, you might be able to do some TRIAGE/damage mitigation. In your showLoading function, you could set a 1000ms timer or so and have it publish an onUpdateEnd event, which would at least trick your app into thinking it was done drawing and hide the icon, even if its not done. I know this does not fix the error of never properly receiving the onUpdateEnd event, but if you application relies on receiving it to continue at least this way you are stuck refreshing the browser. Better to have a busted basemap and be able to proceed than eject.
... View more
05-09-2012
10:07 AM
|
0
|
0
|
3004
|
|
POST
|
Thanks for the input. Chris, the first link you posted is the application that I referenced to add the Google basemap. I didn't mention it in the first post is that if I'm using a esri basemap the zoom function works fine and I used the wkid = 102100. I referenced this app for the zoom functionality. http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm If there is something that I missed let me know. Thanks again Chris Are you using the Google Maps for Javascript API? or the straight javascript API. IF you are using straight javascript, the links above are how you kinda "hack" google in as a basemap as it is not technically supported. If you are using the ArcGIS Extension for the Google Maps API then the zoom functionality is in Google's api.
... View more
05-07-2012
11:00 AM
|
0
|
0
|
2727
|
|
POST
|
We use this in our map. use wkid 102100 Web Mercator Auxiliary Sphere
... View more
05-07-2012
09:46 AM
|
0
|
0
|
2727
|
|
POST
|
Do you have an Editor dijit associated with this Feature Layer ? I ran into alot troubles with removing and readding a Feature Layer when it was a child of a dijit. I found that after removing the layer, if i destroyed dijit as well, all my problems went away so
editorWidget = new esri.dijit.editing.Editor(params,'editorDiv');
//on remove
map.removeLayer(layer);
editorWidget.destroy();
... View more
05-07-2012
08:25 AM
|
0
|
0
|
897
|
|
POST
|
dojo.byId("address").value is saying look for a item in your HTML code with id="address" (this is likely an input text box) and get its value. Its in function locate, so that function is likely called with an onClick event to a search button. I can get the address locator working in my app using the ESRI locator but once I flip the locator over to point at my service it doesn't work. I'm having trouble with figuring out what the parameters are and if they should be changed. I tried to look at the example rest endpoint of ESRI's locator but it seems like there are address requested and return fields not present or Don't match up. I was hoping to highlight the inputs in red and maybe someone can tell me what they point to so I can figure out if I need to change that input or not:
function locate() {
map.graphics.clear();
// The singleLine I believe is coming from the find address candidate from the REST SingleLine (Type: esriFieldTypeString, Alias: Single Line Input, Required: false ) but where is address coming from -- also for the singleline should I use single line or my alias because my alias is different and ESRI's is not
var address = {"SingleLinee":dojo.byId("address").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 infoTemplate = new esri.InfoTemplate("Location", "Address: ${address}<br />Score: ${score}<br />Source locator: ${locatorName}");
symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE);
symbol.setColor(new dojo.Color([153,0,51,0.75]));
var geom;
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, locatorName:candidate.attributes.Loc_name };
geom = candidate.location;
var graphic = new esri.Graphic(geom, symbol, attributes, infoTemplate);
//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;
var font = new esri.symbol.Font("16pt",esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL,esri.symbol.Font.WEIGHT_BOLD,"Helvetica");
var textSymbol = new esri.symbol.TextSymbol(displayText,font,new dojo.Color("#666633"));
textSymbol.setOffset(0,8);
map.graphics.add(new esri.Graphic(geom, textSymbol));
return false; //break out of loop after one candidate with score greater than 80 is found.
}
});
if(geom !== undefined){
map.centerAndZoom(geom,12);
}
}
Also I'm trying to check my server and machine communication with fiddle and I can see I make the request and the address candidates are sent back from the server but then I'm not sure where my code is failing. I'm new to JS and I'm use to IDEs that allow for debugging...how should I go about and debug with JS Thanks Nathalie
... View more
05-02-2012
12:13 PM
|
0
|
0
|
1447
|
|
POST
|
Thanks Jeff...Yes i totally agree with you. I wish map click could return something more than mappoint like clicked graphic/layer etc...or map object has event like getAllvisible layers instead of getting all layers.. Thanks again I agree, unfortunately without querying the map (i.e. looping through the layers) there is no way to know which layer you clicked. A map.visibleLayerIds would be a very useful property, however. If you dont mind marking my response as an answer, i would appreciate it 🙂
... View more
05-02-2012
08:19 AM
|
0
|
0
|
1568
|
|
POST
|
Yes but you have to specify the URL and then choose layers...is it a way that you click on map, get all the visible layers and then use all those layers to do the identify? This way i can write a function where i can pass all the visible layers at map click and then iterate through each layer and get results... thanks Unfortunately you have to do it programmatically. There are advantages and disadvantages to this. Disadvantage - you have to write it Advantage - you can identify non -visible layers. Basically you have to take an evt/mappoint and loop through all the map layers and do an identify on each. loosely:
var ids = map.layerIds;
dojo.forEach(ids, function(id) {
var layer = this.map.getLayer(id);
if (layer.visible==true){
//do identify on layer.url
}
}
... View more
05-02-2012
07:59 AM
|
0
|
0
|
1568
|
|
POST
|
Is there a generic identify tool, which finds out which layer was clicked and then return all the attributes...by getting layers and layerIDs just by clicking on the map.... I am going to work on this but i thought should check if anybody already did something similar... There is no identify dijit. There is an identify task, however, that you can pass an onclick and will let you choose ALL, TOP, or VISIBILE to identify.
... View more
05-02-2012
07:38 AM
|
0
|
0
|
1568
|
|
POST
|
I started with a new feature dataset and a new feature class, with a edit version (this part I missed earlier). Everything seems to work fine now. Thanks awesome. Glad I could help. the 10.1 beta indicates you will be able to select your version. Looking forward to this, but glad you got it working for now.
... View more
05-02-2012
05:21 AM
|
0
|
0
|
3475
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-22-2014 08:35 AM | |
| 1 | 05-02-2012 04:56 AM | |
| 1 | 10-29-2021 07:40 AM | |
| 1 | 10-28-2021 05:26 AM | |
| 1 | 07-17-2012 08:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
03-01-2022
02:00 PM
|