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:
...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?
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):
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?