|
POST
|
Upon further experimentation and reviewing the SDK classes, it looks like AGX can really only support the part of the request to draw polygons. I don't see any way to perform a clip or intersect other than using an Analysis tool and if I understand it correctly Analysis tools have to be GP services from ArcGIS server right? This won't work for my needs as the application will need to be used in remote locations with no connectivity. Has anyone else tried to create functions for AGX that basically mimic the standard methods if ITopologicalOperator (e.g. buffer, clip, intersect, union). If so can you share some code or point me to links? Thanks again, Terry
... View more
11-19-2010
08:04 AM
|
0
|
0
|
354
|
|
POST
|
Final post on this I swear! Fixed it - issue is with the SimpleMarkerSymbol, not sure what and not something I can fix. I switched my graphics to use a PictureMarkerSymbol instead and works great. Also, I did find more info on whether or not all 4 parameters are required when creating a Graphic. According to the Graphics topic in the API Concepts, not all 4 are required - Graphics are not required to have all of the above items, and no one item is required Hope this helps someone else, Terry
... View more
11-17-2010
09:40 AM
|
0
|
0
|
1385
|
|
POST
|
Thanks for the link; hopefully that error has been fixed in dojo by now. Here's some more fun I've discovered - I set displayGraphicsOnPan to false on my map and tried again. The graphic still disappears the 2nd time, but if I zoom out 2 levels (not 1 but 2) the graphic appears and panning the map works correctly without error. This magic zoom out trick doesn't work if I don't set displayGraphicsOnPan to false though. Just weird... I've also tried adding a graphics layer to the map and putting the graphics there instead of in map.graphics but it's still the same. I've tried using map.CenterAt(pt); map.setLevel(12); instead of map.centerAndZoom(pt,12) but that resutls in no graphics being added. Here's my work around for the time being..
if (dojo.isIE) {
map.centerAndZoom(pt, zoomLevel);
map.setLevel(zoomLevel -2 );
map.setLevel(zoomLevel);
}
else {
map.centerAndZoom(pt, zoomLevel);
}
hopefully I can find something better as this slows the map down while downloading tiles 2x..
... View more
11-17-2010
06:33 AM
|
0
|
0
|
1385
|
|
POST
|
You have to set some sort of symbol for the graphics being added to the map. What if you change defaultSymbol to be transparent? dojo colors can be constructed with an alpha paramter ranging from 0 = transparent to 1.0. new dojo.Color([r,g,b,a]) defaultSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([0,0,255,0]));
... View more
11-17-2010
05:23 AM
|
0
|
0
|
418
|
|
POST
|
Thanks for the suggestion on the graphics constructor, but that does not fix the problem either. I added attributes and an infoTemplate
var attr = { "XCoord": pt.x, "YCoord": pt.y};
var info = new esri.InfoTemplate("title","Latitude: ${YCoord} <br/> Longitude: ${XCoord}");
var graphic = new esri.Graphic(pt, sms, attr, info);
but still get the same behavior. On a side note, if anyone from ESRI is reading, are all 4 parameters required when creating a graphic? The help says it is but also says A Graphic can contain geometry, a symbol, attributes, or an infoTemplate. The wording on that, at least to me, implies some optionality. Also if you look at the ESRI samples several only use a geometry and symbol when creating graphics. Thanks again for the suggestion, Terry
... View more
11-17-2010
05:09 AM
|
0
|
0
|
1385
|
|
POST
|
Paul, Thanks for the suggestion. I ran it through JSLint but it didn't help me figure out what's going on. I started removing pieces of code and have it down to pretty much nothing and it still happens. The code below just has one anchor tag and a map in the page and I'm getting the same behavior as before - 1st time it works, the 2nd time you click the link, graphics disappear & it throws the 'invalid string in vector 2D' error if you try to pan/zoom out. Any other thoughts? Thanks, Terry
<!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=EmulateIE7" />
<title> Demo </title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.0/js/dojo/dijit/themes/tundra/tundra.css" />
<style type="text/css">
html, body {
height: 100%; width: 100%; margin: 0;
}
body{
background-color:white; overflow:hidden;
font-family: "Trebuchet MS";
}
#mapDiv
{
height: 100%; width: 100%; margin: 0;
}
</style>
<script type="text/javascript">
var djConfig = {
parseOnLoad: true
};
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0">
</script>
<script type="text/javascript">
dojo.require("esri.map");
//global for the Map
var map;
//globals for various map services
var PhotoMap = new esri.layers.ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/I3_Imagery_Prime_World_2D/MapServer", { id: "Photo" });
function init() {
map = new esri.Map("mapDiv");
map.addLayer(PhotoMap);
}
function clickLink() {
//generic handler for all of the links in the student list
var pt = new esri.geometry.Point(getRandomCoord('x'), getRandomCoord('y'), new esri.SpatialReference({ wkid: 4326 }));
var sms = new esri.symbol.SimpleMarkerSymbol();
var graphic = new esri.Graphic(pt, sms);
map.graphics.add(graphic);
map.centerAndZoom(pt, map.getNumLevels() - 3);
}
function getRandomCoord(axis) {
switch (axis) {
case 'x':
return (Math.random() * -179);
case 'y':
return (Math.random()* 80) ;
default:
return -20.0;
}
}
//show map on load
dojo.addOnLoad(init);
</script>
</head>
<body class="tundra">
<a href ='' title='' onclick='clickLink();return false'>click me</a><br/>
<div id="mapDiv" ></div>
</body>
</html>
... View more
11-16-2010
07:28 AM
|
0
|
0
|
1385
|
|
POST
|
I have a series of anchor tags in a panel next to my map, each the name of a person. The map contains just the ESRI street map service and points in the map's graphicslayer that are the person's location (not dynamic, just hard coded x,y). When you click one of the name <a> tags, it should zoom the map to their location and display the info window. This works great in Firefox, but IE 7 does 2 things - the graphics disappear from the map & if you try to pan the map or zoom out it throws an error about 'illegal string in Vector 2d' (see attached). Any idea what's causing this and how to fix it (other than not using IE...)? note - I added a demo version of html page to this post. Try it in IE - click on Person 1 in the left and it will work. Now click on Person 2 and you'll notice the graphic is gone and if you try to pan you'll get the error.. The Esri forums do not allow for uploading .htm files so rename it from .txt to .htm and give it a try. Thanks, TG sample html <a> tag - <a href ='' title='some name' onclick='clickLink(1);return false;' >some name</a>
//in my init function, the maps extent changed handler is set using
dojo.connect(map, 'onExtentChange', Extent_Change);
function clickLink(id) {
//generic handler for all of the links in the student list
map.infoWindow.hide();
var graphic;
dojo.forEach(map.graphics.graphics, function (g) {
if (g.attributes["ID"] == id)
{
graphic = g;
}
});
//tmpGraphic and bolClickLink are global in scope
tmpGraphic = graphic;
bolClickLink = true;
map.centerAndZoom(graphic.geometry, map.getNumLevels()-3);
}
function Extent_Change(ext, delta, bolLevel,lod) {
var e = new Object;
if (bolClickLink) {
e.graphic = tmpGraphic;
e.screenPoint = map.toScreen(tmpGraphic.geometry);
e.mapPoint = tmpGraphic.geometry;
graphicClick(e);
}
bolClickLink = false;
}
function graphicClick(evt) {
map.infoWindow.setTitle("Flat Stanley");
map.infoWindow.setContent(evt.graphic.attributes["Name"] + "<br/>" + evt.graphic.attributes["Place"]);
map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
}
... View more
11-15-2010
11:59 AM
|
0
|
20
|
3280
|
|
POST
|
I'm new to AGX but have experience developing both Desktop tools and Server applications in .Net. I have a client who is interested in drawing polygons in AGX, intersect them with an existing landownership layer (shapefile on disk) and then doing some basic area reporting. They'd also like to be able to save the results as a shapefile so it can be passed off to other apps (which only seem to support shapefile input). Looking at the SDK, blogs, and forums the 1st part of this seems possible, but it doesn't look like I can create a shapefile through the SDK. Build 1500 has the ability to save graphics out as a layer package which in reality is a Zip file containing a file geodatabase. Is it possible to use other ESRI interfaces/libraries such as esri.arcgis.geodatabase.IFeatureWorkspace::CreateFeatureClass to make a shapefile and then iterate through the polygons/rings the user drew and create features in the shapefile (I'm assuming a polygon in the AGX sdk cannot be directly cast to a esri.geometry.polygon)? A couple of side notes - this will be done in the field with no internet access so I can't use ArcGIS Server GP services or online data; ArcGIS Desktop is not installed on the field laptop. Any suggestions, comments, thoughts would be greatly appreciated. Thank You, Terry
... View more
11-12-2010
08:43 AM
|
0
|
3
|
756
|
|
POST
|
When in doubt as a database person.... I set the SubFields on the QueryFilter used to generate the FeatureCursor passed to the FeatureIndex to just the FID and Shape. 14 seconds is now 2. Hope this helps someone else!
if (fids.Count > 0)
{
//skip those already found
strWhere = FLayer.FeatureClass.OIDFieldName + " not in (";
for (int i = 0; i < fids.Count; i++)
{
strWhere += fids.ToString() + ",";
}
strWhere = strWhere.Remove(strWhere.Length-1) + ")"; //trailing comma
QFilt.SubFields = FLayer.FeatureClass.OIDFieldName + "," + FLayer.FeatureClass.ShapeFieldName;
QFilt.WhereClause = strWhere;
idxFeat.FeatureCursor = (IFeatureCursor) FLayer.FeatureClass.Search(QFilt,false);
}
... View more
11-03-2010
01:00 PM
|
0
|
0
|
351
|
|
POST
|
I'm trying to find the 5 closest (point) features to an address returned from a geocoding service. The code has to work with an ArcView license (version 9.3.1) so I cannot use GP tools like Near or PointDistance. I'm using IFeatureIndex and IIndexQuery to get the nearest feature to my geocoded point but am looking for some advice on speeding things up. In the code below, for the 1st pass I just use the whole featureclass for the index on the FeatureIndex (idxFeat). In subsequent attempts I filter out those already found using a queryfilter & a featurecursor on the FeatureIndex. This works but the 1st indexing (against the whole FC) takes 3 seconds each additional pass takes 14 seconds. Anyone see any way I could speed this up or know of a better way? Thanks, Terry
envQryLimit.CenterAt(ptAddrGeo); //ptAddrGeo = geocoded pt in WGS84 coords
IQueryFilter QFilt = new QueryFilterClass();
string strWhere = "";
idxFeat.set_OutputSpatialReference(FLayer.FeatureClass.ShapeFieldName, srWGS84);
idxFeat.FeatureClass = FLayer.FeatureClass;
int fid;
double dist;
IList<Int32> fids = new List<Int32>();
do
{
if (fids.Count > 0)
{
//skip those already found
strWhere = FLayer.FeatureClass.OIDFieldName + " not in (";
for (int i = 0; i < fids.Count; i++)
{
strWhere += fids.ToString() + ",";
}
strWhere = strWhere.Remove(strWhere.Length-1) + ")"; //trailing comma
QFilt.WhereClause = strWhere;
idxFeat.FeatureCursor = (IFeatureCursor) FLayer.FeatureClass.Search(QFilt,false);
}
System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString());
idxFeat.Index(null, envQryLimit);
System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString());
idxQry.NearestFeature(ptAddrGeo, out fid, out dist);
if (!(fids.Contains(fid)))
{
fids.Add(fid);
}
} while (fids.Count < 5); //5 is the # of points needed
... View more
11-02-2010
06:42 AM
|
0
|
1
|
2235
|
|
POST
|
Hi Ali, I tried your suggestions but I cannot change the security settings for the local intranet - it's controlled by policy and the 'custom settings' button is greyed out. Just unchecking the integrated windows auth on the Advanced tab made no difference. Any other ideas? Could it be a setting on the server? Thanks again for the help, Terry
... View more
11-01-2010
06:19 AM
|
0
|
0
|
910
|
|
POST
|
Hi Ali, Does the service URL in your identify task require a ProxyUrl? I do not believe so as the security on that server is set using Windows authentication (as is my app and the Rest enpoint). Last week while working on this I set up a proxy page and tried using it for this IdentifyTask but still get the same result - can see valid JSON results in Fiddler but args.IdentifyResult is empty. I did modify the proxy page to use the current user's credentials as suggested by another forum post ( I added webRequest_401.UseDefaultCredentials = true; in the getCredentials routine). The only difference in using the proxy page was that Fiddler did not display the 401 result prior to 2nd response but that's what the proxy page is for right? When you sumbit an identify request to that URL is the browser prompting you for a username and password (just to make sure you have correct permission to the service)? How about the SL application you wrote? Does it also prompt for authentication when you clicked on the map? No password prompt when I try to run the Identify from the web browser & correct results are returned. No password prompt when the layer is added to the map (added via code at runtime) or when I click in it. Thank you Ali, Terry
... View more
10-29-2010
09:36 AM
|
0
|
0
|
910
|
|
POST
|
Any chance either of you can help with my Identify issue that I described here? Basically similar sitiuation to David's - running an identify against a layer with a different projection than the map but args.Identify results is NULL even though a) the spatial reference is set for the IdentifyTask and b) I can see correct results coming back in Fiddler. Thanks, Terry
... View more
10-29-2010
05:30 AM
|
0
|
0
|
446
|
|
POST
|
I'm still stuck on this. Below is the response that I see in Fiddler, but yet args.IdentifyResults are still null in the IdentifyTask_ExecuteCompleted routine. {"results":[{"layerId":1,"layerName":"Section Center","value":"W25N4934","displayFieldName":"TRS","attributes":{"OBJECTID":"31","Shape":"Point","TDIR":"W","TWNSHP":"25","RDIR":"N","RNG":"49","SECTION_":"34","TR":"W2549","TRS":"W25N4934"}},{"layerId":2,"layerName":"Section","value":"W25N4934","displayFieldName":"TRS","attributes":{""Object ID"":"31","Shape":"Polygon","TDIR":"W","TWNSHP":"25","RDIR":"N","RNG":"49","SECTION_":"34","TR":"W2549","TRS":"W25N4934"}}]} Thanks again, Terry
... View more
10-25-2010
09:04 AM
|
0
|
0
|
910
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-15-2016 03:27 PM | |
| 1 | 01-14-2016 09:55 AM | |
| 2 | 12-14-2012 09:38 AM | |
| 2 | 10-23-2017 01:22 PM | |
| 3 | 01-15-2013 07:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-17-2024
08:14 PM
|