GithubHelp home page GithubHelp logo

ordnancesurvey / osmm-topography-layer-stylesheets Goto Github PK

View Code? Open in Web Editor NEW
50.0 38.0 86.0 14.08 MB

SQL scripts & cartographic stylesheets for OS MasterMap Topography Layer

Scheme 28.89% QML 71.11%
stylesheets

osmm-topography-layer-stylesheets's Introduction

OS MasterMap Topography Layer SQL & stylesheets

This repository contains database SQL scripts and cartographic stylesheets for styling OS MasterMap Topography Layer. Our hope is for this new method to become the standard way to post process the data so that styling OS MasterMap Topography Layer is far simpler and easier than before. It will also enable all of our customers and partners to utilise the released cartographic stylesheets.

Getting Started Guide

The Getting Started Guide is available in this repository and will help you apply the SQL and Stylesheets to your data.

Licence

The contents of this repository are licensed under the Open Government Licence 3.0

Logo

osmm-topography-layer-stylesheets's People

Contributors

charleyglynn avatar egil1978 avatar hwright-os avatar jessbaker avatar mpdaly avatar schoenobates avatar timjmartin avatar walkermatt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osmm-topography-layer-stylesheets's Issues

Loading of OSMM-Topography-Layer -Stylesheets in QGIS 3.10

I've struggled for a few days to get the topographicline and topographicarea layers to style according to the QGIS qml stylesheets provided by OS in GITHub.
Much of the posted online help involves using plugins like OS Translator II or PostgreSQL and PostGIS.
After failing with PostgreSQL, I simply wanted to get it working without setting up a PostgreSQL data source in "localhost".
The qml stylesheets OS provided first need to have various"virtual fields" added to the data tables. This is the tricky bit. The SQL code provided needs to be tinkered with to get it bug free.

I have found a way to make it work and I hope my experience may help other to solve this. Here is how I managed to do it. I suggest you make a copy of your original .gz layer file to work on in QGIS 3.10.

  1. For the layers topographicline and topographicarea, the required virtual fields fields can be added separately one after the other using the QGIS Open Field Calculator.
  2. First select the topographicline layer
  3. Click on Open Attribute Table (icon)
  4. Click on Open field calculator (icon)
  5. Enter the Output field name as style_description (no quotes)
  6. Enter the type as Text (string)
  7. Paste the SQL code from attached file [ topographicline SQL (string)-style_description.txt ]
    (the field names have all been amended to include quotes that were not present in the SQL code supplied by OS)
  8. This should be error free and should run.
  9. On completion open the Data Attribute table and check that the new field has been added as a "virtual field" at the end.
  10. Repeat this process for the field style_code (Whole number (integer) size 4). The code for this is in the attached file for style_code. [ topographicline SQL (string)-style_code.txt ].
  11. Once the fields are both in place in the table SAVE THE PROJECT
  12. Then Load the OS qml stylesheet for topographicline
  13. Repeat this process adding the two same virtual fields to the layer topographicarea.
    This requires the SQL code in files topographicarea SQL (string)-style_description.txt and topographicarea SQL (string)-style_code.txt .
    The descriptions and codes are all different for the topographicarea layer.
  14. Make sure the layer topographicline is ABOVE the layer topographicarea or it will not be visible
  15. Make sure you set the layer visibility to 1 in 6000 by right clicking on the layer.
  16. If you get this to work I suggest you save your Styles under a new name.
  17. SAVE THE PROJECT

I have managed to add the other virtual fields in other layers. There are numerous other virtual fields in the cartographictext layer and it was a bit more tedious. I have't yet managed to get the text layer to load the qml stylesheet.

If it works for you please let me know.

topographicarea SQL (string)-style_code.txt
topographicarea SQL (string)-style_description.txt
topographicline SQL (string)-style_code.txt
topographicline SQL (string)-style_description.txt

Inconsistent Assignment of Topographic Line Feature Style Codes

