GML
Van Wilder 2: The Rise of Taj move
GML is an excellent way to produce interactive features that can be overlayed on ones map. We stumbled upon GML early in our quest for an interactive map, we got most of our concepts from the open layers examples, and by looking at other folks’ maps and trying to duplicate and sometimes improving upon others functionality. We wanted a map that would be really interactive and would let users be able click on any feature and get information about it, and we wanted that information to be valuable and updated by the staff on campus that managed that information, for example we have accessibility information for the buildings around campus, and we want to allow the folks in Disability Services to be able to easily update the info.
GML is a XML standard for geographic data, it supports points, lines and polygon. OpenLayers, the javascript framework that renders the map in the browser, is unbelievably smart and can take the geometry of the feature, turn it into a Scalable Vector Graphic, and then overlay it on the map in the right place. Our GML file is created dynamically from the database. The query i use to gather the shape data is: SELECT astext(the_geom) as the_geom,gid FROM tble. there is also some text manipulation of the string produced by astext(the_geom) that is being done by php, but it is pretty minimal. you can directly access the values of the elements for each feature using javascript. So you could, and we did initially, store attribute data in the GML and then access it directly using javascript. We now decided to have as little information as possible in the GML, and then make an AJAX call to get the attributes from the database. This makes the GML smaller, and then in theory faster for OpenLayers to process, and it also makes the database query faster.