POST
|
http://developers.arcgis.com/en/javascript/jssamples/layers_point_clustering.html How can I add point clustering to a map... lets say that I have 100 pinpoints at chicago... how can I cluster them?
... View more
06-07-2013
08:12 PM
|
0
|
2
|
2621
|
POST
|
How can I make a world map similar to http://developers.arcgis.com/en/javascript/jssamples/popup_sidepanel.html I want it so that what ever country you click on, there is a side panel info window that shows detail. How can I set this up, and how can I make it so that each country has a different side panel when clicked?
... View more
06-05-2013
02:01 PM
|
0
|
1
|
2898
|
POST
|
Hello Can you please help me.. I want the browser to get the current location of the user and make a circle marker at their location.. Something like http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/mobile_geolocaterenderer.html <!doctype html> <html lang="en"> <head> <meta 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></title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ margin: 0; padding: 0; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); var map; function init() { var initExtent = new esri.geometry.Extent({"xmin":-13114922,"ymin":-5500000,"xmax":9292585,"ymax":10351408, "spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:initExtent}); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"); map.addLayer(basemap); dojo.connect(map, "onLoad", function() { var points = { "points": [[-122.63,45.51],[-122.56,45.51],[-122.56,45.55],[-122.62,45.00],[77,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Bob","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); dojo.connect(map.graphics, "onMouseOver", function(evt) { var g = evt.graphic; map.infoWindow.setContent(g.getContent()); map.infoWindow.setTitle(g.getTitle()); map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)); }); dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} ); }); } dojo.ready(init); dojo.require("esri.map"); function init() { var map = new esri.Map("map"); dojo.connect(map, "onLoad", function() { //after map loads, connect to listen to mouse move & drag events dojo.connect(map, "onMouseMove", showCoordinates); dojo.connect(map, "onMouseDrag", showCoordinates); }); var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"); map.addLayer(tiledMapServiceLayer); } function showCoordinates(evt) { //get mapPoint from event //The map is in web mercator - modify the map point to display the results in geographic var mp = esri.geometry.webMercatorToGeographic(evt.mapPoint); //display mouse coordinates dojo.byId("info").innerHTML = mp.x + ", " + mp.y; } dojo.addOnLoad(init); </script> </head> <body class="tundra"> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width: 100%; height: 100%; margin: 0;"> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> </div> </div> </body> </html>
... View more
06-27-2012
03:57 PM
|
0
|
2
|
1654
|
POST
|
I have this code below. This function allows me to click anywhere on my map and a infowindow displays the Coordinates of the clicked location how can i edit this code below so that it GETS and the coordinates and POST them in a new page. I know how to do this is PHP but not in JAVA Also is there a function i can add for onclick=Something? Thanks 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: 4326}); map.graphics.add(graphic); gsvc.project([ point ], outSR, function(projectedPoints) { pt = projectedPoints[0]; graphic.setInfoTemplate(new esri.InfoTemplate("Coordinates", "<p> X: " + pt.x + "<br/> Y: " + pt.y + "</p>" + "<input type='button' value='Pin Here' onclick='Something?();' />" + "<div id='latlong'></div>")); map.infoWindow .setTitle(graphic.getTitle()) .setContent(graphic.getContent()) .show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
... View more
06-25-2012
06:28 PM
|
0
|
0
|
561
|
POST
|
I have a marker with the code below.. How can i change the color to red var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Bob","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); var points = { "points": [[85,45.51],[-5,45.51],[45,45.55],[20,45.00],[20,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp);
... View more
06-24-2012
05:44 PM
|
0
|
1
|
418
|
POST
|
Hey. Is there anything i can do with the padding to fix the hesitation w/ the infowindows. When i project a point, and try to click on the infowindow, the infowindow goes away. Do you think its padding?
... View more
05-17-2012
06:19 PM
|
0
|
0
|
623
|
POST
|
Thanks alot man your great. I am new to the ARCGIS API, so im not to good with the platform yet. Your help is much appreciated Thanks again
... View more
05-16-2012
11:38 AM
|
0
|
0
|
623
|
POST
|
I tried what you had said. Its a bit better, but if after a couple different infowindows it hesitates. What should i do? Is there a way that i can project a point without losing the previous points being cleared off the map. Also how can i change the color of the marker Thanks a lot for your help. Heres my code after all edits. <!doctype html> <html lang="en"> <head> <script language=JavaScript> var message="Please Choose your coordinates!"; function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false") </script> <meta 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></title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ margin: 0; padding: 0; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); dojo.require("esri.tasks.geometry"); var map; var gsvc = null; var pt = null; function init() { var initExtent = new esri.geometry.Extent({"xmin":-13114922,"ymin":-5500000,"xmax":9292585,"ymax":10351408, "spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:initExtent}); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"); map.addLayer(basemap); gsvc = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); dojo.connect(map, "onClick", projectToWebMercator); dojo.connect(map, "onLoad", function() { var points = { "points": [[-122.63,45.51],[-122.56,45.51],[-122.56,45.55],[-122.62,45.00],[77,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Bob","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); var points = { "points": [[85,45.51],[-5,45.51],[45,45.55],[20,45.00],[20,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Jack","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); dojo.connect(map.graphics, "onMouseOver", function(evt) { var g = evt.graphic; map.infoWindow.setContent(g.getContent()); map.infoWindow.setTitle(g.getTitle()); map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)); }); dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} ); dojo.connect(map, "onMouseMove", function(evt) { var mp = esri.geometry.webMercatorToGeographic(evt.mapPoint); dojo.byId("spanCoords").innerHTML = mp.x + ", " + mp.y; dojo.byId("spanCoords").innerHTML = (Math.round(mp.x * 10000) / 10000) + ", " + (Math.round(mp.y * 10000) / 10000); }); }); } function projectToWebMercator(evt) { map.graphics.clear(); var point = evt.mapPoint; var symbol = new esri.symbol.SimpleMarkerSymbol().setStyle(esri.symbol.SimpleMarkerSymbol); var graphic = new esri.Graphic(point, symbol); var outSR = new esri.SpatialReference({ wkid: 4326}); map.graphics.add(graphic); gsvc.project([ point ], outSR, function(projectedPoints) { pt = projectedPoints[0]; graphic.setInfoTemplate(new esri.InfoTemplate("Coordinates", "<p> X: " + pt.x + "<br/> Y: " + pt.y + "</p>" + "<input type='button' value='Click Here' onclick='projectToLatLong();' />" + "<div id='latlong'></div>")); map.infoWindow .setTitle(graphic.getTitle()) .setContent(graphic.getContent()) .show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint)); }); } function projectToLatLong() { var outSR = new esri.SpatialReference({ wkid: 4326}); gsvc.project([ pt ], outSR, function(projectedPoints) { pt = projectedPoints[0]; dojo.byId("latlong").innerHTML = " Latitude = " + pt.y + "<br/> Longitude = " + pt.x; }); } dojo.ready(init); </script> </head> <div style="position: absolute; bottom: 5px; left: 5px; z-index: 8999; padding: 5px; background-color: #ADD8E6;"> Current Coordinates (Latitude, Longitude): <span id="spanCoords"></span> </div> <body class="tundra"> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width: 100%; height: 100%; margin: 0;"> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> </div> </div> </body> </html>
... View more
05-15-2012
06:25 PM
|
0
|
0
|
623
|
POST
|
Thanks for the help. Also is there anyway to make it so that i can click convert back to lat long. Because right now if you try to click it the info window goes away
... View more
05-15-2012
03:09 PM
|
0
|
0
|
623
|
POST
|
If you already have a map created, and wanted to add a new sample to the code, what part of the code would you take to add to your existing code. For example, I want to make an infowindow popup when click on any place on map so that the info windows shows the coordinates of the click. I got this idea from the PROJECT a POINT Sample in the API : http://help.arcgis.com/en/webapi/javascript/arcgis/demos/util/util_project.html I tried adding a new dojo and a new function, but it didnt work. My code (below) has hoovering pinpoint and also shows the coordinates in the bottom. But i want it to show in a infowindow when click as well Here is my current working code. Please Amend It and also explain. Thanks. All help is appreciated <!doctype html> <html lang="en"> <head> <script language=JavaScript> var message="Please Choose your coordinates!"; function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false") </script> <meta 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></title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/esri/dijit/css/Popup.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ margin: 0; padding: 0; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); var map; function init() { var initExtent = new esri.geometry.Extent({"xmin":-13114922,"ymin":-5500000,"xmax":9292585,"ymax":10351408, "spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:initExtent}); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"); map.addLayer(basemap); dojo.connect(map, "onLoad", function() { var points = { "points": [[-122.63,45.51],[-122.56,45.51],[-122.56,45.55],[-122.62,45.00],[77,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Bob","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); var points = { "points": [[85,45.51],[-5,45.51],[45,45.55],[20,45.00],[20,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Jack","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); dojo.connect(map.graphics, "onMouseOver", function(evt) { var g = evt.graphic; map.infoWindow.setContent(g.getContent()); map.infoWindow.setTitle(g.getTitle()); map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)); }); dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} ); dojo.connect(map, "onMouseMove", function(evt) { var mp = esri.geometry.webMercatorToGeographic(evt.mapPoint); dojo.byId("spanCoords").innerHTML = mp.x + ", " + mp.y; dojo.byId("spanCoords").innerHTML = (Math.round(mp.x * 10000) / 10000) + ", " + (Math.round(mp.y * 10000) / 10000); }); }); } dojo.ready(init); </script> </head> <div style="position: absolute; bottom: 5px; left: 5px; z-index: 8999; padding: 5px; background-color: #ADD8E6;"> Current Coordinates (Latitude, Longitude): <span id="spanCoords"></span> </div> <body class="tundra"> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width: 100%; height: 100%; margin: 0;"> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> </div> </div> </body> </html>
... View more
05-15-2012
11:39 AM
|
0
|
7
|
1376
|
POST
|
Hello, Could someone implement my code to make it so it points out the users current location. Something similiar to http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/exp_geolocate.html Thanks, Heres my code <!doctype html> <html lang="en"> <head> <script language=JavaScript> var message="Please Choose your coordinates!"; function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false") </script> <meta 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></title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/esri/dijit/css/Popup.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ margin: 0; padding: 0; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); var map; function init() { var initExtent = new esri.geometry.Extent({"xmin":-13114922,"ymin":-5500000,"xmax":9292585,"ymax":10351408, "spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:initExtent}); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"); map.addLayer(basemap); dojo.connect(map, "onLoad", function() { var points = { "points": [[-122.63,45.51],[-122.56,45.51],[-122.56,45.55],[-122.62,45.00],[77,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Bob","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); var points = { "points": [[85,45.51],[-5,45.51],[45,45.55],[20,45.00],[20,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Jack","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); dojo.connect(map.graphics, "onMouseOver", function(evt) { var g = evt.graphic; map.infoWindow.setContent(g.getContent()); map.infoWindow.setTitle(g.getTitle()); map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)); }); dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} ); dojo.connect(map, "onMouseMove", function(evt) { var mp = esri.geometry.webMercatorToGeographic(evt.mapPoint); dojo.byId("spanCoords").innerHTML = mp.x + ", " + mp.y; dojo.byId("spanCoords").innerHTML = (Math.round(mp.x * 10000) / 10000) + ", " + (Math.round(mp.y * 10000) / 10000); }); }); } dojo.ready(init); </script> </head> <div style="position: absolute; bottom: 5px; left: 5px; z-index: 8999; padding: 5px; background-color: #ADD8E6;"> Current Coordinates (Latitude, Longitude): <span id="spanCoords"></span> </div> <body class="tundra"> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width: 100%; height: 100%; margin: 0;"> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> </div> </div> </body> </html>
... View more
05-14-2012
11:21 AM
|
0
|
0
|
583
|
POST
|
Hello THanks for the edits. The PROJECTTOLATLONG function is suppose to make a info window pop up with the coordinates. Sort of like http://help.arcgis.com/en/webapi/javascript/arcgis/demos/util/util_project.html Thanks.
... View more
05-11-2012
02:50 PM
|
0
|
0
|
181
|
POST
|
My script works, but when i added the ProjecttoLatLong it doesnt work. I want it so that when i click on any point, and info window shows the coordiantes. Thanks for any help. Much Appreciated <!doctype html> <html lang="en"> <head> <script language=JavaScript> var message="Please Choose your coordinates!"; function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false") </script> <meta 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></title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/esri/dijit/css/Popup.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ margin: 0; padding: 0; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); var map; function init() { var initExtent = new esri.geometry.Extent({"xmin":-13114922,"ymin":-5500000,"xmax":9292585,"ymax":10351408, "spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:initExtent}); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"); map.addLayer(basemap); dojo.connect(map, "onLoad", function() { var points = { "points": [[-122.63,45.51],[-122.56,45.51],[-122.56,45.55],[-122.62,45.00],[77,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Bob","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); var points = { "points": [[85,45.51],[-5,45.51],[45,45.55],[20,45.00],[20,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Jack","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); dojo.connect(map.graphics, "onMouseOver", function(evt) { var g = evt.graphic; map.infoWindow.setContent(g.getContent()); map.infoWindow.setTitle(g.getTitle()); map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)); }); dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} ); dojo.connect(map, "onMouseMove", function(evt) { var mp = esri.geometry.webMercatorToGeographic(evt.mapPoint); dojo.byId("spanCoords").innerHTML = mp.x + ", " + mp.y; dojo.byId("spanCoords").innerHTML = (Math.round(mp.x * 10000) / 10000) + ", " + (Math.round(mp.y * 10000) / 10000); }); dojo.connect(map, "onClick", function projectToLatLong() { var outSR = new esri.SpatialReference({ wkid: 4326}); gsvc.project([ pt ], outSR, function(projectedPoints) { pt = projectedPoints[0]; dojo.byId("latlong").innerHTML = " Latitude = " + pt.y + "<br/> Longitude = " + pt.x; }); } dojo.ready(init); </script> </head> <div style="position: absolute; bottom: 5px; left: 5px; z-index: 8999; padding: 5px; background-color: #ADD8E6;"> Current Coordinates (Latitude, Longitude): <span id="spanCoords"></span> </div> <body class="tundra"> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width: 100%; height: 100%; margin: 0;"> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> </div> </div> </body> </html>
... View more
05-10-2012
03:39 PM
|
0
|
2
|
410
|
POST
|
I have markers in my code that have a info window when hovered (mouseover) I have seen a project a point sample on the JAVA SAMPLE Page API. How can take the project a point idea from http://help.arcgis.com/en/webapi/jav...l_project.html and put it in my code so that when i dont have a marker there, it projects the coordinates. Thanks Heres my code: <!doctype html> <html lang="en"> <head> <meta 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></title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/esri/dijit/css/Popup.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ margin: 0; padding: 0; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); var map; function init() { var initExtent = new esri.geometry.Extent({"xmin":-13114922,"ymin":-5500000,"xmax":9292585,"ymax":10351408, "spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:initExtent}); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"); map.addLayer(basemap); dojo.connect(map, "onLoad", function() { var points = { "points": [[-122.63,45.51],[-122.56,45.51],[-122.56,45.55],[-122.62,45.00],[77,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Bob","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); dojo.connect(map.graphics, "onMouseOver", function(evt) { var g = evt.graphic; map.infoWindow.setContent(g.getContent()); map.infoWindow.setTitle(g.getTitle()); map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)); }); dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} ); }); } dojo.ready(init); </script> </head> <body class="tundra"> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width: 100%; height: 100%; margin: 0;"> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> </div> </div> </body> </html>
... View more
05-10-2012
11:36 AM
|
0
|
0
|
645
|
POST
|
I have seen a project a point sample on the JAVA SAMPLE Page API. How can take the project a point idea from http://help.arcgis.com/en/webapi/jav...l_project.html and put it in my code so that when i dont have a marker there, it projects the coordinates. Thanks Heres my code: <!doctype html> <html lang="en"> <head> <meta 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></title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/esri/dijit/css/Popup.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ margin: 0; padding: 0; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); var map; function init() { var initExtent = new esri.geometry.Extent({"xmin":-13114922,"ymin":-5500000,"xmax":9292585,"ymax":10351408, "spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:initExtent}); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"); map.addLayer(basemap); dojo.connect(map, "onLoad", function() { var points = { "points": [[-122.63,45.51],[-122.56,45.51],[-122.56,45.55],[-122.62,45.00],[77,19]], "spatialReference": ({ "wkid": 4326 }) }; var mp = new esri.geometry.Multipoint(points); var wm_mp = esri.geometry.geographicToWebMercator(mp); var sms = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Bob","Lives in the USA"); var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate); map.graphics.add(graphic); dojo.connect(map.graphics, "onMouseOver", function(evt) { var g = evt.graphic; map.infoWindow.setContent(g.getContent()); map.infoWindow.setTitle(g.getTitle()); map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)); }); dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} ); }); } dojo.ready(init); </script> </head> <body class="tundra"> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width: 100%; height: 100%; margin: 0;"> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> </div> </div> </body> </html>
... View more
05-07-2012
10:42 AM
|
0
|
0
|
161
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|