Style codes assigned to topographic line features using the Oracle SQL script are different to the codes assigned using the PostGIS SQL script. For example, topographic line features with a descriptive term of 'Polygon Closing Link' are assigned a code of 1 by the Oracle SQL script, whereas the PostGIS SQL script assigns code 6.

OS Mastermap styling not visible

I have loaded the boundary line, cartographic symbol, etc .gz files directly into QGIS and I then saved as .shp so I could add a 'style_code' attribute column which I noticed was needed for styling. I have followed the "Styling OS Mastermap Topography Layer Getting Started Guide" for how to use and style GIS GML files. When I Load Style and save all lines/features then disappear from my map. I am presuming I have done something wrong but I can't figure out what, any help would be really appreciated! Thanks in advance.

Properties set up:

image

Attributes table set up:

image

Very Slow ArcMap redraw speed - issue and "fix"

We were puzzled why redraw in ArcGIS 10.x was so slow using the v9 layers. The slowness being tracked to MMareas.

At 1:2,000 redraw time was often over 10 seconds, with our old v7 layer files Esri(UK) issued with the Productivity Suite, redraw was 1-3 seconds.

Long story short - it was the fact that the advanced layer options had been switched on in order to control the draw order - as far as I can tell this is so "Slopes" and "Cliffs" that have a diagonal line fill with transparent background, draw on top of whatever other feature they are on top of.

Switching this option off sped up redraw back to acceptable levels and to get Cliff and Slope fills on top I simply added the Area layer again with only these two styles listed (a SQL could be used, but this too slows the redraw, even if the field is indexed)

FME Suggestion

Given that your attribute manipulation requires lowercase attribute names can I suggest you add a BulkAttributeRenamer to the flow as shown below. GML data downloaded from OS has mixed case attribute names

Screenshot 2021-04-08 at 15 51 55

Schema v9 - OSMM. Labels missing in Geoserver

Hi, have translated original GZ to shapefiles, matching Schema v9, and we're serving them from Geoserver as WMS. While we know we have the correct data/structure and performance is good, some labels fail to render when loaded from Geoserver.

It happens when the label is partly outside the frame (which is expected behavior) but also for some street names that fall 100% inside the map frame. The point with the labeling attributes exists, but label won't generate. See image below where the red circle shows a point that should have an associated label, but it doesn't

image

I know this is related to how Geoserver processes images, because when tiling the WMS in different sizes, results change. Generally, using bigger tiles allows creating more labels but this is not ideal because we don't want to be generating big tiles all the time. Also, some labels as the one in the image will never generate even using large tiles.

A workaround would be creating smaller labels by modifying Schema v9 or Stylesheets. I'm confident that this would solve the issue, but again not ideal because we don't want to modify Schema v9 styling. Also would do if there was a conflict resolution parameter for Geoserver, but I'm afraid there's not.

Somebody found the same issue and experimenting with workarounds?

Is it possible to increase the rendering levels?

I have been using the OS MasterMap Topography WMTS service in QGIS. Recently I decided to use the view the vector data directly via PostGIS. Everything is working well except that the styling stops rendering at 1:4000. In the documentation it states;

"We recommend viewing the map between 1:500 and 1:4000 for maximum legibility and we have set the
minimum viewing scale at 1:4000"

Using the OS MasterMap Topography WMTS service you are able to zoom out to the full extent of the UK with styling for all levels. Is this styling ever going to be made available on GitHub or only through the WMTS service?

Thank you

SQL to assign style_codes is incorrect in cases where a regex match operator is used (~)

SQL to assign style_codes is incorrect in cases where a regex match operator is used (~) and the search phrase contains a bracket.

Postgres interprets the brackets as a regex group. To search for a phrase that contains a litteral bracket the brackets should be escaped with a backslash:

Compare the following searches :
SELECT * FROM topographicline WHERE descriptiveterm ~ 'Mean High Water (Springs)';
should be :
SELECT * FROM topographicline WHERE descriptiveterm ~ 'Mean High Water (Springs)';

QGIS-Field calculator further refinements

