|
POST
|
I started one of my major projects using AMD, and I would highly recommend to use AMD if using v3.6 api with the following reasons. With AMD style which will load the modules asynchronously, the initial loading performance will be greatly increased. All JSAPI events are following dojo/on event mechanism now. AMD will be enforced since dojo 2.0. Dojo is reaching v1.9 now, one more release away from 2.0! The issue that your module may not work since one of the dependecies is not loaded won't exist if using AMD. Minimize global variable usage. and much more... I can tell ESRI JSAPI team is working hard to make the conversion including the samples. There are some work for the improvement though for the JSAPI team especially on the documentation. I found out that when clicking any event handler (onLayerAddResult) link on AMD style, it won't work. I will have to switch to legacy event style to access the description. Here are some references: https://developers.arcgis.com/en/javascript/jshelp/inside_dojo_amd.html http://dojotoolkit.org/documentation/tutorials/1.9/modules/ http://addyosmani.com/writing-modular-js/
... View more
08-29-2013
06:44 AM
|
0
|
0
|
1710
|
|
POST
|
I don't think you can hide the highway labels if it's there since all the basemaps including the world street map are cached/tiled map services. What you can do is to use other basemap, like Topographic (http://www.arcgis.com/home/item.html?id=6e03e8c26aad4b9c92a87c1063ddb0e3) or Light Gray Canvas (http://www.arcgis.com/home/item.html?id=8b3b470883a744aeb60e5fff0a319ce7).
... View more
08-29-2013
06:27 AM
|
0
|
0
|
1507
|
|
POST
|
performIntersect(featureSet): What is featureSet? If an array of graphics, that's fine. If the same as a query result, then the code is incorrect. Should be var geomSet = dojo.map(featureSet.features, function(aFeature) { return aFeature.geometry;}); esri.getGeometries should be esri.graphicsUtils.getGeometries. //get geometry from the graphic drawn by user on map var geomDraw = esri.getGeometries(map.graphics.graphics); //call the geometry intersect geomService.intersect(geomSet, geomDraw, showIntersect); getGeometries will return a geometry array, but the second parameter of geomService.intersect should be a single geometry, not a geometry array. Please refer to https://developers.arcgis.com/en/javascript/jsapi/geometryservice-amd.html#intersect.
... View more
08-28-2013
07:31 PM
|
0
|
0
|
1439
|
|
POST
|
Assuming you save both the table and the asset feature class in a geodatabase. Create a relationship class to link the two together. Then load both the table and the feature class in ArcMap, and publish them. Once published, you should see a Relationships section of the layer or table page at the bottom. Here is the code snippet of how to query the table based on the result from the feature layer. The code is to query the feature layer based on the asset name, and only return ObjectIDs for better performance. Then use the returned object ids to query the related work order table. If you like to highlight the features returned from the feature layer, you can use fl.selectFeatures method to replace fl.queryIds. In this case, you will make sure to return ObjectID field whose value will be used to query the related records.
function queryAsset() {
var fl = new esri.layers.FeatureLayer("feature layer rest url");
var q = new esri.tasks.Query();
q.where = "ASSET_NAME = 'SomeValue'";
fl.queryIds(q, function(objIds) {
var relatedQuery = new esri.tasks.RelationshipQuery();
relatedQuery.outFields = [list of output fields];
relatedQuery.relationshipId = 1; // relationship id showing on the service explorer.
objectIds = objIds;
fl.queryRelatedFeatures(relatedQuery, processRelatedRecords);
});
}
function processRelatedRecords(relatedRecords) {
// relatedRecords should be the work order records in your case
// process them as you like.
}
... View more
08-28-2013
10:20 AM
|
0
|
0
|
853
|
|
POST
|
Now I may have to admit that the spatial view may cause some query issue. Can you make spatial query against the layer in ArcMap? Another option would be to keep the feature class and the work order table on their own and build a relationship between them in MXD and publish again. In your code, you can first query the feature class by the click location, and then query the work order table based on the returned feature class ObjectIDs. Display the work order in the popup then.
... View more
08-28-2013
09:01 AM
|
0
|
0
|
853
|
|
POST
|
Try the two tests in a browser window. http://10.1.22.31/arcgis/rest/services/test/vw_regional_drainage/MapServer/0/query?f=json&returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry={"xmin":2149211.2547150566,"ymin":647347.9033248299,"xmax":2149974.8437035126,"ymax":648111.4923132863,"spatialReference":{"wkid":3734}}&geometryType=esriGeometryEnvelope&inSR=3734&outFields=ASSET_NAME,ASSET_TYPE&outSR=3734&callback=dojo.io.script.jsonp_dojoIoScript2._jsonpCallback http://10.1.22.31/arcgis/rest/services/test/vw_regional_drainage/MapServer/0/query?f=json&returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry={"x":2145918.8909744024,"y":610092.0131329745,"spatialReference":{"wkid":3734}}&geometryType=esriGeometryPoint&inSR=3734&outFields=ASSET_NAME,ASSET_TYPE&outSR=3734&callback=dojo.io.script.jsonp_dojoIoScript2._jsonpCallback
... View more
08-28-2013
08:25 AM
|
0
|
0
|
853
|
|
POST
|
ok...I am pretty sure that the issue lies on the extent used to make the query. Please provide me two things. layer0 extent the extent used to make the query
... View more
08-28-2013
07:38 AM
|
0
|
0
|
853
|
|
POST
|
Which layer do you want to query? In your code, it's the layer 0 fed into the queryTask. But in your last post, you queried against the layer 3.
... View more
08-28-2013
07:26 AM
|
0
|
0
|
853
|
|
POST
|
You said in your first post that you can run the query from the rest endpoint. How did you do that? If you can get result back from the rest endpoint, the query should work then. JSAPI is built upon REST API. I don't think the issue is related to the popup. Popup is just a data viewer. The issue is whether you can query the feature layer and get something back. Run a query against the REST endpoint directly with the following url, and see if it returns anything. http://10.1.22.31/arcgis/rest/services/test/stormwater_wo_rd/MapServer/0/query?where=1%3D1&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&f=pjson
... View more
08-28-2013
06:58 AM
|
0
|
0
|
1158
|
|
POST
|
I think I find the cause. Change: q.outSpatialReference = { "wkid": 3734 }; To: q.outSpatialReference = new esri.SpatialReference({ "wkid": 3734 });
... View more
08-27-2013
12:56 PM
|
0
|
0
|
1158
|
|
POST
|
TO my understanding, there is no single WHERE clause you can apply to accomplish what you want. You might end up with two queries: first to filter the related table based on its where clause; once returned, use its result to query the feature layer based on the related record ids and the where clause for the feature layer. Then you can process the result the way you like. Don't try to query the feature layer first; otherwise, you will end up with more queries. require([ "esri/tasks/Query", "esri/tasks/QueryTask", "esri/tasks/RelationshipQuery" ], function(Query, QueryTask, RelationshipQuery) { var queryTask = new QueryTask("related data url"); var query = new Query(); query.where = "where clause to filter the related data"; queryTask.executeForIds(query,function(relDataIds){ var relQuery = new RelationshipQuery(); relQuery.definitionExpression = "where clause to filter the feature"; relQuery.objectIds = relDataIds; relQuery.relationshipId = 3; relQuery.returnGeometry = true; queryTask.executeRelationshipQuery(relQuery, function(featureSet) { // do whatever you like to process the final result }); }); });
... View more
08-27-2013
12:26 PM
|
0
|
0
|
701
|
|
POST
|
Below change is based on Ken's version which is using AMD style and JSAPI v3.6. If you use AMD style, the change will be straightforward, just change the url for esri.css and JSAPI. If you like to use the non-AMD style, here is the changes to the head section. <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>Simple Map</title>
<link rel="stylesheet" href="https://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/esri/css/esri.css">
<style>
html, body, #map
{
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body
{
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}
.my_button
{
position: absolute;
z-index: 100;
left: 10px;
bottom: 10px;
}
</style>
<script src="https://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.5"></script>
<script>
dojo.require("esri.map");
var map, extent;
dojo.addOnLoad(function() {
map = new esri.Map("map", {
basemap: "topo",
center: [-122.45, 37.75], // long, lat
zoom: 13,
sliderStyle: "small"
});
map.on("load", function () {
extent = map.extent;
});
});
function zoomFunction() {
map.setExtent(extent);
}
</script>
</head>
... View more
08-27-2013
10:35 AM
|
0
|
0
|
2839
|
|
POST
|
Try this. function initSelectToolbar(map) {
selectionToolbar = new esri.toolbars.Draw(map);
var selectQuery = new esri.tasks.Query();
selectQuery.returnGeometry = true;
dojo.connect(selectionToolbar, "onDrawEnd", function (geometry) {
selectionToolbar.deactivate();
selectQuery.geometry = geometry;
featureSLayer.selectFeatures(selectQuery, esri.layers.FeatureLayer.SELECTION_NEW, generateServiceArea);
});
}
function generateServiceArea(featureSet) {
params.facilities = featureSet; // assume params is a global variable
// assume serviceAreaTask is defined as a global variable somewhere else
serviceAreaTask.solve(params, function (solveResult) {
var polygonSymbol = new esri.symbol.SimpleFillSymbol(
esri.symbol.SimpleFillSymbol.STYLE_SOLID,
new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([232, 104, 80]),
2
),
new dojo.Color([232, 104, 80, 0.25])
);
dojo.forEach(solveResult.serviceAreaPolygons, function (serviceArea) {
serviceArea.setSymbol(polygonSymbol);
map.graphics.add(serviceArea);
var query = new esri.tasks.Query();
query.geometry = serviceArea.geometry;
var symbol = new esri.symbol.SimpleMarkerSymbol();
symbol.style = esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE;
symbol.setSize(8);
symbol.setColor(new dojo.Color([255, 255, 0, 0.5]));
featureSLayer.setSelectionSymbol(symbol);
dojo.byId('messages').innerHTML = "<b>Selecting Features...</b>";
featureSLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
});
});
}
... View more
08-27-2013
10:10 AM
|
0
|
0
|
802
|
|
POST
|
Are you sure the extent fed in the request will intersect with some features? What is the feature type of the query layer? Increase the pad value to some big value for test, like 10000, and see if something returns.
... View more
08-27-2013
09:46 AM
|
0
|
0
|
1158
|
|
POST
|
dojo.io.script.jsonp_dojoIoScript2._jsonpCallback({"displayFieldName":"NAME","fieldAliases":{"ASSET_NAME":"ASSET_NAME","ASSET_TYPE":"ASSET_TYPE"},"geometryType":"esriGeometryPolyline","spatialReference":{"wkid":102722,"latestWkid":3734},"fields":[{"name":"ASSET_NAME","type":"esriFieldTypeString","alias":"ASSET_NAME","length":15},{"name":"ASSET_TYPE","type":"esriFieldTypeString","alias":"ASSET_TYPE","length":25}],"features":[]}); The above is just the result of the feature layer REST endpoint, not the query result. In addition to the change of returnGeometry, you also need to change outFields as shown in my previous post. What's the value of result returned from qt after making all these changes? If qt returns nothing, then in Chrome Developer Tools, under Network tab, look for the query request starting with query?f=json.... Copy the whole request URL, and paste to the browser address. If you still get nothing, then something wrong with the request. Post the whole request URL if you like.
... View more
08-27-2013
08:13 AM
|
0
|
0
|
1158
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-17-2013 05:16 AM | |
| 1 | 11-06-2013 04:34 AM | |
| 1 | 08-29-2013 10:58 AM | |
| 6 | 10-20-2020 02:09 PM | |
| 1 | 11-20-2013 06:09 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-17-2024
08:41 AM
|