|
POST
|
Uday, It is possible but you would have to write your own function to do it. The main problem you will end up having is getting the KML to have the same symbology as your features. I have written an exporter for a draw widget that exports all drawn graphics to KML. Below is the code that may give you some pointers:
private function saveKML():void
{
//create string to hold KML
var KML:String = new String;
KML = "";
KML = '<?xml version="1.0" encoding="UTF-8"?>\n<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">\n<Document>\n<Folder>\n';
for (var i:int = 0; i < graphicsLayer.numGraphics; i++)
{
var gra:Graphic = graphicsLayer.getChildAt(i) as Graphic;
var symTypeName:String = "";
var symType:String = "";
var symLType:String = "";
var symFontE:String = "";
var symFontP:String = "middle";
var symSize:Number = 1;
var symColor:Number = 0x000000;
var symColor2:Number = 0x000000;
var symColor3:Number = 0x000000;
var symWidth:Number = 1;
var symText:String = "";
var symAlpha1:Number = 1;
var symAlpha2:Number = 1;
var geomType:String = "";
var geomSR:Number;
var gname:String = "";
var symAngle:Number = 0;
var symcolour:String = "";
var polysymcolour:String = "";
var symAlpha:String = "FF";
var symAlphaOutline:String = "FF";
switch(gra.geometry.type)
{
case Geometry.MAPPOINT:
{
var pnt:MapPoint = gra.geometry as MapPoint;
KML = KML + "<Placemark>\n<Style>\n<IconStyle>\n<scale>1.000000</scale>\n<Icon>\n<href>" + kmlPointSymbol + "</href>\n</Icon>\n</IconStyle>\n</Style>\n<name>" + gra.attributes.title + "</name>\n<description>" + gra.attributes.content + "</description>\n<Point>\n<coordinates>\n" + pnt.x.toString() + "," + pnt.y.toString() + "\n</coordinates>\n</Point>\n</Placemark>\n";
break;
}
case Geometry.POLYLINE:
{
var polyline:Polyline = gra.geometry as Polyline;
var lineSym:SimpleLineSymbol = gra.symbol as SimpleLineSymbol;
symcolour = lineSym.color.toString(16);
while (symcolour.length < 6)
{
symcolour = 0 + symcolour;
}
symWidth = lineSym.width;
symAlpha = (lineSym.alpha * 255).toString(16);
for (var i1:int = 0; i1 < polyline.paths.length; i1++)
{
KML = KML + "<Placemark>\n<name>" + gra.attributes.title + "</name>\n<description>" + gra.attributes.content + "</description>\n<Style>\n<LineStyle>\n<color>" + symAlpha + symcolour.substr(4,2) + symcolour.substr(2,2) + symcolour.substr(0,2) + "</color>\n<width>" + symWidth + "</width>\n</LineStyle>\n</Style>\n<LineString>\n<coordinates>\n";
for (var j:int = 0; j < polyline.paths[i1].length; j++)
{
var mp:MapPoint = polyline.getPoint(i1,j) as MapPoint;
KML = KML + mp.x.toString() + "," + mp.y.toString() + ",0 ";
}
KML = KML + "\n</coordinates>\n</LineString>\n</Placemark>\n";
}
break;
}
case Geometry.POLYGON:
{
var poly:Polygon= gra.geometry as Polygon;
var polySym:SimpleFillSymbol = gra.symbol as SimpleFillSymbol;
polysymcolour = polySym.color.toString(16);
while (polysymcolour.length < 6)
{
polysymcolour = 0 + polysymcolour;
}
symcolour = polySym.outline.color.toString(16);
while (symcolour.length < 6)
{
symcolour = 0 + symcolour;
}
symWidth = polySym.outline.width;
if(polySym.style != "solid")
{
symAlpha = (polySym.alpha * 128).toString(16);
}
else
{
symAlpha = (polySym.alpha * 255).toString(16);
}
symAlphaOutline = (polySym.outline.alpha * 255).toString(16);
for (var i2:int = 0; i2 < poly.rings.length; i2++)
{
KML = KML + "<Placemark>\n<name>" + gra.attributes.title + "</name>\n<description>" + gra.attributes.content + "</description>\n<Style>\n<PolyStyle>\n<color>" + symAlpha + polysymcolour.substr(4,2) + polysymcolour.substr(2,2) + polysymcolour.substr(0,2) + "</color>\n</PolyStyle>\n<LineStyle>\n<color>" + symAlphaOutline + symcolour.substr(4,2) + symcolour.substr(2,2) + symcolour.substr(0,2) + "</color>\n<width>" + symWidth + "</width>\n</LineStyle>\n</Style>\n<Polygon>\n<outerBoundaryIs>\n<LinearRing>\n<coordinates>\n";
for (var j1:int = 0; j1 < poly.rings[i2].length; j1++)
{
var mp2:MapPoint = poly.getPoint(i2,j1) as MapPoint;
KML = KML + mp2.x.toString() + "," + mp2.y.toString() + " ";
}
KML = KML + "\n</coordinates>\n</LinearRing>\n</outerBoundaryIs>\n</Polygon>\n</Placemark>\n";
}
break;
}
//case Geometry.EXTENT:
//{
//var rect:Extent= gra.geometry as Extent;
//KML = KML + "<Placemark><name>" + gra.attributes.title + "</name><Polygon><outerBoundaryIs><LinearRing><coordinates>" + rect.xmin + "," + rect.ymin + " " + rect.xmax + "," + rect.ymin + " " + rect.xmax + "," + rect.ymax + " " + rect.xmin + "," + rect.ymax + "</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>";
//break;
//}
}
}
KML = KML + "</Folder>\n</Document>\n</kml>";
if(!fr) fr = new FileReference();
fr.save(KML,"SavedGraphics.kml");
}
Regards Anthony
... View more
06-02-2013
11:10 PM
|
0
|
0
|
1677
|
|
POST
|
Shawny, Please don't also forget to mark the post as answered Thank you Anthony
... View more
05-31-2013
03:01 PM
|
0
|
0
|
1002
|
|
POST
|
Shawny Try: <field name="DATE" alias="PURCHASE DATE" visible="true"> <format dateformat="shortDate"/> </field> Note I have removed the forward slash after visible="true" on the first line Regards Anthony
... View more
05-30-2013
10:03 PM
|
0
|
0
|
1002
|
|
POST
|
Don, The application can be downloaded from here: http://www.esri.com/software/arcgis/arcgisonline/apps/operations-dashboard Regards Anthony
... View more
05-27-2013
08:35 AM
|
0
|
0
|
600
|
|
POST
|
Don, If you search from within one of the posts in a particular forum (i.e. operations dashboard for ArcGIS) the search will be constrained to that forum Regards Anthony
... View more
05-27-2013
08:33 AM
|
0
|
0
|
1127
|
|
POST
|
Harriet, If you want to give the user the ability to tone down the base map to Gray scale or desaturated, or turn off the base map completely then I have published a widget here: http://www.arcgis.com/home/item.html?id=3d1ea673ad15413db81262a4e73184ac Regards Anthony
... View more
05-23-2013
09:33 AM
|
0
|
0
|
1019
|
|
POST
|
Isaiah, Not sure if it will have any effect but have you tried setting the panEasingFactor property: http://resources.arcgis.com/en/help/flex-api/apiref/index.html Regards Anthony
... View more
05-21-2013
12:54 PM
|
0
|
0
|
1017
|
|
POST
|
Steven, Have you made the layer time aware in ArcMap before you publish it through server: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005z0000000p000000.htm Regards Anthony
... View more
05-21-2013
12:46 PM
|
0
|
0
|
1459
|
|
POST
|
The number of returned features is set in service properties, by default this is 500 on a 9.3.1 server and 1000 on a 10 server. http://resources.arcgis.com/en/help/main/10.1/index.html#//0155000003nv000000 Change this value to 50 and your service will only return 50 records. Regards Anthony
... View more
05-20-2013
12:29 PM
|
0
|
0
|
828
|
|
POST
|
MayMay, If you don't want to get into having to code your own widget a similar capability is now available in the header control widget: http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Header_Controller_widget_tags/01m30000000n000000/ Regards Anthony
... View more
05-20-2013
08:28 AM
|
0
|
0
|
1895
|
|
POST
|
Rachel, Are you sure that only one line is stored. If you start an editing session in ArcMap and double click on the field value in the attribute table you will probably see more data, each line will be seperated by a square (arcmaps way of showing a hard return). I think its just arcmap cannot handle data over multiple lines very well. I have just tested this and it looks like this is what is happening. Regards Anthony
... View more
05-16-2013
07:50 AM
|
0
|
0
|
2236
|
|
POST
|
Rachel, The single line would only be in the edit widget, to discourage people from hitting return for a new line. Viewing the data in a pop up or in arcmap should allow you to see all the data. Regards Anthony
... View more
05-15-2013
09:58 AM
|
0
|
0
|
2236
|
|
POST
|
Rachel, Have a look at the singletomultilinethreshold tag: <singletomultilinethreshold> The maximum number of characters to display as a single line text input component, otherwise display as a multiline text area. This number is compared to the length of the string field. Number value (default is 50). See here: http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Edit_widget_tags/01m30000000v000000/ Setting this to a larger number should keep the input to a single line text box. Regards Anthony
... View more
05-14-2013
10:33 AM
|
0
|
0
|
2236
|
|
POST
|
Sunil, Could you explain in more detail why you need to overwrite your map service to see changes made to the data in the database. Changes to your data should be automatically reflected in your web applications. Regards Anthony
... View more
05-14-2013
10:27 AM
|
0
|
0
|
1093
|
|
POST
|
Janie, My mistake, I can see how you can use the web adapter to pass traffic from your web server to your ArcGIS server, in that case I guess that your application would have to sit on your enterprise web server. Regards Anthony
... View more
05-08-2013
12:50 PM
|
0
|
0
|
1931
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-01-2016 01:57 PM | |
| 1 | 02-04-2013 01:05 AM | |
| 1 | 04-11-2013 09:53 PM | |
| 1 | 04-03-2013 09:42 AM | |
| 1 | 07-25-2014 10:58 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:22 AM
|