2

I got a GML file from an ArcGIS-based WFS server and converted it to GeoJSON using Ogre (online ogr2ogr), but then got very strange results from that GeoJSON file.

Here's the link to the getCapabilities page of the WFS server:

http://sedsh127.sedsh.gov.uk/arcgis/services/ScotGov/HumanHealthSafety/MapServer/WFSServer?request=GetCapabilities&service=WFS

...which seems to be saying that it's latitue / longitude unless I'm reading it wrong:

<ows:ExtendedCapabilities>
 <ows:Constraint name="serviceAxisOrderForSwappableSRS">
  <ows:Value>latitude,longitude</ows:Value>
 </ows:Constraint>
</ows:ExtendedCapabilities>

...but the actual data doesn't look like latitude and longitude. Here's a sample from the start of the GML/XML file, the six-figure numbers aren't what I was expecting, and there's something I don't understand about an envelope:

<wfs:FeatureCollection previous='-1' next='-1' numberMatched='-1' numberReturned='-1' xsi:schemaLocation='http://sedsh127.sedsh.gov.uk/arcgis/services/ScotGov/ScotGov_HumanHealthSafety/MapServer/WFSServer http://sedsh127.sedsh.gov.uk/arcgis/services/ScotGov/HumanHealthSafety/MapServer/WFSServer?request=DescribeFeatureType%26version=2.0.0%26typename=NHS_Health_Boards__2014_ http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd' xmlns:HHS='http://sedsh127.sedsh.gov.uk/arcgis/services/ScotGov/ScotGov_HumanHealthSafety/MapServer/WFSServer' xmlns:gml='http://www.opengis.net/gml/3.2' xmlns:wfs='http://www.opengis.net/wfs/2.0' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><gml:boundedBy><gml:Envelope srsName='urn:ogc:def:crs:EPSG:6.9:27700'><gml:lowerCorner>5513 530249</gml:lowerCorner><gml:upperCorner>470332 1220301.5</gml:upperCorner></gml:Envelope></gml:boundedBy><gml:member><HHS:NHS_Health_Boards__2014_ gml:id='F1378__1'><HHS:OBJECTID>1</HHS:OBJECTID><HHS:HBCode>S08000015</HHS:HBCode><HHS:HBName>Ayrshire and Arran</HHS:HBName><HHS:Shape><gml:MultiSurface srsName="urn:ogc:def:crs:EPSG:6.9:27700"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList> 225054.5 669796 225053.5 669806.5 225041.5 669820.5 225036 669831 225037 669835 225049 669845.5 225052 669856 225052 669859.5 225045.5 669875.5 225042 669897.5 225037.5 669912 225036 669930 225048 669961 225048.70000000019 670000 225048.79999999981 670000.09999999963 225048 670008.5 225039 670027 225017.5 670036.5 225016 670040.5 225016 670047 225019.5 670056 225023 670076 225036 670120 225033.5 670131.5 225023 670152.5 225000 670148.5 224975 670139.5 224835.5 670136.5 224517 670000.09999999963 224516.90000000037 670000 224205 669872.5 224098.5 669645 224095 669634 224091.5 669631 224080 669626 224076 669619.5 224076.5 669614 224074.5 669607.5 224069.5 669602.5 224055.5 669595.5 224052.5 669584.5 224042 669576.5 224034.5 669575 224024.5 669578.5 224019.5 669578.5 224009.5 669576 223998.5 669560.5 223990.5 669554 223975.5 669546.5 223964.5 669543.5 223949 669545 

Here's what it says about projections, and I didn't define any projections when extracting or converting the data. I may have misunderstood this, but my understanding is that if co-ordinates are lat/long they'd be independent of projections and projections would only matter when they're rendered?

<DefaultCRS>urn:ogc:def:crs:EPSG:6.9:27700</DefaultCRS>
<OtherSRS>urn:ogc:def:crs:EPSG:6.9:4326</OtherSRS>

I also don't recognise EPSG:6.9:27700, searching on it suggests it's something only the UK government uses.


Whatever this is, mapshaper.org is capable of reading it as a map of Scotland (left) but D3 doesn't know what's going on (right):

enter image description here enter image description here

I think what I need to do is work out what co-ordinate system I'm being given, then work out how to convert it, but I can't see how to find out. The publisher (Scottish govt) give very little data around this and I don't think there's anyone I can ask.

Is there some way of "reading" the co-ordinate system from the WFS server, from the GML file, or from the GeoJSON? (or even better a converter that can figure it out and fix as it goes?)


Update: I think I might have figured out the specific cause of my problems, but I'd still like a general answer on what the 'correct' method to figure this out it is as opposed to my bumbling:

Truncating the projection code to EPSG:27700 losing the 6.9 turns up the Ordnance Survey National Grid, which is:

a system of geographic grid references used in Great Britain, different from using Latitude and Longitude. It is often called British National Grid (BNG).

...so it's clearly not just a projection, it's actually a whole different grid system as well. This would seem to explain why D3 is so confused. I'm not sure how someone would normally know this though, beyond knowing to recognise 27700 as a projection that also comes with a non-standard co-ordinate system?

3

The data's bounding box is defined with geographic coordinates. I guess this is what caused the confusion.

The data itself, however has the EPSG code 27700, hence the element <DefaultCRS>urn:ogc:def:crs:EPSG:6.9:27700</DefaultCRS>.

This means, that the data will be in EPSG 27700 unless otherwise specified. In this case, EPSG 4326 would be a possible alternative. You can look up the SRS characteristics on sites like spatialreference.org.

If you need your WFS result to be in 4326, simply add &srsName=EPSG:4326 to your WFS request.

The identifiers written before the EPSG code are used to unambiguously define WFS elements. The exact definition can be looked up at the EPSG home page. In this specific case its

  • urn: Universal Resource Name
  • ogc: Open Geospatical Consortium
  • def: Definition
  • crs: Coordinate Reverence System
  • EPSG: European Petroleum Survey Group

The 6.9 means that the SRS 4326 specified in version 6.9 of the EPSG database, which you can find here.

  • What do the 6.9 parts of the EPSG codes mean? I've been looking for some sort of breakdown of what the components of an EPSG code mean but I can't find one – user568458 Jul 24 '16 at 19:10
  • I updated the post and added some more details. – karpfen Jul 24 '16 at 19:24
  • 1
    Thanks! I also literally just asked it as a separate question here so feel free to copy that part there for more rep :-) – user568458 Jul 24 '16 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.