Login    |    Register

connect and contribute... Click here for further options




Articles

Current Articles | Categories | Search | Syndication

Thursday, September 07, 2006
MIDAS XML and Google Maps by Steve White
By Steve White @ 8:57 AM :: 3306 Views :: 0 Comments :: Computers and Archaeology
 
Article Pages:
Importing data to the MIDAS XML standard

To import XML into the system, open the application and click ‘External’.

You can now see the ‘Load external MIDAS XML’ textbox. Paste in a URL of an XML file that uses MIDAS, such as:

http://heritage-standards.org/midas/examples/monument_example.xml

The Javascript function then sends the request to a proxy on the server to handle the request. This ensures that cross-domain XMLHTTP requests can be done via Javascript. The XML is then parsed and data is loaded onto the interface.

Once we have the data in the XMLHTTP response object we need to parse the data.

In Javscript we load the parser depending on the client:

var dom;
if(oBrowser == "FF") {
var parser = new DOMParser();
dom = parser.parseFromString(XmlRequest.responseText, "text/xml");
}
else if(oBrowser == "IE") {
dom = GXml.parse(XmlRequest.responseText);
}

Then we add the MIDAS ‘monuments’ element to a local var:

var monuments = dom.getElementsByTagName("monument");

Next we loop through the monuments collection and process each record:

for (var j = 0; j < monuments.length; j++) {
var oItem = monuments[j];
// strip out whatever the application needs from MIDAS
}

We can then assign various nodeValues from the individual ‘monument’ elements to local vars in Javascript which we use to populate the GoogleMap with markers and tooltips and InfoWindows.

Since the MIDAS XML schema uses the National Grid Reference as a spatial reference, we need to convert it on the fly in Javascript to Latitude and Longitude, which is how the Google Maps API plots spatial references on the interface.

Once more XML files become available using MIDAS schema it would be a simple process to provide a method to overlay different sources on top of each other and toggle them on/off using Javascript.

This client-side method of retrieving data from MIDAS documents has only been tested on small MIDAS datasets. If the datasets where large then this method would cause the client browser to freeze. For larger datasets it would make more sense therefore to use server-side code to parse the MIDAS XML and return the data back out via the same XMLHTTP client-side call. This could be achieved by doing all of the server-side processing in the server-side page we are using for a proxy call to get the XML from another domain.

The Google Maps API is still in beta, meaning that it has not been formally released as a product. As such, it is still being developed, and new features are still being added weekly.

 

Previous Page | Next Page
Comments
Currently, there are no comments. Be the first to post one!
You must be logged in to post a comment. You can login here

Go to email Go to delicious.com Go to digg Go to technorati Go to reddit Go to stumbleupon Go to facebook Go to newsvine Go to simpy Go to google&nbsp;bookmarks Go to yahoo&nbsp;bookmarks Go to yahoo myweb Go to ask Go to slashdot Go to rawsugar Go to mister-wong Go to backflip Go to diigo Go to tailrank Go to live Go to twitter Go to fark Go to blogmarks Go to linkagogo Go to wink Go to ma.gnolia Go to bluedot Go to netvouz Go to blinklist Go to sphinn
Home · Connect · Contribute
Copyright 2006 - 2009 Online Archaeology   |   Terms of Use   |   Privacy Statement