I have a 2MB shapefile that when converted to GeoJSON becomes 10MB:

$ ogr2ogr -f "GeoJSON" -t_srs EPSG:900913 
  landfill.geojson Authorised_Landfill_Sites_010k.shp

I can reduce the size of the GeoJSON a bit by adding -lco COORDINATE_PRECISION=4 to the command.

However, I've noticed that there are an awful lot of properties in the GeoJSON that I don't need, so I'd like to remove them completely:

 { "type": "Feature", "properties": { "LIC_ADMIN": null, "LIC_NMBR": null, "LIC_IPPCR": "HP3532LV", "LIC_WML": 0.000000, "CUST_NMBR": 0.000000, "STATUS": "Ef     fective", "LIC_LTYPE": "5.2 A(1) a)", "LIC_NAME": "Yorwaste Limited", "LIC_SITE": "HAREWOOD WHIN LANDFILL", "SITE_NAME": "HAREWOOD WHIN LANDFILL", "SITE_BUI     LD": null, "SITE_STRT": "Harewood Whin Landfill", "SITE_AREA": "Tinker Lane", "SITE_TOWN": null, "SITE_CNTY": "Rufforth", "SITE_PCODE": "YO23 3RR", "TYPE_DE     SC": "WASTE LANDFILLING; >10 T\/D WITH CAPACITY >25,000T EXCLUDING INERT WASTE", "NGR": null, "T_REF": "NE4731", "CTROID_X": 453600.000000, "CTROID_Y": 4513     00.000000, "REGION": "North East", "AREA": "Yorkshire", "DATE_ISSUE": "2007\/06\/21", "LIC_EPR": "EA\\EPR\\BK0507IB" }, "geometry": { "type": "Polygon", "co     ordinates": [ [ [ -131830.27, 7161699.84 ]

Can I use ogr2ogr to remove these properties at the time of conversion, and just keep the coordinates, or should I post-process the GeoJSON to do this?

2 Answers 2


There are couple of alternatives. First one it to use the -select option that is documented on the manual page http://www.gdal.org/ogr2ogr.html

-select field_list: Comma-delimited list of fields from input layer to copy to the new layer. A field is skipped if mentioned previously in the list even if the input layer has duplicate field names. (Defaults to all; any field is skipped if a subsequent field with same name is found.) Starting with OGR 1.11, geometry fields can also be specified in the list.

Another way which gives more freedom because you can also rename the fields and much more is to use the -sql parameter. GDAL supports two dialects: OGR SQL http://www.gdal.org/ogr_sql.html and SQLite SQL http://www.gdal.org/ogr_sql_sqlite.html. SQLite dialect has more features but for your need OGR SQL works as well. The syntax is like:

ogr2ogr -f "GeoJSON" -t_srs EPSG:4326 -sql "select geometry, attr_1, attr_3 from Authorised_Landfill_Sites_010k" landfill.geojson Authorised_Landfill_Sites_010k.shp
  • Thanks. I did look at the manual page, but I obviously didn't read all the small print carefully enough, because I didn't see that!
    – Richard
    Jan 20, 2015 at 15:50

If your request is from esri server then remember to request in geojson or the response will remove fields that contain no data, or maybe you want that. pjson or json

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.