|
POST
|
Is it possible to modify the actual code of a site hosted on ArcGIS.com if you have a subscription? For example, is it possible to download a template site like Basic Viewer, change it (i.e. to use some extra widgets, like the AGSJS TOC widget, or change it to use our geocoder service) and then re-upload it to ArcGIS.com, if our organization has a subscription with our own URL? I saw the Web Mapping Application component, I was hoping this would allow us to modify the source code and still host it on ArcGIS.com Online, but it appears you can only turn on or off the various widgets in the Viewer templates. This is very nice. However, we'd also love to be able to modify some things. In fact, the ArcGIS.com "viewer" is great, if only we could customize it to use our own Gecoder service. I see in the Settings it appears we can change it to use a custom Print service in Utilities. It would be nice to do the same and point to our Geocoder. I called Support and they said that is a common question but it is not supported at this time. The other reason we'd like to be able to modify templates hosted at ArcGIS.com is the lack of a Table of Contents in Basic Viewer. The standard ArcGIS.com "viewer" is great but can not be downloaded unfortunately. It has a nice hierarchical Table of Contents and built in legend. That is exactly what users in the Javascript forums request often. But it can not be downloaded... unless we buy something called "ESRI Portal"? None of the templates have this TOC functionality. That is a key reason why I would like to be able to modify the Basic Viewer.
... View more
03-13-2013
11:28 AM
|
0
|
0
|
1902
|
|
POST
|
Hi all, I think I just worked on something similar. I used Nianwei's TOC widget, which is awesome. I wanted an "identify' basically like the Identify in ArcMap that just works, and shows us all attribs. for all visible layers. We had a REST endpoint with hundreds of layers, that I'd put into an .msd in ArcMap, rolling them up by grouping them in ArcMap just for use with AGSJS TOC widget. So they display in the TOC great. Then, I used the Identify logic from here, this example identifies ALL layers: http://jsfiddle.net/URpaW/ Now, all you need to do to identify only visible layers (not all as in the sample) is put the following line in, in the IdentifyParams section: identifyParams.layerIds = YOURLAYERNAME.visibleLayers; where YOURLAYERNAME is the variable that you assigned your dynamic layer service to that has all your layers (i.e. the URL to the root REST endpoint, where it ends in mapserver/ , as this is just a variable you assigned your DynamicLayer to ) Now... if anyone can help take this to the finish line.. I would like to have the title of the popup (up in the top of the infoWindow) say what each layer is. In the bottom of each infoWindow I see "layerName" then the name of the layer. Interestingly this isn't an attribute. I guess it's just a built in part of a REST service layer? But I want THAT as my title. So I put this following line in var infoTemplate = new esri.InfoTemplate('${layerName}', "${*}");
I also tried r.layerName. Nothing appears in the title of the infowindow. However the infowindow still comes up at least, with all the attributes. So if someone solves that I think this is the solution it looks like we are looking for, here... Here is the inline code from my javascript file if anyone would like to look or borrow: //// Identify Widget ////
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.25]))}, dojo.create("div"));
dojo.connect(map,'onLoad',function(){
//setup generic identify parameters
identifyParams = new esri.tasks.IdentifyParameters();
identifyParams.tolerance = 5;
identifyParams.returnGeometry = true;
identifyParams.layerIds = KSAVDynamicLayersALL.visibleLayers;
dojo.connect(map,'onClick',doIdentify);
});
dojo.connect(map,'onLayersAddResult', setupIdentify);
function setupIdentify(results){
//loop through operational layers and add identify task for each.
tasks = dojo.map(results,function(result){
return new esri.tasks.IdentifyTask(result.layer.url);
});
}
function doIdentify(evt){
map.infoWindow.hide();
clickPoint = evt.mapPoint;
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent;
identifyParams.width = map.width;
identifyParams.height = map.height;
var deferreds = dojo.map(tasks,function(task){
return task.execute(identifyParams);
});
var dlist = new dojo.DeferredList(deferreds);
dlist.then(handleQueryResults);
}
function handleQueryResults(results){
var features = [];
dojo.forEach(results,function(result){
// for a simplified test let's just display all the attributes in the popup
if(result[1].length > 0){
dojo.forEach(result[1],function(r){
var feature = r.feature;
console.log(feature);
feature.attributes.layerName =r.layerName;
var infoTemplate = new esri.InfoTemplate('${r.layerName}', "${*}");
feature.setInfoTemplate(infoTemplate);
features.push(feature);
///// NOTE the above infoTemplate isn'try working in that "layerName' should be the layer's name. I want a layer //name like "Water Mains" to be in the title of the popup InfoWindow. Not working. i need to maybe make a variable that is //LayersALL.layerName as an array or something
});
}
});
map.infoWindow.setFeatures(features);
map.infoWindow.show(clickPoint);
}
//// ^^^ Identify Widget ////
... View more
03-12-2013
09:31 AM
|
0
|
1
|
1196
|
|
POST
|
I set async to false in dojoConfig and now Measurement works. That was it! So I am thinking there are bugs with Measurement.js, in terms of being Dojo 1.8 compliant. Now I have to get it working with another site I made to deploy with local API. Not sure if it will be the same issue or not. Will post results back here when done.
... View more
03-07-2013
10:22 AM
|
0
|
0
|
2456
|
|
POST
|
update: I followed the dojoConfig syntax from Nianwei Liu's site for Charlotte here http://forums.arcgis.com/threads/75725-BasicViewer-with-TOC He has this same config. Now all the GETs are resolving ok, as seen in Firebug, all "200 OK". It gets both the API and Dojo from ESRI servers as well as finding my two local modules. But the site doesn't load. Some "multiple define" errors with Firebug console and TOC not working... But the showstopper is Measurement.js having this.distance undefined. Between this and Measurment.js not working with the API deployed locally (http://forums.arcgis.com/threads/77948-Measurement-work-with-local-API), I'm starting to suspect there is a bug in Measurement.js, and the way it interacts with other parts of the API or Dojo. When I simply comment out the instatatiation code block, making a new Measurement.js widget... at least the page loads, but the TOC etc. are not there. Still multiple define issue. I followed Nianwei's pattern for loading local modules. Everything looks good. Anyone else seeing this? Or has anyone else successfully created a website with local modules but calling ESRI's CDN, and including a Measurement widget in their site? Aside from Nianwei! Not sure why his site works, but it has the complex ESRI template structure. However, I'm reviewing his site now, looking for enlightenment on this. I'll post back if I solve this. My website is at GitHub: https://github.com/kevinsagis/KSAVesriserver/
... View more
02-26-2013
08:23 AM
|
0
|
0
|
2456
|
|
POST
|
You use define to define a new module. You use require when you are only consuming other modules and not defining your own. Is that perhaps the issue in our code? However it works perfect, third-party modules and all, when I run it all local. It only chokes when attempting to use the ESRI API off the server but these modules local, i.e. it tries to find them on ESRI's server. Does anyone here have an example site with this setup? I'm looking around and will post back here if I find a nice example or solve this.
... View more
02-25-2013
07:26 AM
|
0
|
0
|
2456
|
|
POST
|
I am trying to do this same thing. I want to load the ESRI API 3.3 from ESRI's server. I want to load some Dojo modules locally. (WURadar and AGSJSTOC, both of which are discussed in various threads here). However I can see in Firebug it keeps trying to load WURadar and AGSJS TOC modules: NetworkError: 404 Not Found - http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/agsjs/TOC.js NetworkError: 404 Not Found - http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/modules/WURadarLayer.js However, I thought I followed the Dojo docs on Dojoconfig http://dojotoolkit.org/documentation/tutorials/1.8/dojo_config/ It discusses this exact scenario, using Dojo hosted on a CDN but loading local packages. (in the middle of that page) My Dojoconfig is the following:
dojoConfig = {
has: {
"dojo-firebug": true,
"dojo-debug-messages": true
},
async: true,
waitSeconds: 3,
tlmSiblingOfDojo: false,
baseUrl: 'location.pathname.replace(/\/[^/]+$/, "")',
packages: [{
name: "agsjs",
location: "/js/lib/agsjs/"
}, {
name: "modules",
location: "/js/lib/WURadarLayer/"
}],
};
I also tried using this: location: location.pathname.replace(/\/[^/]+$/, "") + "/js/lib/WURadarLayer/" instead of using the relative location in baseURL, and put a + "/" and ./ up in baseURL at the end, etc. and just a blank "" in baseUrl. Also tried baseUrl as "js" and "js/" etc. And calling dojo.js and init.js directly in inline <script> tags in index.html (it found these but still would look for Measurement.js, etc and other ESRI API and Dojo files locally. Conversely if I point it to the ESRI server in DojoConfig it finds the ESRI and Dojo files but not the local AMD modules, WURadar and AGSJS TOC. And the page doesn't load, either way, due to not finding files. Tried many combinations, to no avail. I understand the concept in the official Dojo docs on Dojoconfig above, it seems pretty straightforward. I presume it's a simple issue related to dojoconfig syntax. Anyone else had this issue and solved it, or know the cause of this issue? Or can someone provide and example of a site with this configuration, with local modules but loading the ESRI API / Dojo from ESRI servers? Here is the following in my index.html <!DOCTYPE html>
<html>
<head>
<!-- --- header stuff .... -->
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css">
<script src="js/my/dojoConfig.js"></script>
<script>var dojoConfig = { parseOnLoad: true };</script>
<script src="//serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script>
<script src="js/my/myMap.js"></script>
</head>
<body class="claro">
<!-- ---- body stuff .... -->
Here is the outline of the myMap.js (the main .js file) require(["esri/map",
"esri/layers/FeatureLayer",
"esri/dijit/Popup",
"esri/tasks/Query",
"esri/dijit/Geocoder",
"esri/dijit/Scalebar",
"esri/dijit/Legend",
"esri/dijit/Print",
"agsjs/TOC",
"modules/WURadarLayer",
"dojo/DeferredList",
"dojo/_base/connect",
"esri/layers/FeatureLayer",
"esri/dijit/Measurement",
"dijit/TitlePane",
"esri/dijit/OverviewMap"
], function (map) {
var initialExtent = esri.geometry.geographicToWebMercator(
new esri.geometry.Extent(-81.20953, 32.12281, -81.17640, 32.14837,
new esri.SpatialReference({ wkid: 3857 })
));
var popup = new esri.dijit.Popup(null, dojo.create("div"));
map = new esri.Map("map", {
slider: false,
wrapAround180: true, //set wraparound to false if the extent is limited.
showAttribution: false,
logo: false, // or, just hide the esri logo and don't ask me no questions :)
infoWindow: popup,
slider: true,
sliderStyle: "small",
autoResize: true,
extent: initialExtent
});
var basemap = new esri.layers.ArcGISTiledMapServiceLayer(getWebData.ESRIWorldTopoMap);
map.addLayer(basemap);
dojo.place(popup.domNode, map.root);
////// lots more stuff, and widgets, including a radar loop layer (WURadar) and Table of Contents (AGSJS TOC)
map.setExtent(initialExtent);
map.resize();
dojo.connect(map, "onLoad", function () {
dojo.connect(dijit.byId("map"), "resize", map, map.resize);
});
})
... View more
02-25-2013
04:15 AM
|
0
|
0
|
2456
|
|
POST
|
We are running a site with the API local. We put Dojo in its own folder (outside the folder with the ESRI API files) for organizational purposes. I am not sure but I think this is causing a problem for the Measurement widget. in Firebug it says "this.distance is undefined" on line 15, Measurement.js. I copied it in from the Measurement sample. So, the titlePane shows up in the upper right of course (using HTML right from ESRI sample) but the dijit never instantatiates. The 3 little icons of the measure tools never show up, only the divider line below where they should be. I'm guessing there an issue with pathing with Measurement.js? I.e. a hardcoded path or something depending on dojo being reached with relative paths ../ or the like? Dojo highlights the fact it is a modular system. So in theory this should work just fine. The rest of our site and widgets work great. Also, we re-pointed to all Dojo and extra packages (i.e. AGSJS TOC, WURadar) with dojoConfig. I have put the code on GitHub. ESRI staff or anyone else seen this, and have any advice or know what is happening here? Thanks! https://github.com/kevinsagis/MeasureWidgetLocalAPI Note, I've stripped the actual ESRI API files due to concerns for licensing/redistributing, but I assure, they're just as they come in the API (minus the Dojo 1.8 which are in the separate folder as is apparent in the GitHub repo)...the esri API files were in js / lib / esri. However, are we allowed to post the API? If so I can re-add them back for convenience...but just put ESRI API files into the empty esri folder here in js/lib/esri and this site will run, just not the Measurement.
... View more
02-18-2013
11:00 AM
|
0
|
1
|
781
|
|
POST
|
Hi Jian, Thank you for the explanation. Just wanted to be sure I understood this. We host the API and site local but we are referencing the ESRI server's Print Task service now. However we are just now spinning up an instance of ArcServer 10.1 on the Amazon cloud... so.. once we do that, we won't need a proxy, right?
... View more
02-15-2013
02:13 PM
|
0
|
0
|
848
|
|
POST
|
Hi Carlotta, There are programs that download entire websites. For example, httrack at www.httrack.com Or of course you can have an intern do it! 😉
... View more
02-15-2013
11:25 AM
|
0
|
0
|
747
|
|
POST
|
Does the printTask dijit need a proxy to work, when creating PDFs and using templates such as in the Print With Templates Sample? http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/widget_print_esri_request I do think it does, based on this thread and others http://forums.arcgis.com/threads/56702-Export-Web-Map-Task-Error-quot-Unable-to-connect-to-map-server...-quot Just wanted to confirm I was on the right track... I copied the Print With Templates sample to my PC and ran it, and the Print button did not appear. However, when I instantatiate a new print dijit in my code, without inserting any of that template code, it prints out a PNG image into a new window just fine, using the ESRI server's print utility at http://utility.arcgisonline.com/ (and with hosting API locally)
var PrintWidget = new esri.dijit.Print({
map: map,
url: getWebData.ArcGISCOMPrintService
}, dojo.byId("PrintDiv"));
PrintWidget.startup();
PrintWidget.show();
I recall seeing in the proxy docs regarding CORS that while javascript doesn't allow things across domains there is an exception for images. Is that perhaps why printing of the map as a PNG works with the ArcGISonline utility, even though we're hosting the 3.3 API locally? I'd like to use the templates to print to PDF and include the legend, scalebar and title text. Thanks for any and all input!
... View more
02-15-2013
05:35 AM
|
0
|
4
|
4513
|
|
POST
|
Does this bug still exist? I added just one of our layers to the Measure dijit sample, and it causes it to not work (the ruler and scalebar to measure distance and area do not show up in the titlePane). I comment them back out and it works again. Our layers are in Georgia State Plane Ft. But shouldn't this tool know how to deal with multiple projections? Also I put the patch.js in as a reference to the sample which uses the 3.3 API and it didn't seem to do anything, still the same. Thanks all. I also called ESRI and I will post back here when I figure this out.
... View more
02-08-2013
12:08 PM
|
0
|
0
|
1288
|
|
POST
|
Marty, I agree, this is a great piece of work, thanks to Nianwei Liu! I also highly recommend to ESRI to include this going forward (at least as an option to enable) in their templates, e.g. Basic Viewer. I'd recommend you give us a link to your site and relevant pieces of code in order to take a look at the issue. Also this may help... Nianwei in fact posted an example of this AGSJS TOC integrated in to ESRI's Basic Viewer, referenced in this thread: http://forums.arcgis.com/threads/75725-BasicViewer-with-TOC Perhaps this site or code will meet your requirements? As he directed, use Firebug to get the relevant scripts. Also, one other tip: I put multiple instances of this AGSJS widget into AccordionPanes and it works great. Just fyi.
... View more
02-08-2013
10:56 AM
|
0
|
0
|
654
|
|
POST
|
Thanks nliu that worked, I perused all scripts. Very nice work, and thank you.
... View more
02-06-2013
06:44 AM
|
0
|
0
|
1889
|
|
POST
|
Never mind your link resource was good enough. Thanks for sharing. Thank you so much nliu. How do we access the /javascript folder for that site to see the javascript source code rel linked to in the index.html? Gave me 403 forbidden. We have already integrated your AGSJSTOC into our site (great work, and thank you). We planned to use feature layers for easier querying and since AGSJS wasn't showing featureLayer symbology, we put AGSJS TOC into an AccordionPane. To group several groups of layers we created several instances of AGSJS, one each in an accordionPane. Works nicely. Then we put a Legend dijit in one AccordionPane, all in an AccordionContainer on the left region. When our site is complete soon I will share this. However, this site above is very, very helpful for people to know about. It looks like it leverages ArcGIS.com webmaps but with your AGSJS TOC... which is awesome. In fact perhaps it would be good to adopt this exact site as the new default version of the ESRI JavaScript Basic Viewer template!
... View more
02-04-2013
03:21 AM
|
0
|
0
|
1889
|
|
POST
|
Very good back and forth discussion on user interface here. Everyone making good points. I agree with Jeff that maximizing screen real estate is important. Also, the use of columns and dividers to separate things on the old site made it easier on my eyes. Search is critical, particularly for someone just starting to learn the API and not exactly where to look to find something but "sort of" remembering, i.e. remembering a key word or phrase. Although Derek you make a good point, the use of links for each page is great! Very helpful. Jeff, regarding web layout trends, that's a great way to put it. Sites are becoming portrait (for mobile and tablet) while desktops continue to widen. It seems we as designers can address this through CSS and HTML 5, e.g. portrait and landscape device orientation detection, detecting the viewport size, etc. I'm working on that now for my Javascript API site. We haven't had an Object Model Diagram (OMD) for the API since 2009. We'll look into publishing one again. Aha, so that's what it's called! I saw what I think this is for Silverlight. It had the API spatially mapped out like a flow chart. That would be nice for new folks like myself. Just an idea. After all... we think spatially! 🙂
... View more
02-03-2013
09:17 AM
|
0
|
0
|
1061
|
| Title | Kudos | Posted |
|---|---|---|
| 23 | 12-16-2014 10:46 AM | |
| 2 | 06-06-2014 06:45 AM | |
| 1 | 12-15-2014 01:07 PM | |
| 1 | 07-14-2014 01:18 PM | |
| 1 | 07-15-2014 05:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|