The closed issue QGIS-Field calculator missing trees resolved that issue but left several other blank areas on my map. By using Identify Features I determined that these had multiple values in descriptiveTerm or descriptiveGroup, for example descriptiveTerm Rough Grassland, Scrub.
Using the same technique as the one that resolved the missing trees issue, I replaced "descriptiveTerm" ~ with array_contains(descriptiveTerm, and added the necessary closing bracket. For example
WHEN "descriptiveTerm" ~ 'Rough Grassland' THEN 23
was replaced with
WHEN array_contains(descriptiveTerm, 'Rough Grassland') THEN 23

and likewise for descriptiveGroup, in both the style_code and style_description SQL code. This has resulted in a lot fewer blank spaces on the map. I have attached my code - you will see I did not change everything, I was being cautious.

I hope others find this useful.
topographicarea_SQL_style_code.txt
topographicarea_SQL_style_description.txt

Incorrect SLD Rule Name for Agricultural Land

The comment at the line linked to above appears to be for Agricultural land, but the description says 'Mixed Woodland'. The style code appears to align with the 'Agricultural Land Fill' style description. I'm guessing its just the SLD Rule Name that is wrong, but thought it should be flagged as it confused me initially! More instances of this error may exist.

Scale dependent rendering - scale ranges

There appears to be a problem with the minimum and maximum scale being 'switched' which did not occur when loading the topographic layers into QGis on previous occasions. I have included snippets below to illustrate...

<qgis version="3.4.8-Madeira" minScale="4000" simplifyDrawingTol ="1" simplifyMaxScale="1" maxScale="0" readOnly="0" styleCategories="AllStyleCategories"

<qgis version="2.18.7" minimumScale="-4.65661e-10" maximumScale="4000" simplifyDrawingHints="0" minLabelScale="0" maxLabelScale="1e+08" simplifyAlgorithm="0"

<qgis version="2.12.0-Lyon" minimumScale="-4.65661e-10" maximumScale="4000" simplifyDrawingHints="0" minLabelScale= "0" maxLabelScale="1e+08" simplifyDrawingTol="1"

Esri layer file style issues

There are a number of significant issues with the Esri layer files provided:

  1. Symbol rotations for Cartographic Symbol are incorrectly defined as "Geographic" when the OS Mastermap spec defines these as counter-clockwise from East (i.e. arithmetic). The expression used for symbol rotation is also incorrect and should instead be something like (orientation * 0.1) + 90.

  2. Symbols and labels associated with style codes in the unique value rendering for Topographic Point are incorrect when compared to the style guide (Related to #28). For example:

  • style code 2 should be "Culvert" but is defined as "Emergency Telephone"
  • style code 3 should be "Positioned Nonconiferous Tree" but is defined as "Site Of Heritage"
    etc

See below for comparison:

ArcGIS:
image

Style Guide:
image

CartographicText style doesn't work

Hi there, the OSMM Schema9 CartographicText .lyr files (all styles) don't work out of the box with Schema9 data processed through ProductivitySuite and ESRI UK's OSMM Style Tool for a couple of reasons:

  1. The SQL Query is looking for a column called colour_code but the actual column in the data is called color_code
    e.g.:
    ("font_code" = 1 AND "color_code" = 1 )

  2. The Expression that builds the Text String is looking for columns called height and textstring, but they're actually textheight and text respectively.
    e.g.:
    Function FindLabel ( [height], [textstring] ) if instr( [textstring], "&") > 0 then [textstring] = replace([textstring], "&", "&amp;") end if FindLabel = "<FNT size='" & [height] *1.9& "'>" & [textstring] & "</FNT>" End Function

Mapbox GL style for OSMM Topography Layer (Standard) has incorrect colour for Unclassified Fill

The OSMM Topography Layer (Standard).json has wrong fill-color (white) as below:

    {
      "id": "topographic area unclassified fill",
      "type": "fill",
      "source": "OSMasterMapTopography_gb_TopographicArea",
      "source-layer": "topographic_area",
      "filter": ["all", ["==", "style_code", 99]],
      "layout": {"visibility": "visible"},
      "paint": {"fill-color": "rgba(255, 255, 255, 1)"}
    }

The rgba values should match the OSMM-Topography-Layer-Colour-Values.xlsx colour values (248,246,240)

Greyscale styling

Not sure if this is something which already exists and hasn't been shared, as a lot of other OS products offer a greyscale styling. If it doesn't exist, is it possible to request this as a feature enhancement please? Thank you.

Cartographic Text labels are very small in ArcGIS Pro

I've been testing data loaded with the v9 values populated by Loader in ESRI ArcGIS Pro and I've found that the Cartographic Text labels are very small. I only have ArcGIS Pro to test with so I'm wondering if it's the same in ArcMap or whether the labels just need updating in the v9 .lyr files?

I'm using the .lyr files from /Schema version 9/Stylesheets/ESRI stylesheets (LYR)/.

By default the labels are very small:

arcgis pro - osmm_topo - small labels

Updating the expression of each class to multiply the [height] value by 3.5 appears to provide reasonable labels:

arcgis pro - osmm_topo - updated labels

OS MasterMap Topography QGIS stylesheets (QML)

I use OS MasterMap Topography as a base map but i have a problem with the style of the topographicarea layer. I loaded the cartographictext-standard.qml in QGIS but I get some question mark in some polygons as you can see in the attached screenshot.
qml

QGIS-Field calculator missing trees

The code in topographicarea_SQL_style_description.txt and topographicarea_SQL_style_code.txt is not classifying mixed tree descriptive terms correctly.
I am using QGIS release 3.24.0-Tisler and the 1 March 2022 download of the OS Mastermap.

The relevant lines of code (this from topographicarea_SQL_style_code.txt) are
--Natural Environment Descriptive Term Rules
WHEN ("descriptiveTerm" ~ 'Nonconiferous Trees' OR "descriptiveTerm" ~ 'Nonconiferous Trees (Scattered)') AND ("descriptiveTerm" ~ 'Coniferous Trees' OR "descriptiveTerm" ~ 'Coniferous Trees (Scattered)') THEN 13
WHEN "descriptiveTerm" ~ 'Nonconiferous Trees' OR "descriptiveTerm" ~ 'Nonconiferous Trees (Scattered)' THEN 14
WHEN "descriptiveTerm" ~ 'Coniferous Trees' OR "descriptiveTerm" ~ 'Coniferous Trees (Scattered)' THEN 15

The intention is plain enough: if the description includes both Nonconiferous and Coniferous trees it gets style_code 13; Nonconiferous trees are style_code 14 and Coniferous trees are style code 15. But my map has blank spaces where the trees should be. On looking at the codes allocated in two 5km x 5km squares in Durham City, this file lists the 33 descriptive terms that have been given the default style_code of 99: unclassified.txt

The first of these is Coniferous Trees, Nonconiferous Trees which is an obvious candidate for code 13. I notice that all of the unclassified descriptive terms for trees have a comma and perhaps this is causing the issue. Or is it a change in QGIS, or has the latest version of the Mastermap added extra descriptive terms?

GeoServer can't render some SVG graphics

GeoServer 2.13.2 outputs the following error for a number of symbols due the the rect SVG element having a height attribute with a negative value.

2018-09-17 14:29:52,259 DEBUG [geotools.rendering] - Error occurred evaluating external graphic
org.apache.batik.bridge.BridgeException: file:/path/to/geoserver/data_dir/styles/osmmsymbols/positionedConiferousTreeSymbol-backdrop.svg:-1
The attribute "height" of the element <rect> cannot be negative

I've found the following affected files:

  • osmmsymbols/culvertSymbol-backdrop.svg
  • osmmsymbols/positionedConiferousTreeSymbol-backdrop.svg
  • osmmsymbols/positionedConiferousTreeSymbol-light.svg
  • osmmsymbols/positionedConiferousTreeSymbol-outdoor.svg

I've updated my local copies to use a value of -1 and the symbols appear to display fine but thought I'd check ๐Ÿ˜ธ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.