|
POST
|
You can set displayOnPan on a per layer basis: it's an option to the constructor for graphics layer (as well as feature layer).
... View more
03-22-2013
06:46 AM
|
0
|
0
|
1487
|
|
POST
|
i take that back. derek used a web mercator basemap in his sample as well, so there must be something else going on. With 3.3, if you don't specify a spatial reference when creating a geometry, it's assumed to be WGS84 (wkid 4326) coordinates. Also with 3.3, if you add a graphic to a map that has a geographic geometry (again, wkid 4326), it's converted on the fly to web mercator so you don't have to worry about explicitly doing the conversion.
... View more
03-21-2013
01:01 PM
|
0
|
0
|
3320
|
|
POST
|
In addition to this change pointed out by mflawton:
if (LAYER_TRANSPORT.loaded == true && LAYER_SATELLITE.loaded == true) {
Move LAYER_TRANSPORT.show(); to be after LAYER_SATELLITE.show(); in the toggleHybrid function:
function toggleHybrid() {
if (LAYER_TRANSPORT.loaded == true && LAYER_SATELLITE.loaded == true) {
LAYER_STREETS.hide();
LAYER_TOPO.hide();
LAYER_SATELLITE.show();
LAYER_TRANSPORT.show();
}
else {
logMessage("SHOW 'hybrid' failed. LAYER_TRANSPORT, LAYER_SATELLITE not loaded.");
}
}
This works in IE8 for me:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Map Layers in IE8 and IE7</title>
<!-- ESRI Required -->
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css" />
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/tundra/tundra.css"/>
<script type="text/javascript">var dojoConfig = { parseOnLoad: true };</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3"></script>
<script type="text/javascript">
dojo.require("esri.map");
var map;
var streetsUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
var topoUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer";
var transportUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer";
var satelliteUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"
var LAYER_STREETS = null;
var LAYER_TOPO = null;
var LAYER_TRANSPORT = null;
var LAYER_SATELLITE = null;
function init() {
var initExtent = new esri.geometry.Extent({ "xmin": -13056017.708638752, "ymin": 4028145.398141955, "xmax": -13030946.363361249, "ymax": 4042916.8538580453, "spatialReference": { "wkid": 102100 } });
// Hard code levels of detail
var lods = [
{
"level": 0,
"resolution": 156543.033928,
"scale": 591657527.591555
},
{
"level": 1,
"resolution": 78271.5169639999,
"scale": 295828763.795777
},
{
"level": 2,
"resolution": 39135.7584820001,
"scale": 147914381.897889
},
{
"level": 3,
"resolution": 19567.8792409999,
"scale": 73957190.948944
},
{
"level": 4,
"resolution": 9783.93962049996,
"scale": 36978595.474472
},
{
"level": 5,
"resolution": 4891.96981024998,
"scale": 18489297.737236
},
{
"level": 6,
"resolution": 2445.98490512499,
"scale": 9244648.868618
},
{
"level": 7,
"resolution": 1222.99245256249,
"scale": 4622324.434309
},
{
"level": 8,
"resolution": 611.49622628138,
"scale": 2311162.217155
},
{
"level": 9,
"resolution": 305.748113140558,
"scale": 1155581.108577
},
{
"level": 10,
"resolution": 152.874056570411,
"scale": 577790.554289
},
{
"level": 11,
"resolution": 76.4370282850732,
"scale": 288895.277144
},
{
"level": 12,
"resolution": 38.2185141425366,
"scale": 144447.638572
},
{
"level": 13,
"resolution": 19.1092570712683,
"scale": 72223.819286
},
{
"level": 14,
"resolution": 9.55462853563415,
"scale": 36111.909643
},
{
"level": 15,
"resolution": 4.77731426794937,
"scale": 18055.954822
},
{
"level": 16,
"resolution": 2.38865713397468,
"scale": 9027.977411
},
{
"level": 17,
"resolution": 1.19432856685505,
"scale": 4513.988705
},
{
"level": 18,
"resolution": 0.597164283559817,
"scale": 2256.994353
}
];
map = new esri.Map("map", {
lods: lods
});
LAYER_STREETS = createLayerWithUrl(streetsUrl);
LAYER_TOPO = createLayerWithUrl(topoUrl);
LAYER_SATELLITE = createLayerWithUrl(satelliteUrl);
LAYER_TRANSPORT = createLayerWithUrl(transportUrl);
toggleStreets();
};
function createLayerWithUrl(url) {
var layer = new esri.layers.ArcGISTiledMapServiceLayer(url)
if (layer != undefined && layer != null) {
logMessage("CREATED: ArcGISTiledMapServiceLayer, listening for error, loaded events.");
dojo.connect(layer, "onError", tiledMapServiceLayerError);
dojo.connect(layer, "onLoad", tiledMapServiceLayerLoaded);
}
else {
logMessage("CREATED: failed. layer is null after constructor.");
}
return layer;
}
function tiledMapServiceLayerLoaded(layer) {
map.addLayer(layer);
layer.hide();
logMessage("LOADED: Layer loaded and added to map: '" + layer.id + "'");
}
function tiledMapServiceLayerError(error) {
var message = "";
if (error.message != undefined && error.message != null) {
message += error.message;
}
logMessage("ERROR: A problem occurred retrieving the layer. Error Message: '" + message + "'");
}
function logMessage(message) {
// Check for a console object
var console = window['console'];
// Log a message if a log property is available
//---------------------------------------------
if (console && console.log) {
console.log(message);
}
}
function toggleStreets() {
if (LAYER_STREETS.loaded == true) {
LAYER_STREETS.show();
LAYER_TOPO.hide();
LAYER_TRANSPORT.hide();
LAYER_SATELLITE.hide();
}
else {
logMessage("SHOW 'streets' failed. LAYER_STREETS not loaded.");
}
}
function toggleTopo() {
if (LAYER_TOPO.loaded == true) {
LAYER_STREETS.hide();
LAYER_TOPO.show();
LAYER_TRANSPORT.hide();
LAYER_SATELLITE.hide();
}
else {
logMessage("SHOW 'topo' failed. LAYER_TOPO not loaded.");
}
}
function toggleHybrid() {
if (LAYER_TRANSPORT.loaded == true && LAYER_SATELLITE.loaded == true) {
LAYER_STREETS.hide();
LAYER_TOPO.hide();
LAYER_SATELLITE.show();
LAYER_TRANSPORT.show();
}
else {
logMessage("SHOW 'hybrid' failed. LAYER_TRANSPORT, LAYER_SATELLITE not loaded.");
}
}
dojo.addOnLoad(init);
</script>
<style type="text/css">
body { font-size: 100%; font-family: Verdana; }
#map { height: 600px; width: 800px; margin: 50px auto; border: 3px solid black; }
</style>
</head>
<body>
<div class="search">
<input type="button" value="Streets" onclick="toggleStreets();" />
<input type="button" value="Topo" onclick="toggleTopo();" />
<input type="button" value="Hybrid" onclick="toggleHybrid();" />
</div>
<div id="map">
</div>
</body>
</html>
That being said: you're writing too much code to do this. At 3.3, we added getBasemap and setBasemap methods on the map. Please look into using those to toggle basemaps from arcgis.com. You should be able to replace the bulk of your code with 10 or so lines.
... View more
03-21-2013
10:21 AM
|
0
|
0
|
2608
|
|
POST
|
Here's a very simple example of putting a line graphic on a map: http://jsfiddle.net/hBa6v/ More info: �??at minimum, to see shapes on a map, you need a graphic with a geometry and a symbol �??the example above uses a polyline and a simple line symbol
... View more
03-21-2013
09:59 AM
|
0
|
0
|
3320
|
|
POST
|
Sorry about that but I've contacted support multiple times and cannot get a straight answer. There is also a bug submitted, but of course, that is set to low priority. Logging a bug is an acknowledgement that something is broken. I would also call that a straight answer. In this particular case, you're right, it's not a high priority to make sample that were designed for browsers on mobile devices run on legacy browsers. Yes, you are correct but if you wanted to create a adaptive web page (to work on both platforms), instead of having 2 separate code bases, you would want the application to also work in IE 8. Our IE 7/8 usage is still 20% of all hits. Not something we can ignore. In that case, don't use the mobile samples as the basis for your app. Or dig into the mobile samples yourself to address the shortcomings until we do. In the future, you can always post your questions here but we'll ask for as much info as support: specifically outline what you're doing, what you expect to happen, what's actually happening and code to reproduce the problem you're having.
... View more
03-13-2013
09:05 AM
|
0
|
0
|
1405
|
|
POST
|
http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/css.html
... View more
03-12-2013
09:44 AM
|
0
|
0
|
1280
|
|
POST
|
Derek, Do you happen to know when the Javascript team is going to fix the mobile samples? Everyone of the mobile samples error in IE 8. Thanks. brian In the future, please start a new thread instead of piggybacking on an existing, unrelated thread. That being said, we'll take a look at the mobile samples in IE8. Realistically, those are meant for browsers running on phones/tablets, not legacy browsers.
... View more
03-12-2013
09:43 AM
|
0
|
0
|
1405
|
|
POST
|
the init is called, but when entering the function dojo.ready(initMap()); FireBug gives me a ReferenceError: esri is not defined (this.map = new esri.Map("map",{.....) How can I make this work? Change:
dojo.ready(initMap())
To:
dojo.ready(initMap)
When you pass initMap() to dojo.ready, you're passing the return value of the initMap function instead of the initMap function itself. You want initMap to run when dojo.ready runs (this ensures esri.Map has been loaded), not before, which is what is probably happening with the current version of your code.
... View more
03-11-2013
03:15 PM
|
0
|
0
|
1510
|
|
POST
|
If the element where a map is being created doesn't have a width and height, the API defaults to using 400 for both. This is defined in esri.config.defaults.map.height and esri.config.defaults.map.width. To overcome this, specify a width and height on your element that will become a map (this could be an inline style, something in a style tag or in a .css file). See the create a map sample for an example that uses 100% for width and height: http://help.arcgis.com/en/webapi/javascript/arcgis/samples/map_simple/index.html
... View more
03-08-2013
08:44 AM
|
0
|
0
|
2024
|
|
POST
|
Hi All, Starting right about now (9 a.m. PST, March 8th), we are running a contest to see who can come up with the best app using 100 lines of JavaScript and the ArcGIS API for JavaScript. You can also use 3rd party libraries. Official contest rules are here: https://github.com/Esri/100-lines-or-less-js This has been planned to coincide with the dev summit but dev summit attendance is not required to participate. I hope to see some contest entries from forum regulars!
... View more
03-08-2013
06:56 AM
|
0
|
1
|
993
|
|
POST
|
That's a great help, thank you! Happy to help! Because of the on-the-fly simplfication it is doing, there is still a chance that a) the slow script message could appear - but greatly reduced from the likelihood before b) the query task for the points could get a geometry which is too simplified (we're basing on zoom level as per the example on the ESRI documentation) I think you're misunderstanding where the simplification happens and what causes the slow script error in IE. The simplification happens server side. Instead of the server trying to push one MB of geometry to the client, the geometry is simplified and usually reduced to no more than 100 KB or so (usually even less if you're using the settings we recommend). The slow script error is caused in IE by trying to parse large amounts of JSON. This error can be prevented by sending less data to the client, which is why we recommend using simplified geometries.
... View more
03-01-2013
09:07 AM
|
0
|
0
|
1836
|
|
POST
|
Following some additional testing, it appears the problem is when there's a complex geography that is being passed into the query task. I would guess that it's a complex geometry being returned by a queryTask. Looking at your app, clicking a polygon (Northumberland, for instance), causes ~1.2MB of JSON to be pushed to the client. This is almost certainly what is bogging down IE. You said you'd experimented with generalized geometries. Can you elaborate on what you've done? My recommended solution would be to use maxAllowableOffset to have the geometry generalized server side before being sent to the client. This will result in a faster response from the server. A little extra work is done server side but less data is sent to the client. Since the majority of time for the request is spent downloading data and parsing data, sending less data to the client is where you'll see the biggest performance improvement (even in browses that handle this volume of data easily, you should see better performance as it will take less time to download the data from the server). Here's a simple example app showing the benefits of using maxAllowableOffset with polygon data: http://servicesbeta.esri.com/demos/graphics-performance/polys.html That app is linked from our Determining Limits for Map Graphics help topic which I would recommend reading. Feature layer best practices is recommended reading as well.
... View more
02-28-2013
05:55 AM
|
0
|
0
|
1836
|
|
POST
|
IE10 is not currently supported. We are planning to have support for it at the next release (3.4).
... View more
02-26-2013
06:11 AM
|
0
|
0
|
860
|
|
POST
|
Should be in the next release (3.4) due out by the end of March.
... View more
02-14-2013
07:57 AM
|
0
|
0
|
1530
|
|
POST
|
The map's spatial reference is defined by the first layer added to the map (or, if you pass an extent to esri.Map, the spatial reference of the extent is used for the map). Once a map's spatial reference is set you cannot change it. You can however destroy and create a new map. The feature layer in any projection sample shows this. The answer to your question is no�?? destroy and create a new map to accomodate the service in a different spatial reference. Or, if you're using a dynamic map service (or feature service), let the map request data from the service to match the spatial reference of the map as dynamic and feature services can be reprojected on the fly.
... View more
02-14-2013
07:49 AM
|
1
|
0
|
1089
|
| 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
|