White Paper on OS Master Map

1,057 views

Published on

White paper on OS MasterMap with Open source technologies

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,057
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

White Paper on OS Master Map

  1. 1. Using in-house built translator & Open Source Technologies: A Technical Perspective By Faizan Tayyab Senior GIS Developer
  2. 2. What will be covered: Introduction to UK biggest mapping agency. Introduction to Master Map Topography Layer. Motivation behind the project. Explanation of methodology. What this presentation is not: Tutorial on XML or GML. (Read a good book for that) Designing & Implementing Application schema(s) training. In detail coding for parsing GML data.
  3. 3. If you know how to parse XML then you will have no problem in understanding this presentation. If you haven't worked with XML or haven’t parsed it using different languages then I would recommended you go and have a look what it is all about. Being a future GIS Professional, it is a good idea to equip yourself with XML, Open source and GML skills. Xml is here to stay. It is powerful & Flexible. If you learn XML and Schema’s then GML becomes easier to understand.
  4. 4. Ordnance Survey is Great Britain's national mapping agency, providing the most accurate and up-to-date geographic data, relied on by government, business and individuals. It is one of the world’s largest map producer and first came into existence in 1774. Primarily, mapping produced by Ordnance Survey was used for military purposes only. Today Ordnance Survey employs over 1500 people and is the front runner in producing world’s best paper and digital maps in the UK.
  5. 5. A seamless database reflecting the real world Unique Identifiers (TOIDs) Conforms to Open GIS standards (e.g., GML) Consistent national coverage
  6. 6. Topography Layer Administrative Boundaries Buildings Heritage and Antiquities Water Land Rail Roads, Tracks and Paths Structures Terrain and Height Address Layer Address ITN Layer Roads Road Routing Information Imagery Layer Imagery
  7. 7. MasterMap Data Area feature with one TOID
  8. 8. Each feature in OS MasterMap Topography will be one of the following: Topographic Area Topographic Line Boundary Line Topographic Point Cartographic Symbol Cartographic Text In addition to the general attribute sets (TOID, Version etc.) Topographic Features all have the following attributes: Physical Presence Physical Level Make Feature Code
  9. 9. Descriptive Group – the primary descriptive attribute e.g. Landform, Roadside, Structure, Path, Rail, Built Environment, Height Control. Descriptive Term (Optional) – provides further description e.g. Archway, Boulder, Cliff, County, District, Pylon, Multi Surface, Rough Grassland. Physical Level – describes relative cartographic relationships between features. e.g. – underground (49), ground level (50), a level above ground (51) Physical Presence (optional) – e.g. Boundary, Closing, Extent, Obstructing, Overhead, Edge/Limit, Indicator, Minor Detail and Moveable Make (optional) – e.g. Manmade, Natural, Multiple, Unknown, Unclassified.
  10. 10. Customer is provided OS Master map data in GML format & CSV format (if stated by customer)
  11. 11. XML can be thought of as “smart” text that contains tags that have meaning to people and software! XML describes data. Different from HTML. <title> My Book </title> <author> James McGill </author>
  12. 12. <Farm> <Building> <Name>John Brown's House</Name> <Description>Colonial Farm House</Description> <Address>1134 15th eastline</Address> </Building> <Field /> <Field /> <Field /> </Farm> *galdos inc Field Field Field Field 15 line east East Hope Rd
  13. 13. The Geography Mark-up Language (GML) is an XML (extensible Mark-up Language) encoding for the modelling, transport and storage of geographic information including both spatial and non-spatial properties of geographic features. The integral part of any GML data model is the GML application schema (s), which describe the aspects of geo-spatial domain it addresses. GML application schema (s) are extended over and compliant with the standard OGC defined GML base schemas that are based on W3C schema recommendation specification. Software applications intending to support GML data models should be aware of these concepts. It is feasible to recognize these concepts by understanding the GML application schema(s). Understanding, processing and representing the GML application schema(s) enable the scope of supporting varied GML data models. Moved to GML 3.0 & later from GML 2.0. GML 3.0 far more complex.
  14. 14. <?xml version='1.0' encoding='UTF-8'?> <osgb:FeatureCollection xmlns:osgb='http://www.ordnancesurvey.co.uk/xml/namespaces/osgb' xmlns:gml='http://www.opengis.net/gml' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.ordnancesurvey.co.uk/xml/namespaces/sgb http://www.ordnancesurvey.co.uk/xml/schema/v3/OSDNFFeatures.xsd' fid='GDS-8692-1'> <gml:description>Ordnance Survey, (c) Crown Copyright. All rights reserved, 2004-10-21</gml:description>
  15. 15. <osgb:TopographicLine fid='osgb1000001332246793'> <osgb:featureCode>10098</osgb:featureCode> <osgb:version>1</osgb:version> <osgb:versionDate>2001-11-11</osgb:versionDate> <osgb:theme>Land</osgb:theme> <osgb:accuracyOfPosition>1.0m</osgb:accuracyOfPosition> <osgb:changeHistory> <osgb:changeDate>1994-02-15</osgb:changeDate> <osgb:reasonForChange>New</osgb:reasonForChange> </osgb:changeHistory> <osgb:descriptiveGroup>Landform</osgb:descriptiveGroup> <osgb:descriptiveTerm>Top Of Slope</osgb:descriptiveTerm> <osgb:make>Manmade</osgb:make> <osgb:physicalLevel>50</osgb:physicalLevel> <osgb:physicalPresence>Edge / Limit</osgb:physicalPresence> <osgb:polyline> <gml:LineString srsName='osgb:BNG'> <gml:coordinates>461510.540,152873.830 461511.440,152871.580 461511.760,152869.610 461511.870,152868.390 461512.360,152867.390 461512.920,152865.920 461513.410,152864.280 461513.980,152862.090 461514.400,152860.290 461514.790,152858.650 461514.900,152857.960 461514.980,152857.270 461515.050,152856.580 461515.100,152855.890 461515.120,152855.600 461515.160,152854.910 461515.180,152854.210 461515.190,152853.520 461515.160,152852.830 461515.080,152852.140 461515.050,152852.000 461514.990,152851.660 461514.810,152851.000 461514.700,152850.670 461514.580,152850.340 461514.460,152850.020 461514.180,152849.380 461514.040,152849.070 461513.880,152848.750 461513.580,152848.130 461513.570,152848.110 461513.310,152847.600 461512.750,152846.600 461512.440,152846.110 461512.130,152845.640 461511.790,152845.170 461511.570,152844.890 461511.290,152844.540 461511.010,152844.180 461510.730,152843.830 461510.420,152843.500 461510.110,152843.190 461509.760,152842.910 461509.390,152842.670 461509.220,152842.580 461508.860,152842.420 461508.670,152842.340 461508.490,152842.280 461508.300,152842.220 461508.110,152842.170 461508.070,152842.160 461506.850,152841.950 461505.800,152841.490 461504.840,152840.580 461503.510,152839.270 </gml:coordinates> </gml:LineString> </osgb:polyline> </osgb:TopographicLine>
  16. 16. Possibilities with GML are endless. Need GML enabled infrastructure. Avoid conflict between different formats for same features. Internet Mapping. Disaster Response System. Natural resource Management. And many other. GML is becoming ever popular especially with a shift of industry towards open standards. The Open GIS Consortium (OGC) is developing a set of standard geospatial web services (WFS,WMS,WCS).
  17. 17. Comprises of a Web Map Server (WMS) this serves raster versions of maps to clients. WMS datasets consist of raster images of data. The WMS Service generates the raster image and sends it to the clients browser. The original data can be vector or raster; but it is served and rendered as raster on the client side.
  18. 18. Db 1 Db 2 Db 3 Web Server 1 Web Server 2 Web Server 3 Internet Web Client Raster image HTTP Request Response (Raster Image)
  19. 19. The WMS specification standardises three operations: GetCapabilities (required) URL request Returns an XML file with metadata about the service itself and specific information about the available services GetMap (required) URL request with parameters Returns a map image whose geospatial parameters are well defined according to client request specification GetFeatureInfo (optional) URL request with parameters Returns information about particular features shown on a map – the raster image becomes ‘queryable’
  20. 20. GetMap Sample http://62.25.99.156/magnesium/wfs/OS? VERSION=1.0.0& REQUEST=GetMap& EXCEPTIONS=application/vnd.ogc.se_xml& FORMAT=SVG& HEIGHT=531& WIDTH=571& TRANSPARENT=FALSE& BGCOLOR=0xFFFFFF& BBOX=345095.5551,721195.7407,345708.6188,721777.1916& SRS=osgb:BNG& LAYERS=TopographicAreaType,TopographicAreaType,TopographicAreaType& STYLES=land,building,roadstrackspaths
  21. 21. Comprises of a Web Feature Server (WFS) this serves vector versions of maps to clients. The WFS Service supplies the geometry and attribute definitions that the client browser requests, and sends it in GML form. Supports INSERT, UPDATE, DELETE, QUERY and DISCOVERY operations
  22. 22. Db 1 Db 2 Db 3 Web Server 1 Web Server 2 Web Server 3 Internet Web Client Vector image HTTP Request Response (GML)
  23. 23. The WFS specification defines the following operations: GetCapabilities – As with WFS DescribeFeatureType – must be able to describe the structure of any feature type it can service GetFeature – services requests to retrieve feature instances and their properties Transaction – services transaction requests which modify geographic features LockFeature – allows lock requests on one or ore instances of a feature type for the duration of the transaction enabling serialisation
  24. 24. Sample Request HTTP GET http://62.25.99.156/magnesium/wfs/OS? REQUEST=GETFEATURE& TYPENAME=TopographicAreaType& SRS=OSGB:BNG& BBOX=292403,710274,294739,712607& USEBOX=TRUE& MAXFEATURES=10 HTTP POST <?xml version="1.0.0" encoding="UTF-8" ?> <!-- template for WFS get capabilities through a POST --> <GetFeature version="1.0.0" maxFeatures="20" service="WFS"> <Query typeName="TopographicAreaType"> </Query> </GetFeature>
  25. 25. <?xml version="1.0" encoding="utf-8" ?> - <ogcwfs:FeatureCollection xsi:schemaLocation=" http://www.ordnancesurvey.co.uk/xml/namespaces/osgb http://192.168.100.50/magnesium/wfs/OS?REQUEST=DescribeFeatureType&SERVICE=WFS&TYPENAME=AddressPointType,CartographicSymbolType,DepartedFeatureType,AbstractFeatureType,FeatureCollectionType,TopographicLineType,TopographicAreaType,TopographicPointType,CartographicTextType,BoundaryLineType&TYPENS=http%3A%2F%2Fwww.ordnancesurvey.co.uk%2Fxml%2Fnamespaces%2Fosgb http://www.opengis.net/gml http://192.168.100.50/magnesium/wfs/OS?REQUEST=DescribeFeatureType&SERVICE=WFS&TYPENAME=featureCollection&TYPENS=http%3A%2F%2Fwww.opengis.net%2Fgml http://www.opengis.net/wfs http://192.168.100.50/magnesium/wfs/OS/REQUEST/get/DATA/LPR/wfs/basic.xsd " xmlns:gml=" http://www.opengis.net/gml " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xmlns:xlink=" http://www.w3.org/1999/xlink " xmlns:ogcwfs=" http://www.opengis.net/wfs " xmlns:osgb=" http://www.ordnancesurvey.co.uk/xml/namespaces/osgb "> - <gml:boundedBy> - <gml:Box srsName=" osgb:BNG ">   <gml:coordinates> 294588.2,712553.7 294759.88,712755.4 </gml:coordinates>   </gml:Box>   </gml:boundedBy> <gml:featureMember> <osgb:TopographicArea fid="osgb1000039334441"> <osgb:featureCode>10021</osgb:featureCode> <osgb:version>2</osgb:version> <osgb:versionDate>2001-11-05</osgb:versionDate> <osgb:theme>Buildings</osgb:theme> <osgb:calculatedAreaValue>12.928</osgb:calculatedAreaValue> <osgb:descriptiveGroup>A Road</osgb:descriptiveGroup> <osgb:make>Manmade</osgb:make> <osgb:physicalLevel>50</osgb:physicalLevel> <osgb:polygon> <gml:Polygon srsName="osgb:BNG"> <gml:outerBoundaryIs> <gml:LinearRing srsName="osgb:BNG"> <gml:coordinates>294654.52,712605.92 294651.02,712602.62 294652.88,712600.68 294656.38,712603.98 294654.52,712605.92 </gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon> </osgb:polygon> </osgb:TopographicArea> </gml:featureMember> - <gml:featureMember></ogcwfs:FeatureCollection>
  26. 26. Database Web Map Server Internet Connection Browser or GIS client with WMS connector IIS or equivalent
  27. 27. A styling language that the WMS client and WMS server can both understand. Applies explicit styling information provided by the user in order to render a map. Allows the user to create custom styles on traditional WMS layers Some of the current SLD limitations are: 1) there is no elegant way to specify a thematic or chloropleth map. 2) the ability to create styles lacks a style library service.
  28. 28. An SLD WMS adds the following additional operations that are not available on a basic WMS: 1. DescribeLayer – asks for an XML description of a map layer. The result is the URL of the Web Feature Server (WFS) containing the data and the feature type names included in the layer. 2. GetLegendGraphic – provides a general mechanism for acquiring legend symbols, beyond the LegendURL reference of WMS Capabilities. 3. GetStyles – used to retrieve user-defined styles from a WMS. 4. PutStyles – used to store user-defined styles into a WMS
  29. 29. The need to manipulate and utilize GML data has resulted in development of many commercial products in the recent years, most of which are very expensive. Ordnance Survey GML data requires appropriate technical expertise and value added product or services for loading and using the data.
  30. 30. The project definition was to develop an in-house GML translator capable of translating and storing GML data into a MYSQL relational database. Once stored this data was then visualized using available Open Source technologies. Achieving the above will present the possibility to manipulate Ordnance Survey GML data in variety of ways and for different applications areas. The findings were compiled and presented as a white paper to be distributed to the customer with OS Master Map topography layer.
  31. 31. As mentioned in previous section, number of expensive commercial Translator are available that can convert GML data and store them in spatially enabled databases for further use. There are also numbers of open source technologies that are capable of displaying GML data directly on the web but these technologies are still in their formative years and need to be improved further.
  32. 32. The application developed ignored the GML application schema(s) and embedded the entire processing logic into the application. The need to manipulate the application schema didn’t arise as we were only dealing with a single data model.
  33. 33. GML is a XML based language which means that it can be manipulated in the same way as we can manipulate XML. A number of parsers are available which allow one to manipulate XML documents. These include DOM, SAX and few more. Although DOM itself is easy to work with, it has its limitation in terms of amount of data it can handle. On the other hand SAX which is event based and does not create a document in memory, is capable of handling huge amount of data, something which looks promising for handling huge amounts of GML data.
  34. 34. Java programming language was utilized for developing the application. Object oriented approach. Visual Interface. Ability to extend memory available to java for processing huge GML files while maintaining performance. Directly manipulate compressed .gz files
  35. 35. Prompt the user to select the compressed GML file. Unzip the GML file and provide to parser Initialize the XML reader Parse file using the reader For start Document event initialize temporary data structures For Each Start Element Retrieve the element attributes Initialize Objects for respective classes For Each End Element Store data for each element Re-initialize each temporary data structure For All Characters Store characters in temporary variables For Document end Re-initialize variables.
  36. 36. MYSQL Database + Spatial Extension * http://dev.mysql.com/tech-resources/articles/4.1/gis-with-mysql.html GIS Data Types* More Information http://dev.mysql.com/doc/refman/6.0/en/spatial-extensions.html
  37. 37. My SQL spatial extensions need to be installed separately. Good resource is the MYSQL website. Establish connection from within java. Once established transfer data stored in temporary data structures to database tables. In this case tables were created before hand. However user can be provided more control by allowing them to create tables when needed from within the main application.
  38. 38. stmt.addBatch ("INSERT INTO topo VALUES('"+ ln.toid +"',"+ ln.version +",'"+ ln.date +"','"+ ln.theme +"','"+ ln.featureCode +"','"+ ln.descriptiveGroup +"','"+ ln.descriptiveTerm +"','"+ ln.make +"',"+ ln.physicalLevel +",'"+ ln.physicalPresence +"',"+ null +","+ null +","+ null +","+ "GeomFromText('LINESTRING(" + sb + ")')" +",'"+ ln.accuracyOfPosition +"','"+ ch.lastChangeDate +"','"+ ch.lastReasonForChange +"',"+ null +","+ null +","+ null +","+ null +")"); Variable sb holds the geometry (Line). Will need to format sb accordingly so that it is accepted by MYSQL. Use String functions. Example in MySQL: SET @g = 'LINESTRING(0 0,1 1,2 2)'; INSERT INTO geom VALUES (LineStringFromText(@g));
  39. 39. Java is not the only option. You can use other languages as well, Python, .NET languages etc. Extend memory available to Java. Failure to do so may give a heap size error.
  40. 40. Download and install geo server 1.5.4 Download and install geo server MYSQL extension. Read documentation for further configuration if required. Type: http://localhost:8080/geoserver to enter geo server administration section. Add Database >> Add Namespace >> Add Feature Type. Read Documentation for more information. Geoserver uses OpenLayers for visualizing Geographic information. More information on geoserver.org and OpenLayers.org
  41. 41. Ability to warp the application around different data models. This would result in more powerful application which will capable of translating any GML data. (Utilize Application Schemas). Use Postgre SQLDatabase+PostGIS+ProJ instead of MYSQL. Database Control from with the Application.
  42. 42. Thank you for attending this presentation. Any Questions / General Feedback? Faizan Tayyab

×