Tag Archives: xml
ArcGIS API for JavaScript Tips-n-Tricks: Parsing GeoRSS with jQuery
There are quite a few reasons why GeoRSS feeds can be tricky to parse. The reasons include confusing child-parent tag relationships, and some parsers simply don’t work with namespaces (e.g. <geo:lat>) depending on which browser you are using. This is where jQuery comes in very handy, especially if you want your app to function well across the major browsers. The pattern that you can use looks like this:
//Look for the tag <geo:lat>
$(data).find(“[nodeName='geo:lat']“).text()
Feel free to click here to see a live example and view the source code. Or just download the source and try it out on your machine.
References:
http://api.jquery.com/find/
http://api.jquery.com/jQuery.ajax/
http://docs.jquery.com/Tutorials:How_to_Get_Anything_You_Want
Xray for ArcGIS 10 Updated
ESRI, in conjunction with Vertex3, has released revised versions of Xray for ArcGIS 10. The Xray Add-In for ArcCatalog can be used to develop, refine and document your geodatabase designs. The Xray Add-In for ArcMap can be used to document the properties of your map documents (MXDs).
This release includes the following enhancements:
- Added support for Dataset, Field, and Domain Descriptions. These tools will create spreadsheets where you can document all descriptions in one place.
- Added support for SDE and Workgroup Geodatabases. You can now select .gds and .sde connection files in ArcCatalog to export/import XML Workspaces.
- Default SVG settings/options can now be changed in an XML Document.
- FGDC Metadata support (ESRI patch for ArcGIS Desktop).
This release also addressed the following bugs:
- File locking error messages that were caused by a file reader object not being closed correctly in the application.
- The SVG settings menu was not updating correctly when the “Visio” option was selected or checked.
- Improved automatic layout of SVG graphics in Visio.
We hope you’ll find these tools valuable when developing and sharing your ArcGIS 10 geodatabases and map documents and look forward to your feedback.
Xray for ArcGIS 10 Beta Available for Download
ESRI, in conjunction with Vertex3, has released Xray for ArcGIS 10 Beta. This update of the Xray tools you’ve found previously on ArcScripts, provides two ArcGIS 10 Add-Ins you can use natively in ArcCatalog or ArcMap.
The Xray Add-In for ArcCatalog can be used to develop, refine and document your geodatabase designs. The Xray Add-In for ArcMap can be used to document the properties of your map documents (MXDs).
This release of Xray for ArcGIS 10 requires ArcGIS Desktop 10 and works with Personal and File Geodatabases. Future releases will support Workgroup and Enterprise Geodatabases. Xml workspace documents from earlier releases of ArcGIS can be opened, but users should upgrade their geodatabase to ArcGIS 10 before using Xray. Installation help and additional release notes can be found in the attached.
We hope you’ll find these tools valuable when developing and sharing your ArcGIS 10 geodatabases and map documents and look forward to your feedback.
Handling XML with Python in ArcGIS
The Python language offers a variety of ways to handle and parse XML. Lots of GIS data can be stored in an XML schema. For example, KML is made up of a well known XML structure. Another well known structure includes GPX, the native format that GPS devices typically save too. By using Python and ArcPy, you can create features from XML.
One of my teammates on the Geoprocessing team recently invested in a GPS sports watch. In addition to telling time, his watch could track movement and monitor heart rate. Since we love geography, programming, geoprocessing and fitness so much, another teammate, Ghislain, took to writing a tool to turn the GPX (XML) into feature classes for display on a map. A closer inspection of the GPS output and a look into the schema provided by topographix (http://www.topografix.com/gpx/1/1/) shows that the XML follows a standard format on how latitude, longitude, elevation and time are saved. This particular schema is enhanced to save the heart rate information. Since the information is saved in an expected way, one Python script could be written to handle many different GPS outputs.
Ghislain looked into the Python class ElementTree. ElementTree has many easy to use functions to parse through XML. Python also has other objects like Minidom or XPath which can be used to read XML; however, for this script ElementTree was used. The script looks for the values mentioned previously and hands this information over to an ArcPy cursor which writes the information into a point feature class.

The complete script is available in the Model and Script Gallery: GPS to Layer. Feel free to take it and use it simply to convert your GPX points into a feature class, or break it open and look at how Python can be used in your ArcGIS workflows. Use the comments section here or on the page itself to leave any feedback on this tool.
Well, what good would this GPS to Points tool be if we didn’t use it to evaluate the fitness level of our co-worker? Based on the map show below there is a lot of orange and red, and I’m concerned with a heart rate of 200 beats per minute on the uphill, but according to Wikipedia, he just must be giving his “maximum effort”. At least his maximum effort is an honest effort!
Additional Resources:
• An excellent blog post by Doug Hellmann http://blog.doughellmann.com/2010/03/pymotw-parsing-xml-documents-with.html explains different ways to walk through XML.
• Python 2.6.x XML ElementTree documentation, http://docs.python.org/library/xml.etree.elementtree.html
• Element Tree Overview from effbot.org, http://effbot.org/zone/element-index.htm
Sending geometry between Silverlight and the server using WCF
Several posts on our Silverlight and WPF forums contain questions about how to send geometry back and forth between the server and the Silverlight client application. This can be useful when creating a service that stores graphics users want to share with others, loads data from other datasources, or uses ArcObjects to perform custom processing that ArcGIS Server REST services do not expose.
Most of the current solutions involve creating custom serializers that manually convert geometry into some sort of string format, such as XML or JSON. This works well, but there is a much easier way to do it using Silverlight and WCF’s Binary XML support. The fact that our client API includes matching .NET assemblies for both Silverlight and WPF platforms is pivotal to enabling this functionality. Geometry represented on the client using our Silverlight libraries mirrors geometry represented using our WPF libraries on the server . Basically, WCF and Silverlight will automatically manage the serialization and transmission of data, so you do not need to create serializers for the geometry, and you can continue to write type-safe code.
Follow the steps below to set up a simple WCF based service that the Silverlight API will use to send and receive geometry. Pay close attention to whether the steps refer to the website project or the Silverlight project.
Open Visual Studio and select to create a new Silverlight Application project.
Select “yes” to create a website to host your application:
Create the WCF service. Right-click the website project, select “Add reference…” and add a reference to the WPF build of the ESRI.ArcGIS.Client.dll assembly.
Similarly, right-click the Silverlight project, select “Add reference…” and add a reference to the Silverlight build of the ESRI.ArcGIS.Client.dll assembly.
Make sure you pair the right assembly with the right project. With these two references added, both the ASP.NET website at the server end as well as the Silverlight client will know how to work with the ESRI.ArcGIS.Client.Geometry namespace. Note that there are some classes in our WPF libraries that require you to add a reference to ‘WindowsBase’ in the website application.
Next, right-click the website project, select “Add a New Item…” and add a “Silverlight-enabled WCF service”. This will be the service our Silverlight application will work with.
When the service was created it generated a default “DoWork” method that takes no arguments and generates not return values. Change the method so it takes and/or returns an ESRI.ArcGIS.Client.Geometry.* type as parameter. Here’s a simple example of a method that takes a point, adds a certain amount to the X and Y, and returns a new shifted point:
[OperationContract]
public MapPoint Shift(MapPoint point, double amount)
{
return new MapPoint(point.X + amount, point.Y + amount);
}
Similarly you can use Polygon and Polyline to send and/or receive geometry between the server and client. This example is merely instruct. The business logic in this method could reside in the client, whereas a more purposeful example would involve using logic that solely resides in APIs or functionality only available on the server. For example, using ArcObjects to perform an advanced geospatial operation.
You can add more methods to your service class. Just make sure you prefix each method you want to expose in the service with the [OperationContract] attribute.
If you right-click the .svc service in the Solution Explorer and select to view it in the browser, you will see something like this:
Select the URL that is displayed in the browser and copy it. We will use this URL as a service reference in the Silverlight application. Right-click your Silverlight project and select “Add Service Reference…”, then paste in the URL you just copied. Click “Go” and “OK”. You should see something like this:
Note: You must add a reference to ESRI.ArcGIS.Client.dll in the Silverlight application before adding the service reference. If you have not, Visual Studio will auto-generate a new set of Geometry classes that are not the same as the ArcGIS Silverlight/WPF Geometry classes.
With the service added, we can now start using the service directly inside Silverlight. Here is an example:
ServiceReference1.MyGeometryServiceClient client = new ServiceReference1.MyGeometryServiceClient(); client.ShiftCompleted += client_ShiftCompleted; client.ShiftAsync(new ESRI.ArcGIS.Client.Geometry.MapPoint(10, 10), 0.5);
Our ShiftCompleted handler takes an event argument whose Result property will contain the MapPoint instance:
private void client_ShiftCompleted(object sender, SilverlightApplication1.ServiceReference1.ShiftCompletedEventArgs e)
{
MapPoint result = e.Result;
}
Note that the method automatically matches the service’s arguments to the ESRI.ArcGIS.Client.Geometry.MapPoint type so you don’t need to handle any conversion or serialization.
If you want to send attributes to the server as well, note that you cannot send a “Graphic” object since this object and its Symbol are not serializable. Instead you can send the geometry back together with the attribute dictionary. For example:
[OperationContract]
public void SaveFeature(Polygon polygon, Dictionary<string,object> attributes)
{
//TODO
}
Alternatively you can create your own class that holds both the geometry and attributes:
[DataContract]
public class GeometryAndAttributes<
{
[DataMember]
public Dictionary<string, object> Attributes { get; set; }
[DataMember]
public Geometry Geometry { get; set; }
}
[OperationContract]
public IEnumerable<GeometryAndAttributes> GetFeatures()
{
//TODO
}
Morten Nielsen
Senior Software Engineer
ArcGIS Server.NET, Silverlight/WPF, MapIt

After an evening of pre-prepping and checking out the hotel gym (four machines, one functional), we hit the bed so as to get a good night’s rest.
in the evening, I would meet Curtis Belyea, a biologist at NCSU, who was not only attending the Dev Meet Up, but also presenting as well.
After our lunch and regrouping, we headed to
The next to arrive is our keynote speaker, Scott Gonzalez (
4. Find users
Overall, Scott gave an inspirational keynote and got people excited about getting out there and creating some new applications.
Information System (FMIS).













