|
POST
|
Opening the application only takes about 10 seconds. I would say that's a red flag. 10 seconds is an eternity for a web app. I think you should be shooting for 1, 2 seconds top to load your app. I do load all the layers in stages or consecutively, one after another so as not to request to much of the server at once, and this works pretty well. Can you post your code to show how you're doing this? The performance issue that I see is not when the application loads, but after the app is rendered and ready for use...when one of the locally cached functional layers/maps is turned on it pegs out the server and in many cases does not return all of the tiles. I've watched the network utilization in Chrome and FF and when the request is made to GET the cached images the only network traffic that is shown is the GET requests for the tiles, 28 requests for 256x256 tiles. If you put your cached map in one of the simpler samples, do you see the same performance issue?
... View more
07-28-2011
01:09 PM
|
0
|
0
|
1943
|
|
POST
|
Hmm...one problem is that URLs for tiles don't have a file extension, see: http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/2/0/0 They are added via img tags though so you might be able to do this...here's an example of the HTML for a tile in a tiled service(taken from http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer?f=jsapi):
<img id="map_layer0_tile_2_0_1"
class="layerTile" style="left: 450px; top: -126px; width: 256px; height: 256px; visibility: visible; "
src="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/2/0/1"
>
... View more
07-28-2011
09:59 AM
|
0
|
0
|
2828
|
|
POST
|
Why not test it out? Here's a modified version of the Project a Point sample that also uses geographicToWebMercator():
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Project a point</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.4/js/dojo/dijit/themes/claro/claro.css">
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.4" type="text/javascript"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.tasks.geometry");
var map = null;
var gsvc = null;
var pt = null;
function initialize() {
map = new esri.Map("map");
var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer");
map.addLayer(layer);
map.setExtent(new esri.geometry.Extent(-144.13, 7.98, -52.76, 68.89, new esri.SpatialReference({wkid: 4326})));
map.infoWindow.resize(360, 120);
gsvc = new esri.tasks.GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
dojo.connect(map, "onClick", projectToWebMercator);
}
function projectToWebMercator(evt) {
map.graphics.clear();
var point = evt.mapPoint;
var symbol = new esri.symbol.SimpleMarkerSymbol().setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND);
var graphic = new esri.Graphic(point, symbol);
var outSR = new esri.SpatialReference({ wkid: 102113});
// convert client side
var wm = esri.geometry.geographicToWebMercator(point);
map.graphics.add(graphic);
gsvc.project([ point ], outSR, function(projectedPoints) {
pt = projectedPoints[0];
// display both geometry service result and the client side result
graphic.setInfoTemplate(new esri.InfoTemplate("Coordinates",
"<table><tbody><tr><td>Geometry Service:</td><td>" + pt.x.toFixed(3) + ", " + pt.y.toFixed(3) +
"</td></tr><tr><td>Client Side:</td><td>" + wm.x.toFixed(3) + ", " + wm.y.toFixed(3) + "</td></tr></tbody></table>"
));
map.infoWindow
.setTitle(graphic.getTitle())
.setContent(graphic.getContent())
.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
});
}
dojo.addOnLoad(initialize);
</script>
</head>
<body class="claro">
<b>Click a location on the map to Project from LatLng -> Web Mercator:</b>
<div id="map" style="width:800px; height:800px; border:1px solid #000;"></div>
</body>
</html>
... View more
07-28-2011
09:54 AM
|
0
|
0
|
1654
|
|
POST
|
There was a cool demo from this year's UC that does exactly this: http://na.arcgis.com/UCdemo/traffic.html But it doesn't work in IE because it's using canvas to transform the full color tiles to a gray scale tiles. If you absolutely have to use IE, you might be able to use a shim like excanvas but then I'd be worried about performance... Google's Chrome Frame is also a solution if you absolutely have to run in IE.
... View more
07-28-2011
08:38 AM
|
0
|
0
|
2828
|
|
POST
|
I think you'll get better answers here: http://forums.arcgis.com/forums/8-ArcGIS-Server-General You also might try posting on http://gis.stackexchange.com
... View more
07-28-2011
08:06 AM
|
0
|
0
|
547
|
|
POST
|
...I have a total of 42 mapLayers. I'm not sure if this qualifies as being a lot of layers in an app, and if it may be part of the problem. Any thoughts out there? Yes, that is a lot of layers. You're comparing the load time of 42 to layers with that of one when you compare your app to the JS preview from the services directory. It's kind of like saying "Firefox opens immediately when I open it with one tab but if I open it with 42 tabs it takes forever". You're probably overwhelming your server. Do you really need 42 layers in your web app? Can you combine any of your services? What about loading services at run-time instead of when your app starts?
... View more
07-28-2011
05:57 AM
|
0
|
0
|
1943
|
|
POST
|
Can you post the HTML and CSS for your app? Normally these alignment issues are related to your markup and styles.
... View more
07-28-2011
05:51 AM
|
0
|
0
|
874
|
|
POST
|
You were almost there. The problem was hardcoding the reference to the 3rd object(array index 2) in the features array that comes back from your query task. I changed your query related records callback quite a bit to get it working:
function findRelatedRecords(features) {
console.log('finding related records', features, features.length);
var relatedTopsQuery = new esri.tasks.RelationshipQuery();
relatedTopsQuery.outFields = ["*"];
relatedTopsQuery.relationshipId = 3;
// Create array of objectIds
var ids = dojo.map(features, function (f) {
return f.attributes.ObjectID;
});
console.log('ids: ', ids);
relatedTopsQuery.objectIds = ids;
wellFeatureLayer.queryRelatedFeatures(relatedTopsQuery, function (recs) {
console.log('related: ', recs);
// Build an array for the grid
var items = [];
// Recs is an object where each property is the objectid for a feautre
// with related records
for (id in recs) {
// For each related record, create an item which will correspond to
// a row in the data grid
dojo.forEach(recs[id].features, function (feat) {
items.push(feat.attributes);
});
}
//Create data object to be used in store
var data = {
// Identifier and label are case-sensitive
identifier: "OBJECTID",
//This field needs to have unique values
label: "OBJECTID",
items: items
};
//Create data store and bind to grid.
store = new dojo.data.ItemFileReadStore({
data: data
});
grid.setStore(store);
grid.setQuery({
OBJECTID: '*'
});
});
}
Also, the label, identifier and field (this part: <th field="OBJECTID">Object ID</th>) names for data grids are case-sensitive. Last thing would be to upgrade to version 2.4 of the API.
... View more
07-27-2011
08:16 PM
|
0
|
0
|
641
|
|
POST
|
Yes, I'd say preventing SQL injection attacks is beyond the scope of the JS API. It's probably a better question for the REST API forum. To change the max number of records returned by a service, edit the service's config file and change MaxRecordCount to the desired number. Here's the documentation for this: http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#//0093000000mr000000
... View more
07-27-2011
07:41 PM
|
0
|
0
|
1209
|
|
POST
|
In Firebug, on the Net tab, you should see a request being made to your geometry service. If you right-click on that URL and select "Copy Location", you can paste that URL into a new tab(see attached screen shot). What happens when you load the Geometry Service URL in a new tab?
... View more
07-27-2011
06:43 AM
|
0
|
0
|
3125
|
|
POST
|
I think using executeForCount is a good idea to handle this. But AGS tries to protect you from regularly overwhelming services by setting the default max number of results to 1000 (it was 500 at 9.3.1). Have you changed this setting?
... View more
07-27-2011
06:34 AM
|
0
|
0
|
1209
|
|
POST
|
Nice. If you're interested in hosting your data on ArcGIS.com you should talk to your account rep.
... View more
07-26-2011
12:09 PM
|
0
|
0
|
1729
|
|
POST
|
Your code looks like it should work...have you used firebug or chrome dev tools to look at the URL being sent to your geometry service? What happens if you try to load that URL directly in your browser?
... View more
07-26-2011
12:02 PM
|
0
|
0
|
3125
|
|
POST
|
If you want to host it locally and/or do something not explicitly demonstrated in a sample, then yes, it requires a little code. You're free to use the ArcGIS.com viewer or Explorer Online, though.
... View more
07-26-2011
12:01 PM
|
0
|
0
|
1729
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-23-2012 07:54 AM | |
| 1 | 05-28-2010 08:31 AM | |
| 1 | 11-12-2012 08:12 AM | |
| 3 | 02-23-2012 10:57 AM | |
| 1 | 06-27-2011 08:51 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|