POST
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" /> <title></title> <script type="text/javascript" src="script.js"></script> <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAN-Td40dwxFW7Kl1Q6ose-RSfCPemwdJVBhVchwJQMM9mgW5i3RSCFG3iEvk1vrOzbuw-jEazCurPzQ" type="text/javascript"></script> <script src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.6" type="text/javascript"></script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script type="text/javascript"> var gmap = null; var geocoder = null; var dynMapOv = null; var marker,mapExtension,overlays,layers,identifyTask,layerId,dynamicMap,Repmap; function initialize() { if (GBrowserIsCompatible()) { gmap = new GMap2(document.getElementById("gmap")); gmap.setCenter(new GLatLng(12.978004, 77.606081), 12); gmap.enableScrollWheelZoom(); gmap.addControl(new GSmallMapControl()); gmap.addControl(new GMapTypeControl()); gmap.removeMapType(G_HYBRID_MAP); mapExtension = new esri.arcgis.gmaps.MapExtension(gmap); dynamicMap = new esri.arcgis.gmaps.DynamicMapServiceLayer("http://map2.janaagraha.org/arcgis/rest/services/IJ_Google/MapServer",null, 0.5, dynmapcallback); Repmap = new esri.arcgis.gmaps.DynamicMapServiceLayer("http://map2.janaagraha.org/arcgis/rest/services/IJ_ElecRep/MapServer",null, 0.5, dynmapcallbackRep); geocoder = new GClientGeocoder(); } } function dynmapcallback(mapservicelayer) { gmap.addOverlay(mapservicelayer); } function dynmapcallbackRep(Replayer) { gmap.addOverlay(Replayer); } function showAddress(address) { if(marker){ gmap.removeOverlay(marker); } if(address.indexOf(",Bangalore")) { address; } if(address.indexOf() == address.indexOf(",Bangalore")) { address+= ",Bangalore"; } if (geocoder) { geocoder.getLatLng( address, function(point) { if (!point) { alert(address + " not found"); } else { gmap.setCenter(point, 15); marker = new GMarker(point); gmap.addOverlay(marker); marker.openInfoWindow(document.createTextNode(address)); } } ); } } function identify(overlay, latLng) { if (overlay) return; clearResults(); // set the identify parameters var identifyParameters = new esri.arcgis.gmaps.IdentifyParameters(); identifyParameters.geometry = latLng; // location where the user clicked on the map identifyParameters.tolerance = 3; identifyParameters.layerIds = [0,1]; identifyParameters.layerOption = "all"; identifyParameters.bounds = gmap.getBounds(); var mapSize = gmap.getSize(); identifyParameters.width = mapSize.width; identifyParameters.height = mapSize.height; // execute the identify operation identifyTask.execute(identifyParameters, function(response, error) { // function to be called when the result is available // display error message (if any) and return if (hasErrorOccurred(error)) return; // note that the location where the user clicked on the map (latLng) is visible in this function through closure addResultToMap(response, latLng); }); } function addResultToMap(response, point) { debugger; // aggregate the result per map service layer var idResults = response.identifyResults; layers = {"0": [],"1": []}; for (var i = 0; i < idResults.length; i++) { var result = idResults; layers[result.layerId].push(result); } // create and show the info-window with tabs, one for each map service layer var tabs = []; for (layerId in layers) { var results = layers[layerId]; var count = results.length; var label = "", content = ""; switch(layerId) { case "0": if (count == 0) break; for (var j = 0; j < count; j++) { var attributes = results .feature.attributes; content = "<a href='#' onclick='showFeature(" + layerId + "," + j + ")'>" + attributes["Ward_Name"] + "</a><br>"; content += "<br>This is ward number: <b>" + attributes["Ward_No"] + "</b>" + "<br>" + " <b>Ward Population: </b>" + attributes["Ward_Popul"] + "<br>" + " <b>Ward Area: </b>" + attributes["Area"]+ " sqkm"; } break; case "1": if (count == 0) break; for (var k = 0; k < count; k++) { var attributes1 = results .feature.attributes; content = "<a href='#' onclick='showFeature(" + layerId + "," + k + ")'>" + attributes["AC_Name"] + "</a><br>"; content += " <b><font color='#0000FF'>" + attributes["AC_Name"] + " : "+ attributes["AC_No"] + "</font></b>" + "<br>" + " <b>No.of Wards: </b>" + attributes["No_of_Ward"] + "<br>" + " <b>Ward Names: </b>" + attributes["Ward_No__"]; } break; } tabs.push(new GInfoWindowTab(label, content)); } gmap.openInfoWindowTabsHtml(point, tabs); } function showFeature(layerId, index) { mapExtension.removeFromMap(overlays); var idResult = layers[layerId][index]; overlays = mapExtension.addToMap(idResult, {polygonOptions: { clickable: false}}); } function clearResults() { mapExtension.removeFromMap(overlays); gmap.closeInfoWindow(); } function hasErrorOccurred(error) { if (error) { alert("Error " + error.code + ": " + (error.message || (error.details && error.details.join(" ")) || "Unknown error" )); return true; } return false; } function showAdmin(){ debugger var arr = []; gmap.removeOverlay(Repmap); Repmap.refresh(); document.getElementById('2').checked=false; document.getElementById('3').checked=false; document.getElementById('4').checked=false; if(document.getElementById('0').checked==true){ arr.push(0); dynamicMap.setVisibleLayers(arr); dynamicMap.refresh(); } if(document.getElementById('1').checked==true){ arr.push(1); dynamicMap.setVisibleLayers(arr); dynamicMap.refresh(); } identifyTask = new esri.arcgis.gmaps.IdentifyTask("http://map2.janaagraha.org/arcgis/rest/services/IJ_Google/MapServer"); GEvent.addListener(gmap, "click", identify); } function showRep(){ debugger var arr = []; gmap.removeOverlay(dynamicMap); dynamicMap.refresh(); document.getElementById('0').checked=false; document.getElementById('1').checked=false; if(document.getElementById('2').checked==true){ arr.push(0); Repmap.setVisibleLayers(arr); Repmap.refresh(); } if(document.getElementById('3').checked==true){ arr.push(1); Repmap.setVisibleLayers(arr); Repmap.refresh(); } if(document.getElementById('4').checked==true){ arr.push(2); Repmap.setVisibleLayers(arr); Repmap.refresh(); } } </script> </head> <body onload="initialize();" onunload="GUnload();"> <div id="mainWindow" style="width: 100%; height: 100%;"> <form action="#" onsubmit="showAddress(this.address.value); return false"> <div id="header"> <span>Bangalore /</span><span id="subheader"> Select your location to get more information</span> <input type="text" size="60" name="address" value="Walton road" style="width: 146px; height: 24px;"/> <input type="submit" value="Search!" /> </div> </form> <div id="accordion2"> <dl class="accordion2" id="slider2"> <dt>Find Complaints</dt> <dd> <span>This lightweight (1.2 KB) JavaScript accordion can easily be customized to integrate with any w</span> </dd> <dt>Find Elected Representatives</dt> <dd> <input id="2" type="radio" name="group2" value="Corporator" onclick="showRep();"/>Corporator<br/> <input id="3" type="radio" name="group2" value="MLA" onclick="showRep();"/>MLA<br/> <input id="4" type="radio" name="group2" value="MP" onclick="showRep();"/>MP </dd> <dt>Administrative Divisions</dt> <dd> <input id="0" type="radio" name="group1" value="Wards" onclick="showAdmin();"/>Wards<br/> <input id="1" type="radio" name="group1" value="AC" onclick="showAdmin();"/>Assembly Constituency </dd> </dl> </div> <div id="gmap" class="shadow" style="width: 1260px; height: 790px"> </div> </div> <script type="text/javascript"> var slider2=new accordion.slider("slider2"); slider2.init("slider2",0,"open"); </script> </body> </html>
... View more
12-09-2011
12:44 AM
|
0
|
0
|
606
|
POST
|
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAN-Td40dwxFW7Kl1Q6ose-RSfCPemwdJVBhVchwJQMM9mgW5i3RSCFG3iEvk1vrOzbuw-jEazCurPzQ" type="text/javascript"></script> <script src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.6" type="text/javascript"></script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script type="text/javascript"> var gmap = null; var geocoder = null; var dynMapOv = null; var marker,mapExtension,overlays,layers,identifyTask,layerId,dynamicMap; function initialize() { if (GBrowserIsCompatible()) { gmap = new GMap2(document.getElementById("gmap")); gmap.setCenter(new GLatLng(12.978004, 77.606081), 12); gmap.enableScrollWheelZoom(); gmap.addControl(new GSmallMapControl()); gmap.addControl(new GMapTypeControl()); gmap.removeMapType(G_HYBRID_MAP); mapExtension = new esri.arcgis.gmaps.MapExtension(gmap); dynamicMap = new esri.arcgis.gmaps.DynamicMapServiceLayer("http://map2.janaagraha.org/arcgis/rest/services/IJ_Google/MapServer",null, 0.5, dynmapcallback); geocoder = new GClientGeocoder(); } } function dynmapcallback(mapservicelayer) { debugger; gmap.addOverlay(mapservicelayer); } function showAddress(address) { debugger; if(marker){ gmap.removeOverlay(marker); } if(address.indexOf(",Bangalore")) { address; } if(address.indexOf() == address.indexOf(",Bangalore")) { address+= ",Bangalore"; } if (geocoder) { geocoder.getLatLng( address, function(point) { if (!point) { alert(address + " not found"); } else { gmap.setCenter(point, 15); marker = new GMarker(point); gmap.addOverlay(marker); marker.openInfoWindow(document.createTextNode(address)); } } ); } } function identify(overlay, latLng) { if (overlay) return; clearResults(); // set the identify parameters var identifyParameters = new esri.arcgis.gmaps.IdentifyParameters(); identifyParameters.geometry = latLng; // location where the user clicked on the map identifyParameters.tolerance = 3; identifyParameters.layerIds = [0,1]; identifyParameters.layerOption = "all"; identifyParameters.bounds = gmap.getBounds(); var mapSize = gmap.getSize(); identifyParameters.width = mapSize.width; identifyParameters.height = mapSize.height; // execute the identify operation identifyTask.execute(identifyParameters, function(response, error) { // function to be called when the result is available // display error message (if any) and return if (hasErrorOccurred(error)) return; // note that the location where the user clicked on the map (latLng) is visible in this function through closure addResultToMap(response, latLng); }); } function addResultToMap(response, point) { debugger; // aggregate the result per map service layer var idResults = response.identifyResults; layers = {"0": [],"1": []}; for (var i = 0; i < idResults.length; i++) { var result = idResults; layers[result.layerId].push(result); } // create and show the info-window with tabs, one for each map service layer var tabs = []; for (layerId in layers) { var results = layers[layerId]; var count = results.length; var label = "", content = ""; switch(layerId) { case "0": if (count == 0) break; for (var j = 0; j < count; j++) { var attributes = results .feature.attributes; content = "<a href='#' onclick='showFeature(" + layerId + "," + j + ")'>" + attributes["Ward_Name"] + "</a><br>"; content += "<br>This is ward number: <b>" + attributes["Ward_No"] + "</b>" + "<br>" + " <b>Ward Population: </b>" + attributes["Ward_Popul"] + "<br>" + " <b>Ward Area: </b>" + attributes["Area"]+ " sqkm"; } break; case "1": if (count == 0) break; for (var k = 0; k < count; k++) { var attributes1 = results .feature.attributes; content = "<a href='#' onclick='showFeature(" + layerId + "," + k + ")'>" + attributes["AC_Name"] + "</a><br>"; content += " <b><font color='#0000FF'>" + attributes["AC_Name"] + " : "+ attributes["AC_No"] + "</font></b>" + "<br>" + " <b>No.of Wards: </b>" + attributes["No_of_Ward"] + "<br>" + " <b>Ward Names: </b>" + attributes["Ward_No__"]; } break; } tabs.push(new GInfoWindowTab(label, content)); } gmap.openInfoWindowTabsHtml(point, tabs); } function showFeature(layerId, index) { mapExtension.removeFromMap(overlays); var idResult = layers[layerId][index]; overlays = mapExtension.addToMap(idResult, {polygonOptions: { clickable: false}}); } function clearResults() { mapExtension.removeFromMap(overlays); gmap.closeInfoWindow(); } function hasErrorOccurred(error) { if (error) { alert("Error " + error.code + ": " + (error.message || (error.details && error.details.join(" ")) || "Unknown error" )); return true; } return false; } function showAdmin(layer){ debugger var arr = []; arr[0]=dynamicMap.layerInfos[0]; arr[1]= dynamicMap.layerInfos[1]; if(document.getElementById('Ward').checked==true){ dynamicMap.setVisibleLayers(arr[0]); dynamicMap.refresh(); } if(document.getElementById('Assembly').checked==true){ dynamicMap.setVisibleLayers(arr[1]); dynamicMap.refresh(); } identifyTask = new esri.arcgis.gmaps.IdentifyTask("http://map2.janaagraha.org/arcgis/rest/services/IJ_Google/MapServer"); GEvent.addListener(gmap, "click", identify); } </script> </head> <body onload="initialize();" onunload="GUnload();"> <div id="mainWindow" style="width: 100%; height: 100%;"> <form action="#" onsubmit="showAddress(this.address.value); return false"> <div id="header"> <span>Bangalore /</span><span id="subheader"> Select your location to get more information</span> <input type="text" size="60" name="address" value="Walton road" style="width: 146px; height: 24px;"/> <input type="submit" value="Search!" /> </div> </form> <div id="accordion2"> <dl class="accordion2" id="slider2"> <dt>Find Complaints</dt> <dd> <span>This lightweight (1.2 KB) JavaScript accordion can easily be customized to integrate with any w</span> </dd> <dt>Find Civic Agency</dt> <dd> <span>To initialize an accordion use the following code:<br /><br /> <code> var mySlider=new accordion.slider("mySlider"); <br />mySlider.init("slider2",0,"open"); </code><br /><br /> The init function takes 3 parameters: the id of the "dl", the location of the initially expanded section (optional) and the class for the active header (optional). </span> </dd> <dt>Administrative Divisions</dt> <dd> <input id="Ward" type="radio" name="group1" value="Wards" onclick="showAdmin(document.getElementById('Ward').id);"/>Wards<br/> <input id="Assembly" type="radio" name="group1" value="AC" onclick="showAdmin(document.getElementById('Assembly').id);"/>Assembly Constituency </dd> </dl> </div> <div id="gmap" class="shadow" style="width: 1260px; height: 790px"> </div> </div> <script type="text/javascript"> var slider2=new accordion.slider("slider2"); slider2.init("slider2",0,"open"); </script> </body> </html>
... View more
12-07-2011
11:05 PM
|
0
|
0
|
606
|
POST
|
Hello All, I am new to this javascript API. I have a dynamic map service with 2 layers. I want to make visible one layer at a time on click of corresponding radio button.If one layer is visible the other should automatically be turned off and vice versa. How do i do this.. Please share with me some sample so that I can proceed ahead with some logic. Thanks, Tanya
... View more
12-07-2011
12:23 AM
|
0
|
9
|
1060
|
POST
|
Hi all, Does anyone know the formula to convert webmercator to geographic coordinates Thanks, Tanya Bisen
... View more
12-06-2011
01:32 AM
|
0
|
4
|
2240
|
POST
|
Hi Ivan, It worked. Thanks a ton... Basically I have 2 events: mouseover and mapclick and I want to show the button only on mapclick event. Thats the reason I asked if i can access the id of a button defined in skin into the main application
... View more
12-06-2011
01:30 AM
|
0
|
0
|
286
|
POST
|
Hi ibespalov, Ok..I have done that..I need to call the button which is defind in a skin to the main application. I am not able to access it. Thanks, Tanya
... View more
12-05-2011
07:04 PM
|
0
|
0
|
286
|
POST
|
private function onMouseOverHandler(event:MouseEvent):void { var gr:Graphic = Graphic(event.target); textArea.visible=true; gr.symbol = mySymbol; textArea.htmlText = " <b><font color='#0000FF'>Ward No. " + " #" + gr.attributes.Ward_No.toString()+ "</font></b>" + "\n" + " " + gr.attributes.Ward_Name.toString()+ "\n" + " Bengaluru,Karnataka" ; myMap.infoWindow.closeButtonVisible = false; myMap.infoWindow.content = textArea; myMap.infoWindow.label = " " + FlexGlobals.topLevelApplication.parameters.username; myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY)); }
... View more
12-05-2011
06:50 PM
|
0
|
0
|
356
|
POST
|
Hi Sera, as far as I understood your problem you do not need to show the data cumulatively..If you set your timslider property as singleThumbAsTimeInstant=true..it displays data one by one.. I hope this helps. Regards, Tanya
... View more
12-05-2011
02:48 AM
|
0
|
0
|
433
|
POST
|
Hello All, Can somebody help me with adding a button inside an Infowindow.. Thanks, Tanya
... View more
12-05-2011
02:37 AM
|
0
|
5
|
758
|
POST
|
Hello All, I am using a mouse over event on my graphic. but I am facing a flicker issue of my infowindow if i move the position of a mouse a bit. My infowindow starts flickering.. Do i have to add some tolerance to the infowindow.. I am lost. Please help me
... View more
11-15-2011
09:17 PM
|
0
|
5
|
3055
|
POST
|
Yes I agree with you.. Timing and experience really counts.. 🙂 🙂 Thanks again. Regards, Tanya
... View more
11-14-2011
07:54 PM
|
0
|
0
|
58
|
POST
|
Thanks Robert.. It works.. but can you please explain as to why when I was giving the the same update end event in mxml it didnt work but you just made few chnages in actionscript and it worked.. Would love if you can explain me that concept. Thanks again
... View more
11-13-2011
05:37 PM
|
0
|
0
|
437
|
POST
|
Hello Dasa, I tried using updateEnd event but for me the map zooms to the location and zooms out immediately. I am not understanding what could be the issue.Here is my code: private function initApp():void{ if(FlexGlobals.topLevelApplication.parameters.ward_number != undefined){ fLayer.definitionExpression = "Ward_No = " + FlexGlobals.topLevelApplication.parameters.ward_number; } } private function zoomToExtent(event: Event) : void { var graphicProvider:ArrayCollection = fLayer.graphicProvider as ArrayCollection; var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(graphicProvider.toArray()); myMap.extent = graphicsExtent.expand(1.1); // zoom out a little } <esri:FeatureLayer id="fLayer" graphicAdd="fLayer_graphicAddHandler(event)" load="{initApp()}" symbol="{mySymbol}" updateEnd="zoomToExtent(event)" mode="snapshot" outFields="[Ward_No,Ward_Name]" url="http://124.153.103.152/ArcGIS/rest/services/Find_your_Ward/MapServer/0"/>
... View more
11-10-2011
09:17 PM
|
0
|
0
|
437
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|