0

I need to convert a GML file to GeoJSON from this website (https://use-land-property-data.service.gov.uk/datasets/inspire/download) and store it in my MongoDB database.

I have read a few posts on here and managed to install Conda on my windows machine and then in the conda prompt went to the input.gml directory and used

ogr2ogr -f GeoJSON output.geojson input.gml

Now when uploading the output.geojson into my db, I get the console error: "offset is out of bounds". Does anyone know why this is?

Code for my LRCP schema:

const featureSchema = new Schema({
    properties: Object,
    geometry: Object
});

const lrcpSchema = new Schema({
  councilName: {
    type: String,
    unique: true, // Ensure each council has a unique name
    required: true,
  },
  features: [featureSchema],
});
3
  • 1
    Can you add a sample point in each format?
    – Ian Turton
    Commented Jan 6 at 15:39
  • 1
    Just a guess, but perhaps you should use layer creation option -lco RFC7946=YES that converts data into WGS84 lon-lat coordinates gdal.org/drivers/vector/geojson.html#layer-creation-options.
    – user30184
    Commented Jan 6 at 17:27
  • Here is the start of the .geojson file: "geometry": { "type": "Polygon", "coordinates": [ [ [ 340410.049999999988358, 399791.700000000011642 ], [ 340418.650000000023283, 399785.349999999976717 ] and for the gml: <LR:GEOMETRY><gml:Polygon srsName="urn:ogc:def:crs:EPSG::27700" srsDimension="2" gml:id="PREDEFINED.fid--7a61a0dc_18c2dff496b_-b84.GEOMETRY"><gml:exterior><gml:LinearRing><gml:posList>340410.05 399791.7 340418.65 399785.35 So the points are rounded up, and dont look skewed.. Commented Jan 6 at 17:28

1 Answer 1

1

The -lco RFC7946=YES command was correct for transforming the GML data to GeoJSON correctly.

Also I was trying to store over 100k documents in one sub-collection which I think was causing an error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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