|
POST
|
Chris, Yes sir! You can directly look at the JavaScript at: http://www.yakimawa.gov/apps/yak-back/includes/js/map.js This was written in 2012, before we had fully embraced AMD. It is still being used today, but ready for a rewrite. The complete app is at: Yak Back Please let me know if I can be of any further assistance! Regards, Tom
... View more
07-15-2015
09:25 AM
|
2
|
12
|
3056
|
|
POST
|
Chris, We did something similar on our citizen engagement app. They would enter an address and we would check it against our locator. Further, we would check it against our city boundary to see if the point fell within our city limits. If not we would not add it to the list of available choices. Here is some code that shows how we did this: // Address Locator for finding stops near an address
function searchAddresses() {
var address = {"SingleLine": $("#addrSearch").val()};
if (address.SingleLine != "") {
var params = {address: address, outFields:["*"]};
geocoder.addressToLocations(params, buildAddressList, errAddress);
} else {
$('#addressList li').remove();
selectedAddress = '';
}
}
function buildAddressList(geocodeResults) {
gcr = geocodeResults;
$('#addressList li').remove();
var titleLI = $('<li data-role="list-divider" data-inset="true" />');
titleLI.append("<h3 id='addListHeader'> Address List</h3>");
$('#addressList').append(titleLI);
var addCount = 0;
$.each(gcr, function(i, a) {
// we only want to display addresses that are in Yakima.
var pt = esri.geometry.geographicToWebMercator(new esri.geometry.Point(a.location.x, a.location.y));
// Check to see if the point is in the Yakima City Limits
var isYakima = yakimaCL.graphics[0].geometry.contains(pt);
if (isYakima == true) {
var li = $("<li />");
if (a.attributes.Addr_type == "Address") {
var content = "<a href='#' onClick='useAddress(" + i + ")'><h3>" + a.address + "</h3><p>" + a.attributes.User_fld + "</p><span class='ui-li-count'>" + a.score + "</span></a>";
} else {
var addr = a.address.split(",");
var content = "<a href='#' onClick='useAddress(" + i + ")'>" + addr[0] + "<span class='ui-li-count'>" + a.score + "</span></a>";
}
li.append(content);
//add the list item to the feature type list
$('#addressList').append(li);
addCount += 1;
}
});
//refresh the featurelist so the jquery mobile style is applied
$('#addressList').listview('refresh');
$("#addListHeader").html(" " + addCount + " found in Yakima");
} I hope this is helpful. Regards, Tom
... View more
07-15-2015
09:12 AM
|
2
|
14
|
3056
|
|
POST
|
Ia, To get the stop name to appear you must assign it as you add the stop. It would be ideal if when you added a stop that it would find a "Name" field and use it for your stop location name. To solve this problem, I created an stop object to use for each feature and explicitly added a stop name. // add the selected stops
arrayUtil.forEach(selectedGraphicsLayer.graphics, function(feature, i) {
var a = feature.attributes;
// make a stop so we have name and XY
var stop = {
name: a.Name,
feature: {
geometry: {
x: feature.geometry.x,
y: feature.geometry.y
},
attributes: a
}
};
directions.addStop(stop);
});
directions.getDirections(); This example was from a craft beverage tour where the app user can select which locations they would like to visit and create driving directions. You can view this example at: Craft Beverage Tour Please view source to see how I manage the stops for this app. I hope this helps! Regards, Tom
... View more
07-13-2015
08:21 AM
|
1
|
2
|
1690
|
|
POST
|
Adam, If you are building an application using the JS API, you will need to reference the IdentityManager. It will present a login dialog when attempting to use a secured service. IdentityManager | API Reference | ArcGIS API for JavaScript Regards, Tom
... View more
07-10-2015
11:04 AM
|
0
|
1
|
1318
|
|
POST
|
Ia, Some things to check. Did your query return a result? If no results are returned, then no stops will be created. Or there may be too many stops for a route to be solved. Are the stops using the same spatial reference as the route network used? If they are not, the stops won't be close enough to the route's street network to be considered a stop point. Regards, Tom
... View more
07-10-2015
10:57 AM
|
1
|
4
|
1690
|
|
POST
|
Shaning, I am betting it is because of the initial extent. I kept getting an error as it was not defined until the dojo requires had been read. You might move it inside your init function. Something like this: var initialExtent;
function init() {
initialExtent = new esri.geometry.Extent(-8614312, 4687051, -8536040, 4730894, new esri.SpatialReference({ wkid:102100 }));
map = new esri.Map("map", {basemap: "topo", extent: initialExtent, zoom: 9 }); Regards, Tom
... View more
06-30-2015
11:56 AM
|
0
|
5
|
5133
|
|
POST
|
Shaning, Thanks for providing code. It appears that it is embedded in a .Net wrapper which will limit my ability to help you. I am not sure that your initial extent is actually getting set properly. Is this a page that I can view or is it internal? Can you provide the URL? Also you are using 3.8 CSS with 3.13 JS. I don't think this is the solution to this particular problem, but you might consider keeping them consistent. Regards, Tom
... View more
06-30-2015
11:13 AM
|
0
|
7
|
5133
|
|
POST
|
Almaz, For your expression you could use: [Area_Acres] & vbcrlf & "Acres" Using the vbscript option. Regards, Tom
... View more
06-30-2015
08:30 AM
|
2
|
0
|
7812
|
|
POST
|
a wei, Do the coordinate systems have a different datum? If so, it might be necessary to include a transform method in your parameters. Regards, Tom
... View more
06-30-2015
08:20 AM
|
0
|
0
|
1919
|
|
POST
|
Shaning, Could you provide more of your code to give this some context? It might shed some light on debugging the problem. Regards, Tom
... View more
06-30-2015
08:15 AM
|
1
|
10
|
5134
|
|
POST
|
Siva, Glad you found a workaround that will work for you. Regards, tom
... View more
06-30-2015
08:09 AM
|
0
|
0
|
2624
|
|
POST
|
You are welcome! I hope it makes the magic happen. Regards, Tom
... View more
06-29-2015
03:42 PM
|
0
|
0
|
1625
|
|
POST
|
John, If you are using 3.13 of the API, there appears to be a bug in labeling polylines. Here is a thread that speaks to that point. LabelLayer (API version 3.13) is not working with Line FeatureLayer For a workaround you can go back to 3.12 of the API which does label lines correctly. If you have some other 3.13 specific code, that may not be an option though. Regards, Tom
... View more
06-29-2015
03:38 PM
|
2
|
2
|
1625
|
|
POST
|
Siva, You are correct. It works at 3.12 and does not at 3.13. I dug into the LabelLayer.js to see what might be going on and the layer.options.labelRotation is set to true at 3.12 and is undefined at 3.13. I tried to hack an option setting for labelRotation and it is ignored. labels[options] = {labelRotation: true}; I have also scoured the documentation and haven't found a proper way to set a labelRotation option. It appears to be a bug or an undocumented property. Maybe Kelly Hutchins would have a answer? Regards, Tom
... View more
06-26-2015
09:51 AM
|
2
|
3
|
2624
|
|
POST
|
Siva, Can you please post some of your code for this? The error implies a rotation error, but viewing your code would give me some context to better understand what the problem might be. Thanks! Regards, Tom
... View more
06-24-2015
09:45 AM
|
0
|
5
|
2624
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-24-2023 10:45 AM | |
| 1 | 05-19-2023 08:13 AM | |
| 1 | 02-22-2023 09:12 AM | |
| 1 | 05-15-2015 03:11 PM | |
| 1 | 02-10-2015 11:52 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-26-2024
04:50 PM
|