|
POST
|
I'm not sure why you're seeing that problem, but after some experimentation I found that this works:
var basemapLayer = new esri.layers.ArcGISTiledMapServiceLayer(...
var dynamicLayer = new esri.layers.ArcGISDynamicMapServiceLayer(...
var basemapLayer2 = new esri.layers.ArcGISTiledMapServiceLayer(...
var dynamicLayer2 = new esri.layers.ArcGISDynamicMapServiceLayer(...
basicMapObj.addLayers([basemapLayer, dynamicLayer]);
advancedMapObj.addLayers([basemapLayer2, dynamicLayer2]);
ie, create separate instances of the layers in each map. Steve That worked initially.. But its not sorted out completely. I added two separate onclick events. If i click on first map the infowindow appears on second http://jsfiddle.net/jH9Wb/2/ and ZoomIn, Zoom Out on scroll they work differently for both maps. What is the actual issue?
... View more
09-04-2012
04:34 AM
|
0
|
0
|
1447
|
|
POST
|
i just wrote a simple code to run two map's
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.0/js/esri/dijit/css/Popup.css"/>
<script type="text/javascript">
var djConfig = {
parseOnLoad: true
};
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.1">
</script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.dijit.Popup");
var basicMapObj, advancedMapObj;
function mapInitialization() {
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"));
var startExtent = new esri.geometry.Extent({ "xmin": -10858450, "ymin": 3300000, "xmax": -10858500, "ymax": 3365000, "spatialReference": { "wkid": 102100} });
basicMapObj = new esri.Map("basicMap", { extent: startExtent, infoWindow: popup });
advancedMapObj = new esri.Map("advancedMap", { extent: startExtent, infoWindow: popup });
var basemapUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";
var dynamicUrl = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer";
var basemapLayer = new esri.layers.ArcGISTiledMapServiceLayer(basemapUrl, { "id": "baseMap" });
var dynamicLayer = new esri.layers.ArcGISDynamicMapServiceLayer(dynamicUrl, { "id": "myMap", opacity: 0.80 });
basicMapObj.addLayers([basemapLayer, dynamicLayer]);
advancedMapObj.addLayers([basemapLayer, dynamicLayer]);
}
dojo.addOnLoad(mapInitialization);
</script>
</head>
<body>
<div id="basicMap" style="height:100%; width:40%;display:inline-block"></div>
<div id="advancedMap" style="height:100%; width:40%;display:inline-block"></div>
</body>
</html>
Link to code http://jsfiddle.net/jH9Wb/ Some strange behaviour. Only the second object loads. Slider of first map controls the second. Where am i going wrong?
... View more
09-03-2012
10:58 PM
|
0
|
0
|
1447
|
|
POST
|
Would it be an option to have a single map DIV, and hide the other DIVs until you need them? This sounds a whole lot simpler than trying to transfer the state from one DIV to another. Steve Now that is not possible since i have lot of other div's(not related to GIS) on page and while running an advanced view like popup i want to restrict access to the rest of the defined controls. The man problem comes with Dojo loader. Since it is loaded twice it creates lot of errors. How do i resolve this conflict. what i have done is i have both set of div's in the same page and i have hidden as you have mentioned but i would need a different div to show map again.
... View more
08-30-2012
08:11 AM
|
0
|
0
|
1447
|
|
POST
|
I have a situation wherein i show map in a Div and i have a maximize button. On click of maximize i have to show a different set of div's which contain gis functionalities like legend and navigation tool bar. and i have different set of functionalities for this map. and on click of close button the control has to be transferred to the original div containing map. I have attached an image to change this concept. Now i have different scripts for both and different pages as well. Both running as i want. now the thing is integrating them. when i click on maximize i will have to call its init function since dojo.ready() doesn't fires. and on closing this div the original div doesn't responds. How do i do this? Any suggestions?
... View more
08-29-2012
06:18 AM
|
0
|
6
|
3025
|
|
POST
|
Hi Jessica, This thread might help you http://forums.arcgis.com/threads/59247-URL-Parameters-Sample-(Polygons-vs.-Points) and you can also have a look at this http://jsfiddle.net/xV8bh/
... View more
08-27-2012
06:12 AM
|
0
|
0
|
1662
|
|
POST
|
I worked it out. A slight modification of http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/graphics_contextmenu.html function createMapMenu() { // Creates right-click context menu for map ctxMenuForMap = new dijit.Menu({ onOpen: function (box) { currentLocation = getMapPointFromMenuPosition(box); var infoTemplate = new esri.InfoTemplate(); identifyParams.geometry = currentLocation; identifyParams.mapExtent = map.extent; var deferred = identifyTask.execute(identifyParams); deferred.addCallback(function (response) { eturn dojo.map(response, function (result) { var feature = result.feature; feature.attributes.layerName = result.layerName; if (result.layerName === 'LayerOfInterest') { //This can get you the list of attributes feature.attributes; } return feature; }); }); } }); and you can use the feature values in the menu to do different things. Herein i have attached my code for infowindow on right click.
... View more
08-24-2012
05:41 AM
|
0
|
0
|
828
|
|
POST
|
In JavaScript a single equals sign is an assignment operator, a double equals sign is a comparison operator. Or, in geeky terms = != == 😛 https://developer.mozilla.org/en-US/docs/JavaScript/Reference#Operators Does that help? LOL that was a typo.. i didn't have = in my actual code! == really didn't help 😞 since i already had it !
... View more
08-15-2012
09:28 PM
|
0
|
0
|
1274
|
|
POST
|
What have you tried so far? i had this logic if(layer.visible=true) layer.hide(); else layer.show(); on click of check box.. on hide(); makes the layer change its visibility by with show it doesn't re-appear! is it something related to scope of my layer?
... View more
08-14-2012
06:44 AM
|
0
|
0
|
1274
|
|
POST
|
I have few static graphic layers which are created on load by running few queries.
var countiesGraphicsLayer = new esri.layers.GraphicsLayer();
//QueryTask returns a featureSet.
for (var i = 0, il = featureSet.features.length; i < il; i++) {
//Feature is a graphic
var graphic = featureSet.features;
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
var ext = graphic.geometry.getExtent();
map.setExtent(ext);
var length = graphic.geometry.paths[0].length;
var pointxy = graphic.geometry.paths[0][(length / 2) - 1];
var point = new esri.geometry.Point(pointxy[0], pointxy[1], new esri.SpatialReference({ wkid: 102100 }));
//var simpleMarkerSymbol = new esri.symbol.PictureMarkerSymbol('image/E1BA914F.png', 32, 32);
var simpleMarkerSymbol = new esri.symbol.PictureMarkerSymbol({
"type": "esriPMS",
"url": "image/E1BA914F.png",
"contentType": "image/png",
"color": null,
"width": 32,
"height": 32,
"angle": 0,
"xoffset": 16,
"yoffset": 8
});
var balloon = new esri.Graphic(point, simpleMarkerSymbol);
countiesGraphicsLayer.add(balloon);
}
map.addLayer(countiesGraphicsLayer);
similarly i have 2 more graphic layer. I want to toggle their visibility using a check box. How can i proceed?
... View more
08-14-2012
06:19 AM
|
0
|
6
|
1767
|
|
POST
|
Hi i used this method when i am working with ArcGIS Online public static MapPoint MidPoint(this Polyline polyline) { var length = polyline.Length(); var m = length / 2.0; return polyline.LinearPosition(m); } If you are familiar with flex please fallow this example you will get an idea to calculate mid point of polyline http://gisengineering.blogspot.in/2011/03/determine-midpoint-for-polyline-for.html It did something different.. Instead of finding the mid point i went with a point on polyline which is approximately in centre
var graphic = featureSet.features;
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
var ext = graphic.geometry.getExtent();
map.setExtent(ext);
var length = graphic.geometry.paths[0].length;
var pointxy= graphic.geometry.paths[0][(length/2];
var point = new esri.geometry.Point(pointxy[0], pointxy[1], new esri.SpatialReference({ wkid: 102100 }));
var simpleMarkerSymbol = new esri.symbol.PictureMarkerSymbol({
"type": "esriPMS",
"url": "image/E1BA914F.png",
"contentType": "image/png",
"color": null,
"width": 32,
"height": 32,
"angle": 0,
"xoffset": 16,
"yoffset": 8
});
var balloon = new esri.Graphic(point, simpleMarkerSymbol);
map.graphics.add(balloon);
... View more
08-14-2012
05:13 AM
|
0
|
0
|
453
|
|
POST
|
I have list of ObjectId's present in xml want to highlight them on map by adding a graphic layer. How do i write a query to search this? I had a wiered idea of doing this foreach(oid in xml) { query.where="OBJECTID="+oid+" or "; } xml generally contains 1000 values [confused/]
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["OBJECTID", "CMDTY", "DIA_IN", "RISK_SCORE", "MOD_DATE"];
query.outSpatialReference = { "wkid": 102100 };
query.where = ""; //How do i do this??
var infoTemplate = new esri.InfoTemplate();
infoTemplate.setTitle("${OBJECTID}");
infoTemplate.setContent("<b>Comodity: </b>${CMDTY}<br/>"
+ "<b>Internal Diameter: </b>${DIA_IN}<br/>"
+ "<b>Risk Score: </b>${RISK_SCORE}<br/>"
+ "<b>Last Updated on: </b>${MOD_DATE}");
map.infoWindow.resize(245, 125);
dojo.connect(queryTask, "onComplete", function (featureSet) {
map.graphics.clear();
var highlightSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([0, 0, 0]), 3);
var symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 1);
var countiesGraphicsLayer = new esri.layers.GraphicsLayer();
for (var i = 0, il = featureSet.features.length; i < il; i++) {
var graphic = featureSet.features;
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
countiesGraphicsLayer.add(graphic);
}
map.addLayer(countiesGraphicsLayer);
map.graphics.enableMouseEvents();
... View more
08-13-2012
06:35 AM
|
0
|
1
|
855
|
|
POST
|
I am building a search tool which has a text box ,a dropdown and a submit button. The drop down would essentially contain attribute field names and on submit i have code as bellow
findParams = new esri.tasks.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [5];
findParams.searchFields = dojo.byId("drop_down").value;
findParams.outSpatialReference = map.spatialReference;
function doFind() {
//Set the search text to the value in the box
findParams.searchText = dojo.byId("Risk_Score").value;
findTask.execute(findParams, showResults);
}
function showResults(results) {
//This function works with an array of FindResult that the task returns
map.graphics.clear();
//var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98, 194, 204]), 2), new dojo.Color([98, 194, 204, 0.5]));
var symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([0, 0, 0]), 3);
//create array of attributes
var items = dojo.map(results, function (result) {
var graphic = result.feature;
graphic.setSymbol(symbol);
map.graphics.add(graphic);
return result.feature.attributes;
});
//Create data object to be used in store
var data = {
identifier: "OBJECTID", //This field needs to have unique values
label: "OBJECTID", //Name field for display. Not pertinent to a grid but may be used elsewhere.
items: items
};
//Create data store and bind to grid.
store = new dojo.data.ItemFileReadStore({ data: data });
var grid = dijit.byId('grid');
grid.setStore(store);
//Zoom back to the initial map extent
map.setExtent(startExtent);
}
does this idea work?? and i have problem in loading field names to the drop down. Any help on this would be great. Thanks in advance. -Pramod
... View more
08-12-2012
11:18 PM
|
0
|
0
|
675
|
|
POST
|
I would like to add a picture symbol on a querytask result(over a poliline layer) The issue is about the postion attribute. var graphic = new esri.Graphic(position, simpleMarkerSymbol); how do i get the mid point of every poly line. is it like [(xmax-xmin)/2,(ymax-ymin)/2 ]??
... View more
08-10-2012
06:14 AM
|
0
|
2
|
707
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-24-2016 02:36 AM | |
| 1 | 08-01-2017 03:25 AM | |
| 1 | 09-16-2015 09:23 AM | |
| 1 | 03-22-2016 11:13 AM | |
| 1 | 11-24-2016 02:39 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-18-2023
06:35 PM
|