1 / 37

Visualizing GML in OpenMap.

Visualizing GML in OpenMap. . Jackson Kwok Amit Nithian 5/1/2006. Presentation Agenda. OpenMap architecture and overview What is OpenMap? Why did we choose OpenMap? How to integrate GML visualization into OpenMap? Data acquisition GML Integration into OpenMap

bertha
Download Presentation

Visualizing GML in OpenMap.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visualizing GML in OpenMap. Jackson Kwok Amit Nithian 5/1/2006

  2. Presentation Agenda • OpenMap architecture and overview • What is OpenMap? • Why did we choose OpenMap? • How to integrate GML visualization into OpenMap? • Data acquisition • GML Integration into OpenMap • Accessing GML constructs from Java • Using our visualization to “compress” GML documents. • Vertex Reduction • Douglas-Peucker Algorithm.

  3. OpenMap • What is OpenMap? • Open-Source Java-based Geographic Information System (GIS) mapping toolkit • Java-Bean Based • Set of Swing components that understand geographic coordinates • Show map data • Help you handle user input events to manipulate that data • Most mature and arguably most popular toolkit • Competitors • GeoTools • uDig • Background • Developed by BBN Technologies originally under government funding from 1987 to 1992 • Released as open-source in 1998 • Latest version 4.6.3 (updated Feb ’06) http://www.openmap.org/

  4. OpenMap Support Supports various GIS formats including Standards ESRI Shapefiles Scalable Vector Graphics (SVG) NGA Raster Product Formats Compressed ARC Digitized Raster Graphics (CADRG) i.e. Military Maps Controlled Image Base (CIB) i.e. Satellite imagery However as of today, OpenMap has no support of GML formats Discussions in Mailing Lists Several members in OpenMap Community expressed interest of a GML parser for OpenMap. Focused on workarounds such as converting GML to other formats (SVGs)

  5. OpenMap Architecture Layer 1 Layer 2 Layer 3 … Layer n

  6. OpenMap Customization • Two ways to customize • Build OpenMap from its core components • Create OpenMap Frame • Add Menu, Toolbar, MapBean • Add Layers to MapBean • OpenMap Properties file (used for this project) • Create an OpenMap object • Automatically looks for a openmap.properties file • Creates Menus, Toolbar, MapBean, Layers specified in properties

  7. OpenMap Properties Custom GML Layers Use reflection to load Layer

  8. Obtaining GML Data • GML File Criteria • Small (easy to test) • USA map (interesting to Plot) • Difficulties • Not many small GML data samples online • Could not find GML data of USA • Solution • Use Alternate Canada GML Data • Already have USA Shapefiles just need a tool to Convert to GML • Sources • Outline of USA • Outline of USA with State Outline

  9. Shapefile to GML file • Use GeoCon, a free GIS tool, to convert shapefiles to GML • USA.shp (152 KB) • USA.xml (409 KB) • USA_state.shp (218 KB) • USA_state.xml (584 KB) • GML files about 2.6 times Larger than shapefiles http://www.mycgiserver.com/~amri/geocon.cocoon.xml

  10. GML Integration into OpenMap • Several ways of importing GML data into Java for processing • DOM • Custom SAX parsing • GML4J • XML Schema binding to Java data types. • We chose the 4th approach, schema binding to Java data types.

  11. GML4J • GML4J is a reference implementation of GML access within Java. It wraps a DOM document so that you can access GML constructs and data by name rather than by DOM approach.

  12. XMLBeans • Open source product initially developed at BEA and then donated to the Apache project. • Allows for the compilation of an XML Schema to Java classes. XML is then parsed according to this strongly typed object model. • More memory efficient than DOM yet not event driven like SAX. • XMLBeans is stream based and so doesn’t have to bring the entire XML document into memory.

  13. Example of XMLBeans usage.

  14. Example of XMLBeans (cont’d) • Using their tools, compile PurchaseOrder.xsd into PurchaseOrder.jar • scomp –out PurchaseOrder.jar PurchaseOrder.xsd • Parse the XML using their factory objects to construct an object model of the XML. • Write code to access XML data using object model.

  15. Example of XMLBeans cont’d <purchase-order xmlns="http://openuri.org/easypo"> <customer> <name>Gladys Kravitz</name> <address>Anytown, PA</address> </customer> <date>2003-01-07T14:16:00-05:00</date> <shipper> <name>ZipShip</name> <per-ounce-rate>0.74</per-ounce-rate> </shipper> </purchase-order>

  16. Example of XMLBeans cont’d Code: public static void main(String[] args) { try { PurchaseOrderDocument pDoc = PurchaseOrderDocument.Factory.parse(new File("PurchaseOrder.xml")); System.out.println(pDoc.getPurchaseOrder().getShipper().getName()); System.out.println(pDoc.getPurchaseOrder().getDate()); } catch(Exception e) { // TODO: handle exception } } Output: ZipShip 2003-01-07T14:16:00-05:00

  17. Benefits of XMLBeans • Open Source (so free!! ). • More memory efficient than DOM based access to XML (will show later). • Don’t have to develop custom object model and parse using SAX • 100% XML Schema support • Good for GML since it’s schema based • Support for XQuery and XPath. • Easy to find geometric objects, only a finite amount • Can extend XQuery for spatial support and use with XMLBeans

  18. Comparison with GML4J • Used two datasets • USA map (409 KB) • Canada map (10263 KB) • Measured the average parse time of the respective GML document (average of three trials) • Measured the average time to find all the GML polygons three times. • Wanted to see if the second and third polygon searches were faster than the first. Again, average of three trials each. • Measured heap memory consumed at various points during execution of the GML tester application.

  19. Parse Time Results

  20. Canada Dataset Results

  21. Canada Dataset Results (cont’d)

  22. USA Dataset Results

  23. USA Dataset Results (cont’d)

  24. Data Analysis • USA GML provides a high level of detail • May not be needed for most users • Not suitable for handheld devices • Limited Processing Power • Limited Memory • Polyline Reduction Algorithms • Vertex Reduction • Douglas-Peucker

  25. Vertex Reduction • Simple Algorithm • User inputs distance tolerance ε • Algorithm checks distances between Sequential Points in Polyline array • If distance shorter than points, that point is Not Included in new set of points

  26. Vertex Reduction Implementation • Take an array of Latitude, Longitude in sequential order and distance tolerance as inputs • Create new array • Go through the array and add all Latitude, Longitude points greater than tolerance distance to list • O(n) runtime

  27. Vertex Reduction ResultsUSA Map

  28. Douglas-Peucker • Slightly more complicated algorithm • User inputs a distance tolerance • Take first and last point of polyline and make it a line segment • Measure each point’s distance from Line Segment • Take point X farthest away from Line Segment which is also out of tolerance • Add X to new array • Recursively run first and X and X and end through same algorithm

  29. Douglas-Peucker Implementation • Created two methods • 1st method that feeds in inputs to 2nd method and then uses results from 2nd method to create new array of Latitude and Longitudes • 2nd method is a recursive method takes first and last index, array of Latitude and Longitudes and array of Boolean values • Mark Farthest Points from line segments to be added to new array • Skip first and second indexes that do not have points in-between • Skip Farthest Points that do not lie outside tolerance • O(m log n) expected runtime • O(mn) worst time • m is the number of points in polyline

  30. Douglas-Peucker Results USA Map

  31. Combined Results USA Map Original Size = 22194

  32. Demo

  33. Vertex Reduction original 0.05 0.15 0.25

  34. Douglas Peucker 25 original 75 80

  35. Combined original .05, 25 .1, 50 .15, 75

  36. Combined with USA States original .05, 25 .1, 50 .15, 75

  37. Conclusions • Our initial goal was to visualize GML documents using OpenMap. • Along the way, we solved the problem of reading GML data and querying for geometric properties (i.e. polygons). • Using XMLBeans to bind XML schemas to Java data types to efficiently navigate and query GML documents. • We implemented some polyline reduction algorithms to “compress” GML documents to possibly allow visualization on smaller devices.

More Related