POST
|
Forget cartographic lines. Here's what I use. Seems to work really well. The great thing is that since it's a text symbol, you can angle it.
//text symbol//
var arrow = function(pt1,pt2){
return new esri.symbol.TextSymbol({
text : "�?�",
angle: setAngle(pt1, pt2),
type: "esriTS",
color: new dojo.Color([0,0,255,0.5]),
font: {
size: 13,
style: 'normal',
type: 'font',
variant: "normal",
weight: "normal",
family: "Lucida Grande Console"
}
});
};
//grab points//
//loop over the points on your line//
for(var x in "[linename]".geometry.paths[0]){
var pt1 = "[linename]".geometry.paths[0] ;
var pt2 = "[linename]".geometry.paths[0][x-1];
var point = new esri.geometry.Point(pt1);
var arrowGraphic = new esri.Graphic(point, arrow(pt1,pt2));
//angle function//
var setAngle = function (p1, p2){
var rise = p2[1] - p1[1];
var run = p2[0] - p1[0];
var angle = ((180/Math.PI) * Math.atan2(run, rise))
return angle-180;
}
Hope this helps.
... View more
03-21-2013
06:57 AM
|
1
|
1
|
1700
|
POST
|
Did some digging, and found my answer- If you define your lines as cartographic lines in ArcMap, and proceed to call them in a feature layer on your client side javascript, the cartographic lines get "downgraded" to simple lines. ...Anyone out there find a workaround? Here's the passage and article: For line layers, simple line symbols are supported. If other symbols are used, the feature service downgrades them to simple line symbols. For example, a cartographic line symbol in the map document may be drawn as a simple solid line in a feature service client. Also, if a line symbol has multiple layers, the feature service considers only the top layer. Quote from article: http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#//009300000021000000
... View more
08-26-2012
09:03 AM
|
0
|
0
|
194
|
POST
|
Hi, I'm going crazy here. When I add a map as a FeatureLayer, the lines are rendered on top of each other (incorrect), however when added as a DynamicLayer, it's displayed just how it's displayed in ArcMap (correct). Here's my simple simple code:
var myURL = "http://..."
var fl = new esri.layers.FeatureLayer(myURL+ /layerIndex)
var dl = new esri.layers.ArcGISDynamicMapServiceLayer(myURL)
map.addLayer(fl)
map.addLayer(dl)
Please look at my attachments to get a better idea. You can ignore the red lines on dynamicLayer.png. What's important are the black lines. Thanks, Aaron
... View more
08-24-2012
06:43 AM
|
0
|
1
|
1520
|
POST
|
Hi, Does anyone know of a dynamic layer which contains a wire-frame/outline of US roadways/interstates? It would seem like something like this would be pretty common... Thanks, Aaron
... View more
05-30-2012
12:14 PM
|
0
|
0
|
631
|
POST
|
Hi, I'm not sure if this is the correct forum to post in- But I was looking for a map layer that contains lines/boundaries of US properties. My attachment is exactly what I'm looking for. (note: the attachment is a screenshot of zillow.com, which uses Bing maps I believe) Thanks! Aaron
... View more
05-29-2012
11:20 AM
|
0
|
3
|
5529
|
POST
|
@Jeff: I spent a solid hour digging through vml properties (which was my first notion to try, also), but found it to be too much work. Thanks for your suggestion. @Derek: I was weary of using setSymbol() at first, since similar methods like setWidth() and setStroke require you to refresh() the graphics layer to see changes , which terribly degrades IE 7/8 performance. However, much to my surprise setSymbol() does not require a refresh()!! Thanks for your help. Here's the finished few lines:
if( evt.type == "mouseenter"){//...if the event is mouseenter//
for(gfx in this.obj.graphics){//...loop the map graphics//
if (this.obj.graphics[gfx].geometry.type == "polyline"){//...if the graphic is a polyline//
this.gfx = this.obj.graphics[gfx]//...create a new reference for it//
if(this.gfx.symbol.width == 2){//....by default, the polyline's width is set to 2//
this.newSymbol = new esri.symbol.SimpleLineSymbol(this.gfx.symbol.style, this.gfx.symbol.color,8)//....create our new symbol with a new width of '8'//
this.gfx.setSymbol(this.newSymbol) //...set our newSymbol to this graphic//
}...
Derek and Jeff, thank you for your help!
... View more
05-24-2012
01:42 PM
|
0
|
0
|
381
|
POST
|
Derek, here's what I'm trying to accomplish: I'm using the Legend Dijit. When a user hovers over an item in the Legend Dijit (see attached), the corresponding map graphic becomes highlighted, or rather, it's stroke size increases. Step-by-step: (1) ...if a user mouseEnters on an item in the Legend Dijit if( evt.type == "mouseenter"){.... (2) ...loop over the map graphics for(gfx in this.obj.graphics){.... (3)...and, if this graphic is a polyline if (this.obj.graphics[gfx].geometry.type == "polyline"){... (4)...grab the polyline's corresponding DOM element: this.line = this.obj.graphics[gfx].getDojoShape().getEventSource() (5)...use jQuery's attr() method to access this DOM element's "stroke-width" value this.stroke = $(this.line).attr("stroke-width") Step 5 is the problem: this.stroke in IE 7/8 always returns undefined. Firefox/Chrome/Safari all return a value. I realized Step 5 is the problem by using alert(this.stroke) in IE 7/8, which pops up as "undefined". All other browsers display a value. Attachments: Firefox.png is what is supposed to occur (notice the polyline's increased stroke-width, when I hover on the legend dijit item (highlighted in dark grey)). IE.png is what is not supposed to occur (notice the polyline stroke does not increase) Hope this helps, Aaron
... View more
05-24-2012
08:58 AM
|
0
|
0
|
381
|
POST
|
this.line = this.obj.graphics[gfx].getDojoShape().getEventSource(); $(this.line).attr("stroke-width") This code returns the stroke-width value from the DOM element on a line on my map. If I use alert() to capture the object in IE 7/8, it displays as undefined. In firebug for Firefox/Safari/Chrome, they all display the correct value. Here is the code I've written so far (sorry it's a bit messy, I use jQuery for DOM manipulation, instead of destroying/adding new objects as dojo does): var legendPane = $('div#legendPane') $(legendPane).on("mouseenter mouseleave", "table.esriLegendLayer > tbody > tr", function(evt){ this.obj = $(this).data() if(typeof(this.obj) == "object"){ if( evt.type == "mouseenter"){ for(gfx in this.obj.graphics){ if (this.obj.graphics[gfx].geometry.type == "polyline"){ try{ this.line = this.obj.graphics[gfx].getDojoShape().getEventSource(); //////////////////////////////////////// ///////displays 'undefined' in IE///// /////////////////////////////////////// alert($(this.line).attr("stroke-width")) $(this.line).attr("stroke-width") == 2 ? $(this.line).attr("stroke-width", "8") : null; }catch (err){} }else if (this.obj.graphics[gfx].geometry.type == "point") { try { this.point = this.obj.graphics[gfx].getDojoShape().getEventSource(); $(this.point).attr("r") == "8" ? $(this.point).attr("r", "13") : null; $(this.point).attr("r") == "2.5" ? $(this.point).attr("r", "4") : null; } catch (err) {} } } }else if.....
... View more
05-24-2012
07:29 AM
|
0
|
6
|
784
|
POST
|
I'll give a stab at it- Your dojo event handler is pointing to the map, not the feature layer. Do something like: dojo.connect(featurelayer, "onClick", function(evt){ console.log(evt) }) Let me know if this works.
... View more
05-21-2012
12:43 PM
|
0
|
0
|
316
|
POST
|
Just to note, I also noticed the Print Web Task does not take into account hidden graphics, hence why there additional graphics on the .pdf Thanks again, Aaron
... View more
05-21-2012
12:20 PM
|
0
|
0
|
200
|
POST
|
Hi everyone, Has anyone else had problems with map labels not showing up on the map when using the Print Dijit/Execute web task? Screenshot.png is a picture I took of my browser (correct) Printout.pdf is what gets generated from our 10.1 ESRI server(incorrect). Notice the labels are missing from the pdf. Thanks! Aaron
... View more
05-21-2012
12:10 PM
|
0
|
3
|
576
|
POST
|
I receive this error anytime I try to print any base map from http://services.arcgisonline.com. If I remove the base map from my code, it prints fine. (From Firebug console:) "Error executing tool.: Layer "layer0": Unable to connect to map server at http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer. Failed to execute (Export Web Map). Failed to execute (Export Web Map Task)." I get a gut-feeling it has something to do with my server's proxy, but I'm not sure. Any thoughts? Here is the proxy I'm using:
<%@page session="false"%>
<%@page import="java.net.*,java.io.*" %>
<%!
String[] serverUrls = {
//"<url>[,<token>]"
//For ex. (secured server): "http://myserver.mycompany.com/arcgis/rest/services,ayn2C2iPvqjeqWoXwV6rjmr43kyo23mhIPnXz2CEiMA6rVu0xR0St8gKsd0olv8a"
//For ex. (non-secured server): "http://sampleserver1.arcgisonline.com/arcgis/rest/services"
"http://sampleserver1.arcgisonline.com/arcgis/rest/services",
"http://***/arcgis/rest/services, username=***",// username=***
"http://server.arcgisonline.com/ArcGIS/rest/services",
"http://***/ArcGIS/rest/services, username=***&password=***",
"http://servicesbeta4.esri.com/arcgis/rest/services/",
"http://sampleserver2.arcgisonline.com/arcgis/rest/services"
};
%>
<%
try {
String reqUrl = request.getQueryString();
boolean allowed = false;
String token = null;
for(String surl : serverUrls) {
String[] stokens = surl.split("\\s*,\\s*");
if(reqUrl.toLowerCase().contains(stokens[0].toLowerCase())) {
allowed = true;
if(stokens.length >= 2 && stokens[1].length() > 0)
token = stokens[1];
break;
}
}
if(!allowed) {
response.setStatus(403);
return;
}
if(token != null) {
reqUrl = reqUrl + (reqUrl.indexOf("?") > -1 ? "&" : "?") + "token=" + token;
}
URL url = new URL(reqUrl);
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setDoOutput(true);
con.setRequestMethod(request.getMethod());
if(request.getContentType() != null) {
con.setRequestProperty("Content-Type", request.getContentType());
}
con.setRequestProperty("Referer", request.getHeader("Referer"));
int clength = request.getContentLength();
if(clength > 0) {
con.setDoInput(true);
InputStream istream = request.getInputStream();
OutputStream os = con.getOutputStream();
final int length = 5000;
byte[] bytes = new byte[length];
int bytesRead = 0;
while ((bytesRead = istream.read(bytes, 0, length)) > 0) {
os.write(bytes, 0, bytesRead);
}
}
else {
con.setRequestMethod("GET");
}
out.clear();
out = pageContext.pushBody();
OutputStream ostream = response.getOutputStream();
response.setContentType(con.getContentType());
InputStream in = con.getInputStream();
final int length = 5000;
byte[] bytes = new byte[length];
int bytesRead = 0;
while ((bytesRead = in.read(bytes, 0, length)) > 0) {
ostream.write(bytes, 0, bytesRead);
}
} catch(Exception e) {
response.setStatus(500);
}
%>
... View more
05-02-2012
05:53 AM
|
2
|
22
|
10780
|
Title | Kudos | Posted |
---|---|---|
1 | 03-21-2013 06:57 AM | |
2 | 05-02-2012 05:53 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|