|
POST
|
One thing I see is that the service isn't cached, so maybe that's a reason you can't use it as a basemap? It's also published as an ImageServer as opposed to a MapServer. For comparison, here's the REST service endpoint for the ESRI Imagery basemap.
... View more
03-06-2017
03:51 PM
|
0
|
0
|
1820
|
|
POST
|
So it was moved. Thanks for linking the new location. Unfortunate that you now have to an account just to access it. This used to be located on the main ESRI product download page. Typing "javascript api download" in the ESRI.com search bar doesn't link you to this location on the developers website, either.
... View more
03-06-2017
02:26 PM
|
1
|
0
|
4277
|
|
POST
|
The documentation used to be available as part of a downloadable SDK ZIP file for previous versions of the Javascript API. This also included samples which was terribly useful because ESRI has a habit of removing useful samples as the API has evolved. Anyways, I now see from my browser bookmark that the previous API versions is no longer found on the ESRI downloads page. Maybe it got shuffled around but perhaps pinging an ESRI JS developer such as odoe or khutchins-esristaff might have a better answer. The Dev Conference is just about to start so they might be too busy with that at the moment.
... View more
03-06-2017
02:05 PM
|
0
|
2
|
4277
|
|
POST
|
If you also have speed limit information, perhaps you can look for road segments where the speed limit changes "significantly" on either side of a given road segment. If you have a road sign inventory, you could also look for signs that indicate hairpins or sharp turns as well.
... View more
03-06-2017
10:04 AM
|
1
|
1
|
3725
|
|
POST
|
I found a function online for testing empty variables and I've been using that: function empty(data) {
//Taken from:
//https://www.sitepoint.com/testing-for-empty-values/
if(typeof(data) == 'number' || typeof(data) == 'boolean')
{
return false;
}
if(typeof(data) == 'undefined' || data === null)
{
return true;
}
if(data.indexOf(' ') >= 0 && data.length == 1 )
{
return true;
}
if(typeof(data.length) != 'undefined')
{
return data.length == 0;
}
var count = 0;
for(var i in data)
{
if(data.hasOwnProperty(i))
{
count ++;
}
}
return count == 0;
} And I use it like this: thePrjName = (empty(attrib.prjName)) ? "Unspecified" : attrib.prjName;
If you're not familiar with that, it's an if..then conditional statement as one line of code: conditional ? true : false Steve
... View more
02-16-2017
08:09 AM
|
1
|
0
|
1240
|
|
POST
|
Here's more of an explanation for what Jeff was saying. Basically, you'll need to code a content function for your infoWindow and build an <a> link inside of it using the format Jeff provided.
... View more
02-14-2017
08:17 AM
|
0
|
0
|
1852
|
|
POST
|
It looks like this CAN be changed. Refer to this page in the documentation. Under the identity object, change the message for the info property. The default text for the info property is "Please sign in to access the item on ${server} ${resource}"
... View more
02-13-2017
08:43 AM
|
1
|
1
|
3251
|
|
POST
|
So, I've wanted to capture this information for a current project and my searches led me to this thread, among others. Unfortunately for me, I don't have PHP or ASP options available to me so that leads me to seeking out a client side solution. Normally, that doesn't exist but I *MAY* have found a surrogate solution that I wanted to share. This is still unproven but the pieces are there. Anyways, you might be able to extract user information using Sharepoint, provided your organization uses it. I found many helpful sites as I descended the rabbit hole of Sharepoint web searches but this site which discusses the Javascript Object Model for Sharepoint 2010 was helpful for what I will share. My testing has ground to a halt because my organization uses Sharepoint 2010 and the following code solution will only work with Sharepoint 2013 or above (presumably). Anyways, to get started, you need to add five JS script references into your project (my source for this was here😞 <!-- the following 5 js files are required to use CSOM -->
<script src="/_layouts/1033/init.js"></script>
<script src="/_layouts/MicrosoftAjax.js"></script>
<script src="/_layouts/sp.core.js"></script>
<script src="/_layouts/sp.runtime.js"></script>
<script src="/_layouts/sp.js"></script> The paths must be adjusted to your Sharepoint set up. Our organization's Sharepoint base URL is "https://team/depts/....." so the previous code was modified to the following: <script type="text/javascript" src="https://team/_layouts/1033/init.js" ></script>
<script type="text/javascript" src="https://team/_layouts/MicrosoftAjax.js"></script>
<script type="text/javascript" src="https://team/_layouts/sp.core.js" ></script>
<script type="text/javascript" src="https://team/_layouts/sp.runtime.js" ></script>
<script type="text/javascript" src="https://team/_layouts/sp.js" ></script> BTW, I think the order of the Sharepoint JS script references DOES matter. I kept getting console errors until I specified them in the order shown above. With that out of the way, it's time for the JS code. There's not much code to it, really- var targetWeb;
function spUserName() {
var theSpCc = new SP.ClientContext('<path to sharepoint page>'); // e.g. https://team/depts/department
targetWeb = theSpCc.get_web();
theSpCc.load(targetWeb);
theSpCc.executeQueryAsync(Function.createDelegate(this,this.onQuerySucceeded),Function.createDelegate(this,this.onQueryFailed));
}
function onQueryFailed(sender, args) {
alert('Request failed. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());
}
function onQuerySucceeded() {
// On success, use get_ property assessor methods to return the value of the Title, ID, Language, uiVersion, Description, and Created properties of the SP.Web object.
var theUser = targetWeb.get_currentUser();
var theUsername = theUser.get_loginName();
var message = "Web retrieved:";
message += "\n Title: " + targetWeb.get_title();
message += "\n ID: " + targetWeb.get_id();
message += "\n Language: " + targetWeb.get_language();
message += "\n UI Version: " + targetWeb.get_uiVersion();
message += "\n Description: " + targetWeb.get_description();
message += "\n Created: " + targetWeb.get_created();
message += "\n\n And you are: " + theUsername ;
alert(message);
} I haven't been able to fully test this because Sharepoint 2010 (our current version) only supports relative path names when creating a ClientContext instance. My web app won't be hosted on the Sharepoint server so this code won't work. In Sharepoint 2013, however, full paths are accepted so I feel that this *should* work. Lastly, there is another Sharepoint related option but I still have a sticking point to implementing it. You can use AJAX on a particular Sharepoint List URL to retrieve a user's information (provided you know their user ID): Sharepoint 2010: https://<path to sharepoint page>/_vti_bin/ListData.svc/UserInformationList(theUserID) Sharepoint 2013: http://<path to sharepoint page>/_api/Web/GetUserById(theUserID) Of course, the problem here is that you need to know, or figure out a way to reverse engineer, a user's user ID within Sharepoint. This was my original tact but I couldn't quite figure out how to extract his programatically. If you're on a Sharepoint page, simply type "_spUserId" in the console and you'll get your ID. Anyways, I wanted to throw this out there for the record. I know it won't help everyone but maybe it helps a few! If anyone does get it to work, I'd love to hear about it! Steve
... View more
02-10-2017
11:03 AM
|
3
|
1
|
6979
|
|
POST
|
Here's a merge of your code plus my idea: function gpResultAvailable(results, messages){
domAttr.set(dom.byId("statsLink"),"innerHTML", "Three Week Chart");
//clear any existing features displayed in the popup
window.map.infoWindow.clearFeatures();
var chart = "Right Click to Download Chart"
var chartURL = "http://<ourserver>/Test_Charts/Three_Week_Chart_for_" + locationStr + ".png"
var chartLink = chart.link("http://<ourserver>/Test_Charts/Three_Week_Chart_for_" + locationStr + ".png")
var chartFrame = "<iframe src='http://<ourserver>/Test_Charts/Three_Week_Chart_for_" + locationStr + ".png' height=100% width=100%></iframe>";
//display the query results
var content = "";
if(results == 0){
var chartPath = "http://<ourserver>/Test_Charts/Three_Week_Chart_for_" + locationStr + ".png";
content = '<IMG SRC="' + chartPath + '" width="320" height="480"/><br/><br/>';
content = content + '<a target="_blank" href="' + chartPath + '">Open Fullsize in new window</a><br/>';
}else{
content = " Unable To Generate Chart";
}
window.map.infoWindow.setContent(content);
window.map.infoWindow.resize(640, 960);
}
... View more
02-08-2017
02:00 PM
|
1
|
1
|
2567
|
|
POST
|
At this point, I'm totally lost at what code you're using and how you're doing it, but, based on your last response.... I would just now use a custom function to set the infoWindow content and display the image using the HTML IMG tag with a size parameter: var theTemplate = new InfoTemplate();
theTemplate.setContent(customPopup);
theTemplate.setTitle('Output Chart');
function customPopup(graphic) {
var theImgPath = <whatever>;
//Substitute actual pixel dimensions for x & y in the next line
content = '<IMG SRC="' + theImgPath + '" width="x" height="y"/><br/><br/>';
content = content + '<a target="_blank" href="' + theImgPath + '">Open Fullsize in new window</a><br/>';
return content;
}
... View more
02-08-2017
12:33 PM
|
0
|
3
|
2567
|
|
POST
|
Have you considered something like using a JQuery lightbox like Colorbox or something similar? They essentially work by displaying a hidden HTML div as a modal dialog. You could have your div with an IMG element and then update the source for the IMG & then display it using the JQuery lightbox..
... View more
02-08-2017
10:02 AM
|
0
|
0
|
2567
|
|
POST
|
Lloyd, FWIW, I tried my code in IE, Chrome, and Firefox and they all opened as a new window instead of tab. Firefox: 51.0.1 Chrome: 55.0.2883.87 m Internet Explorer: 11 (11.0.9600.18124)
... View more
02-07-2017
11:24 AM
|
0
|
0
|
2528
|
|
POST
|
Yeah, I've read that point made by others online but, for whatever reason, my code will still open the window as a new window. I've tested this in my install of Firefox where the option to open new windows in a tab instead is enabled. It will still open as a new window rather than a tab. Strange.
... View more
02-07-2017
10:43 AM
|
0
|
3
|
2528
|
|
POST
|
Hmm. I have an app which opens a report in a new window and it always opens as a new window, not a tab. Not much different codewise from what Lloyd is attempting: var center_left = (screen.width / 2) - (1100 / 2);
var center_top = (screen.height / 2) - (600 / 2);
newWindow = window.open('demographicReport.html','mywindow','width=1100,height=600,menubar=yes,scrollbars=yes,left=' + center_left + ',top=' + center_top);
... View more
02-07-2017
10:17 AM
|
0
|
5
|
2634
|
|
POST
|
I think you were close with your first attempt. Try this: window.open(chartResult, '_blank', 'width=600,height=600'); I think the key is adding the '_blank' option.
... View more
02-07-2017
09:48 AM
|
0
|
2
|
2634
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week ago | |
| 1 | a week ago | |
| 1 | 2 weeks ago | |
| 2 | 2 weeks ago | |
| 1 | 3 weeks ago |