POST
|
it maybe well ,if it is a identify task with one return feature, but if it is a query task with many return feature view on the map how to get the each feature by the button click in the each infowindow ?
... View more
10-25-2012
07:32 AM
|
0
|
0
|
367
|
POST
|
Today i add the code "dojo.require("esri.diji.Popup");" it get the error "xhrFailed" IN IE 8 I put the api in the local computer, what't wrong ?????????1!!!!!!!!!!
<!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" />
<!--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>QueryTask with query geometry from another task</title>
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.1/jsapi/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.1/jsapi/js/esri/dijit/css/Popup.css">
<script type="text/javascript">var dojoConfig = {parseOnLoad: true};</script>
<script type="text/javascript" src="http://localhost/arcgis_js_api/library/3.1/jsapi/"></script>
<script type="text/javascript">
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.tasks.query");
dojo.require("esri.tasks.geometry");
dojo.require("esri.diji.Popup");
var map;
/*Initialize map, buffer, & query params*/
function init() {
// var popup = new esri.dijit.Popup(null, dojo.create("div"));
// 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":542658.416722138,"ymin":72762.5001166421,"xmax":690341.583278327,"ymax":165987.499005236});
map = new esri.Map("mapDiv", { });
//listen for when map is loaded and then add query functionality
dojo.connect(map, "onLoad", initFunctionality);
var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "jpeg"; //set the image type to PNG24, note default is PNG8.
// dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost/ArcGIS/rest/services/ditu/MapServer", {"opacity":1, "imageParameters":imageParameters});
var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost/arcgis/rest/services/TuJB5/MapServer", {"opacity":1, "imageParameters":imageParameters});
map.addLayer(dynamicMapServiceLayer);
}
function initFunctionality(map) {
var queryTask = new esri.tasks.QueryTask("http://localhost/arcgis/rest/services/TuJB5/MapServer/1");
//identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters.
//If this null or not available the buffer operation will not work. Otherwise it will do a http post to the proxy.
// esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";
// esri.config.defaults.io.alwaysUseProxy = false;
// Query
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["GEOOBJNUM"];
query.outSpatialReference = map.spatialReference;
var infoTempContent = ""
+ "<br/><A href='#' onclick='map.graphics.clear();getfeature();'>Remove Selected Features</A>";
//Create InfoTemplate for styling the result infowindow.
var infoTemplate = new esri.InfoTemplate("Block: ${GEOOBJNUM}", infoTempContent);
map.infoWindow.resize(275,190);
var currentClick = null;
// +++++Listen for map onClick event+++++
dojo.connect(map, "onClick", function(evt) {
map.graphics.clear();
map.infoWindow.hide();
currentClick = query.geometry = evt.mapPoint;
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
queryTask.execute(query);
dojo.byId('messages').innerHTML = "<b>Executing Point Intersection Query...</b>";
});
var firstGraphic = null;
// +++++Listen for QueryTask onComplete event+++++
dojo.connect(queryTask, "onComplete", function(graphics) {
firstGraphic = graphics.features[0];
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new dojo.Color([100,100,100]), 3), new dojo.Color([255,0,0,0.20]));
firstGraphic.setSymbol(symbol);
// firstGraphic.setInfoTemplate(infoTemplate);
map.graphics.add(firstGraphic);
// map.infoWindow.setFeatures([ graphics ]);
// map.infoWindow.show(currentClick );
});
}
function getfeature()
{
if(map.infoWindow.isShowing){
alert("have the feature")
// var loc = map.infoWindow.getSelectedFeature().geometry;
// var lg=loc.rings.length;
//alert(lg);
// if(!map.extent.contains(loc)){
// map.infoWindow.hide();
// }
}
else
{
alert("No the feature");
}
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
Click on map to select census block group that intersects the map click and all block groups that touch selected group.
<div id="mapDiv" style="width: 850px; height:500px; position:relative;"></div>
<span id="messages"></span>
</body>
</html>
... View more
10-25-2012
01:17 AM
|
0
|
1
|
2018
|
POST
|
how to get the selected feature by infowindow?? Just like map.infoWindow.getSelectedFeature() in the " esri.dijit.Popup"
<!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" />
<!--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>QueryTask with query geometry from another task</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/css/esri.css" />
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.tasks.query");
dojo.require("esri.tasks.geometry");
var map;
/*Initialize map, buffer, & query params*/
function init() {
var startExtent = new esri.geometry.Extent({"xmin":-13165918,"ymin":3997806,"xmax":-13149675,"ymax":4007360,"spatialReference":{"wkid":102100}});
map = new esri.Map("mapDiv", { extent: startExtent });
//listen for when map is loaded and then add query functionality
dojo.connect(map, "onLoad", initFunctionality);
var streetMap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
map.addLayer(streetMap);
}
function initFunctionality(map) {
var queryTask = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/1");
var queryTaskTouches = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/1");
//identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters.
//If this null or not available the buffer operation will not work. Otherwise it will do a http post to the proxy.
esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";
esri.config.defaults.io.alwaysUseProxy = false;
// Query
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["POP2000","POP2007","MALES", "FEMALES", "FIPS"];
query.outSpatialReference = {"wkid":102100};
var infoTempContent = "POP2007 = ${POP2007}<br/>POP2000 = ${POP2000}<br/>MALES = ${MALES}<br/>FEMALES = ${FEMALES}"
+ "<br/><A href='#' onclick='map.graphics.clear();getfeature();'>Remove Selected Features</A>";
//Create InfoTemplate for styling the result infowindow.
var infoTemplate = new esri.InfoTemplate("Block: ${FIPS}", infoTempContent);
map.infoWindow.resize(275,190);
var currentClick = null;
// +++++Listen for map onClick event+++++
dojo.connect(map, "onClick", function(evt) {
map.graphics.clear();
map.infoWindow.hide();
currentClick = query.geometry = evt.mapPoint;
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
queryTask.execute(query);
dojo.byId('messages').innerHTML = "<b>Executing Point Intersection Query...</b>";
});
var firstGraphic = null;
// +++++Listen for QueryTask onComplete event+++++
dojo.connect(queryTask, "onComplete", function(graphics) {
firstGraphic = graphics.features[0];
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new dojo.Color([100,100,100]), 3), new dojo.Color([255,0,0,0.20]));
firstGraphic.setSymbol(symbol);
firstGraphic.setInfoTemplate(infoTemplate);
map.graphics.add(firstGraphic);
});
}
function getfeature()
{
if(map.infoWindow.isShowing){
alert("have the feature")
var loc = map.infoWindow.getSelectedFeature().geometry;
var lg=loc.rings.length;
alert(lg);
// if(!map.extent.contains(loc)){
// map.infoWindow.hide();
// }
}
else
{
alert("No the feature");
}
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
Click on map to select census block group that intersects the map click and all block groups that touch selected group.
<div id="mapDiv" style="width: 850px; height:500px; position:relative;"></div>
<span id="messages"></span>
</body>
</html>
... View more
10-24-2012
11:32 PM
|
0
|
3
|
1669
|
POST
|
i get resultFeatures by querytask ,the the feature set InfoTemplate [HTML] for (var i=0, il=resultFeatures.length; i<il; i++) { var graphic = resultFeatures; graphic.setSymbol(symbol); graphic.setInfoTemplate(infoTemplate); map.graphics.add(graphic); } var infoTempContent = "POP2007 = ${POP2007}<br/>POP2000 = ${POP2000}<br/>MALES = ${MALES}<br/>FEMALES = ${FEMALES}" + "<br/><A href='#' onclick='getfeature()'>Remove Selected Features</A>"; var infoTemplate = new esri.InfoTemplate("Block: ${FIPS}", infoTempContent); [/HTML] how to get the feature by the click function of "'getfeature()" on the infoTemplate? i want to get the feature point colletions by the click function int on the infotemlate.
... View more
10-22-2012
05:00 PM
|
0
|
1
|
309
|
POST
|
the form of layout isn't Alignment In IE 8 ,what'r wrong ? [ATTACH=CONFIG]18602[/ATTACH] http://help.arcgis.com/en/webapi/javascript/arcgis/samples/framework_extjslayout/index.html
... View more
10-21-2012
08:24 AM
|
0
|
1
|
521
|
POST
|
I'm not going to do it all for you 🙂 But here's one approach, assume you've got a polygon (thePoly), perhaps it's the geometry property of a Graphic:
for(var i=0;i<thePoly.rings.length;i++){
console.log("Getting points from ring #" + i);
for(var j=0;j<thePoly.rings.length;j++){
console.log("Point #" + j + " x=" + thePoly.rings .x + " y=" + thePoly.rings .y);
}
}
//Could replace the access with a call to thePoly.getPoint(i,j) if you like which would return a copy of the Point rather than a reference to the actual Point
(haven't tested the code, just typed straight into this post, should be roughly right though) thank you , i have test the code it is failse to get x =thePoly.rings .x it is ok like var pt=thePoly.getPoint(i,j); var x=pt.x;
... View more
10-17-2012
05:11 PM
|
0
|
0
|
264
|
POST
|
Polygons are made up of rings, rings are made up of points. This same 'path' can be used following, for example, an Identify operation to get the points of a feature. thank you , can you give me a example with code? thank you very much
... View more
10-17-2012
04:51 AM
|
0
|
0
|
264
|
POST
|
how to get four point of Rectangle polygon with arcgis server for js
... View more
10-16-2012
08:15 PM
|
0
|
6
|
674
|
POST
|
when i put a extjs tree in the example http://help.arcgis.com/en/webapi/javascript/arcgis/samples/framework_extjslayout/index.html ,i click the node ,but can't work , what's wrong ? can u help? [HTML] <!DOCTYPE HTML> <head> <title> ExtJS Layout Example </title> <link rel="stylesheet" type="text/css" href="http://cdn.sencha.io/ext-4.0.7-gpl/resources/css/ext-all.css"/> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/css/esri.css" /> <style type="text/css"> html, body { font:normal 12px verdana; margin:0; padding:0; border:0 none; overflow:hidden; height:100%; } </style> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2compact" type="text/javascript"></script> <script type="text/javascript" charset="utf-8" src="http://cdn.sencha.io/ext-4.0.7-gpl/ext-all.js"></script> </script> <script type="text/javascript"> dojo.require("esri.map"); dojo.require("esri.layers.FeatureLayer"); dojo.require("esri.dijit.Popup"); dojo.require("dojo.number"); var map; //****************the tree that i add var yewuTree=new Ext.tree.TreePanel({ id:'ywtreepan', root:{ text:"1", expanded:true, id:"ee", children:[ { text:"2", expanded:true, children:[ { text:"3", id:"a", leaf:true }, { text:"4", id:"b", leaf:true } ] }, { text:"5", id:"cc", leaf:true, listeners:function(node) { alert("aaa"); } } ] } }) yewuTree.on("click", function(node) { alert("aaaa"); }); // yewuTree.getSelectionModel().getSelectedNode(); function init() { var viewport = new Ext.Viewport({ layout: "fit", title: "EXT JS Layout", items: [{ layout: "border", items: [{ region: "center", title: "center", html: "<div id='map' style='height:100%; width:100%;z-index=: 1000;'></div>" }, { region: "north", height: 50, collapsible: false, contentEl:"header" }, { region: "south", height: 80, collapsible: false, contentEl: "footer" // this gets the content from the div named "footer" }, { region: "west", title: "Left Panel", width: 150, split: true, collapsible: true, layout:'fit', items:yewuTree, // html: "Left panel content. This panel is collapsible and can be resized using the splitter", listeners:{ collapse: resizeMap, expand: resizeMap } }, { region: "east", width: 200, xtype: 'tabpanel', activeTab: 0, // index or id items:[{ title: 'Tab 1', html: 'This is tab 1 content.' },{ title: 'Tab 2', html: 'This is tab 2 content.' },{ title: 'Tab 3', html: 'This is tab 3 content.' }] }] }] }); var initialExtent = new esri.geometry.Extent({"xmin":-118.61,"ymin":34.34,"xmax":-118.09,"ymax":34.56,"spatialReference":{"wkid":4326}}); var popup = new esri.dijit.Popup(null, dojo.create("div")); map = new esri.Map("map", { extent: esri.geometry.geographicToWebMercator(initialExtent), infoWindow: popup }); dojo.connect(map, 'onLoad', function(theMap) { dojo.connect(window, 'resize', map, map.resize); }); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"); map.addLayer(basemap); var template = new esri.dijit.PopupTemplate({ title: "Geologic Outcrop", description:"{lithology_type} with the following metamorphic facies: {metamorphic_facies}" }); var featureLayer = new esri.layers.FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/Geology/MapServer/9",{ mode:esri.layers.FeatureLayer.MODE_SNAPSHOT, infoTemplate:template, outFields:["lithology_type","metamorphic_facies"] }); map.addLayer(featureLayer); } function resizeMap() { map.resize(); } dojo.addOnLoad(init); </script> </head> <body> <!-- use class="x-hide-display" to prevent a brief flicker of the content --> <div id="header"> <span>Header content goes here</span> </div> <div id="center" class="x-hide-display" style="z-index: 100;"> </div> <div id="props-panel" class="x-hide-display"> </div> <div id="footer" class="x-hide-display"> <span>Footer content goes here<span> </div> <div id="north" class="x-hide-display"> </div> </body> </html> [/HTML]
... View more
10-16-2012
09:23 AM
|
0
|
0
|
792
|
POST
|
the example of "ExtJS Layout" onlint can be view in the firefox. but i capy the same the code into the Notepad++, i can't view ,but can view in IE what't wrong?
... View more
09-10-2012
05:58 AM
|
0
|
1
|
656
|
POST
|
My arcgis Api for flex vesion is :2.5 arcigs server version is :10 flash builder version :4.6
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<esri:Geoprocessor executeComplete="gp_jobCompleteHandler(event)" showBusyCursor="true" id="gp" url="http://yanli/arcgis/rest/services/gp1/GPServer/polygon"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.esri.ags.FeatureSet;
import com.esri.ags.events.GeoprocessorEvent;
import com.esri.ags.layers.GPResultImageLayer;
import com.esri.ags.layers.supportClasses.ImageParameters;
import com.esri.ags.tasks.QueryTask;
import com.esri.ags.tasks.supportClasses.Query;
import com.esri.ags.tasks.supportClasses.JobInfo;
import mx.controls.Alert;
import mx.rpc.AsyncResponder;
import mx.rpc.events.FaultEvent;
private var jobid:String="";
private function gp_jobCompleteHandler(event:GeoprocessorEvent):void
{
if (event.jobInfo.jobStatus == JobInfo.STATUS_SUCCEEDED)
{
Alert.show("sueeseful!")
}
else
{
}
}
private function computesevice():void
{
var queryTask:QueryTask =new QueryTask("http://localhost/arcgis/rest/services/test/MapServer/0");
queryTask.showBusyCursor=true;
var query:Query=new Query();
query.outFields=new Array("OBJECTID","yuliang","name")
query.where="name<>''"
queryTask.execute(query,new AsyncResponder(onQueryResult,onQueryFalt));
function onQueryFalt(info:Object,token:Object=null):void
{
Alert.show(info.toString());
}
}
private function onQueryResult(featureset:FeatureSet,token:Object=null):void
{
var param:Object={"inputpoint":featureset};;
gp.execute(param);
}
]]>
</fx:Script>
<s:Button label="�?�?�GP" click="computesevice()"/>
<esri:Map y="30" id="myMap" width="100%" height="100%" >
<!-- <esri:extent>
<esri:Extent xmin="-95.41" ymin="38.86" xmax="-95.1" ymax="39.06">
<esri:SpatialReference wkid="4326"/>
</esri:Extent>
</esri:extent>-->
<esri:ArcGISDynamicMapServiceLayer url="http://localhost/arcgis/rest/services/test/MapServer"/>
<esri:GraphicsLayer id="graphicsLayer" />
</esri:Map>
</s:Application>
... View more
09-07-2012
06:29 PM
|
0
|
0
|
179
|
POST
|
<fx:Declarations>
<esri:Geoprocessor executeComplete="gp_jobCompleteHandler(event)" useAMF="false" showBusyCursor="true" id="gp" url="http://yanli/arcgis/rest/services/gp1/GPServer/polygon"/>
</fx:Declarations>
gp.execute(param); // error here!!!
when i chang the code with setting "URL" null ??the error is same .... but the param have the value,the GP server run well in the ArcMAP
<fx:Declarations>
<esri:Geoprocessor executeComplete="gp_jobCompleteHandler(event)" useAMF="false" showBusyCursor="true" id="gp" url=""/>
</fx:Declarations>
gp.execute(param); // error here!!!
I am carazing !!!!!!!!!!!!!!!now the error message as following: TypeError: Error #1009:Can not access a property or method of a null object reference??? at com.esri.ags.utils::GeometryUtil$/http://www.esri.com/2008/ags/internal::normalizeCentralMeridian2() at com.esri.ags.utils::GeometryUtil$/normalizeCentralMeridian() at com.esri.ags.tasks::Geoprocessor/toURLVariables() at com.esri.ags.tasks::Geoprocessor/execute() at test2/onQueryResult() at mx.rpc::AsyncResponder/result() at com.esri.ags.tasks::QueryTask/handleExecute() at Function/http://adobe.com/AS3/2006/builtin::call() at com.esri.ags.tasks::BaseTask/loaderCompleteHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete()
... View more
09-07-2012
07:22 AM
|
0
|
4
|
2434
|
POST
|
how to draw a line between two point as knows?
var point:MapPoint =new MapPoint(118.8021, 32.0702);
var point2:MapPoint =new MapPoint(118.8029, 32.0684);
how to draw a line ?
... View more
10-13-2011
06:45 AM
|
0
|
2
|
2984
|
Title | Kudos | Posted |
---|---|---|
1 | 09-02-2016 09:13 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|