1

I'm attempting to get property data and geometry from King County. The county provides a KML file with property data as extended data and the geometry as a polygon.

<Placemark>
    <Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
    <ExtendedData><SchemaData schemaUrl="#OGRGeoJSON">
        <SimpleData name="OBJECTID">2</SimpleData>
        <SimpleData name="MAJOR">000020</SimpleData>
        <SimpleData name="MINOR">0003</SimpleData>
        <SimpleData name="PIN">0000200003</SimpleData>
        <SimpleData name="CTYNAME">KENT</SimpleData>
        <SimpleData name="KROLL">351</SimpleData>
        <SimpleData name="KCTP_CITY">TUKWILA</SimpleData>
        <SimpleData name="KCTP_STATE">WA</SimpleData>
        <SimpleData name="PLSS">NW36-23-4</SimpleData>
        <SimpleData name="PROP_NAME">VACANT-UNBUILDABLE</SimpleData>
        <SimpleData name="PLAT_NAME">ADAMS # 43</SimpleData>
        <SimpleData name="PLAT_LOT"></SimpleData>
        <SimpleData name="PLAT_BLOCK"></SimpleData>
        <SimpleData name="LOTSQFT">5400</SimpleData>
        <SimpleData name="LEVYCODE">1514</SimpleData>
        <SimpleData name="LEVY_JURIS">KENT</SimpleData>
        <SimpleData name="NEW_CONSTR"></SimpleData>
        <SimpleData name="TAXVAL_RSN">EX</SimpleData>
        <SimpleData name="APPRLNDVAL">70000</SimpleData>
        <SimpleData name="APPR_IMPR">0</SimpleData>
        <SimpleData name="TAX_LNDVAL">0</SimpleData>
        <SimpleData name="TAX_IMPR">0</SimpleData>
        <SimpleData name="ACCNT_NUM">000020000303</SimpleData>
        <SimpleData name="KCTP_TAXYR">2018</SimpleData>
        <SimpleData name="QTS">NW</SimpleData>
        <SimpleData name="SEC">36</SimpleData>
        <SimpleData name="TWP">23</SimpleData>
        <SimpleData name="RNG">4</SimpleData>
        <SimpleData name="PRIMARY_ADDR">1</SimpleData>
        <SimpleData name="LEGALDESC">ADAMS HENRY-D C # 43 PORTION OF E 1/2 OF NW 1/4 OF SECTION 36-23-04 DAF - BAAP 495.75 FT W &amp; 30 FT S OF NE CORNER OF DONATION LAND CLAIM OF HENRY ADAMS &amp; RUNNING TH W ALONG A LINE PLT &amp; 30 FT DISTANT FROM N BDRY OF SAID DONATION CLAIM 60 FEET TH SOUTH 12</SimpleData>
        <SimpleData name="Shape_Length">330.703713588579</SimpleData>
        <SimpleData name="Shape_Area">5453.96692462455</SimpleData>
        <SimpleData name="PROPTYPE">C</SimpleData>
        <SimpleData name="KCA_ZONING">GC-MU</SimpleData>
        <SimpleData name="KCA_ACRES">0.12396694</SimpleData>
        <SimpleData name="PREUSE_CODE">316</SimpleData>
        <SimpleData name="PREUSE_DESC">Vacant(Industrial)                                </SimpleData>
    </SchemaData></ExtendedData>
      <Polygon><outerBoundaryIs><LinearRing><coordinates>-122.241931952865741,47.441107997224584 -122.241931597176986,47.441084479847163 -122.241929402471882,47.440806398246821 -122.242052947531079,47.440807162955139 -122.242116337989302,47.440807556009545 -122.242112222694232,47.441113117645983 -122.242111918035917,47.441135675318513 -122.242111906550406,47.441136522722907 -122.241932395470812,47.44113540982967 -122.241931952865741,47.441107997224584</coordinates></LinearRing></outerBoundaryIs></Polygon>
  </Placemark>

When converting from KML to GeoJSON using 'ogr2ogr -f GeoJSON KingCounty.json KingCounty.kml' I end up losing all the extended data and am left with only the geometry.

"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "Name": "", "Description": "" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.239655323206762, 47.439872495270031 ], [ -122.239658913915193, 47.439547229939116 ], [ -122.239826775097484, 47.439546437116462 ], [ -122.239832919790416, 47.438716949742222 ], [ -122.239835980785898, 47.438305537666473 ], [ -122.239838133651148, 47.438016427634139 ], [ -122.23984826958349, 47.437573614805274 ], [ -122.239858559717646, 47.437316539463268 ], [ -122.239867711455943, 47.436471193813226 ], [ -122.239867793389095, 47.436463734705136 ], [ -122.23979429417686, 47.43607709965486 ], [ -122.239753132737903, 47.435870757751374 ], [ -122.239653427977956, 47.435331830942694 ], [ -122.239642843986402, 47.435280962006658 ], [ -122.239702972482021, 47.435313832618746 ], [ -122.23972103551651, 47.435324302204535 ], [ -122.239738860601008, 47.43533493925522 ], [ -122.239740381166726, 47.435335880079066 ], [ -122.239756446923252, 47.435345713619441 ], [ -122.239773876977395, 47.435356687339123 ], [ -122.239790781053401, 47.435367637417876 ], [ -122.239791027871419, 47.435367798873635 ], [ -122.239807981213431, 47.435379077372389 ], [ -122.239824695867114, 47.435390495926178 ], [ -122.239841212968699, 47.435402081444437 ], [ -122.2398574517225, 47.435413834929257 ], [ -122.239873491447383, 47.435425700558127 ], [ -122.239875884005883, 47.435427507987939 ], [ -122.239972221755082, 47.435509884876602 ], [ -122.240022769871416, 47.435553131771769 ], [ -122.239881155618519, 47.435005320101688 ], [ -122.239890404083013, 47.433951789726599 ], [ -122.240085404967232, 47.433952643479387 ], [ -122.240677442865504, 47.437175600936236 ], [ -122.240712083046716, 47.437374591729011 ], [ -122.240742993958619, 47.437574195820368 ], [ -122.240674939666221, 47.43757874744022 ], [ -122.240662571275507, 47.437579574067136 ], [ -122.240693546726064, 47.437810384222281 ], [ -122.24071945205236, 47.438041818274066 ], [ -122.240740274789445, 47.438273764862473 ], [ -122.240756004917969, 47.438506112380885 ], [ -122.240836759766609, 47.438504007959935 ], [ -122.240847556312559, 47.438742352896057 ], [ -122.240852972879381, 47.438980880745127 ], [ -122.24077215987532, 47.438981305077085 ], [ -122.240772509286444, 47.439185649114499 ], [ -122.240768892493577, 47.439389961440426 ], [ -122.240768403601564, 47.439407805239512 ], [ -122.240700974187718, 47.439508709311916 ], [ -122.240669025986222, 47.439556518111615 ], [ -122.240498785892299, 47.439650780368432 ], [ -122.240462346011725, 47.439658280644551 ], [ -122.240364466874553, 47.439678425352419 ], [ -122.24034465632829, 47.439682502986052 ], [ -122.24015419720169, 47.439732128513789 ], [ -122.239968627373671, 47.439781658804627 ], [ -122.239752778660147, 47.439837275733993 ], [ -122.239661228947284, 47.43987036146941 ], [ -122.239655323206762, 47.439872495270031 ] ] ] } },
{ "type": "Feature", "properties": { "Name": "", "Description": "" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.241931952865741, 47.441107997224584 ], [ -122.241931597176986, 47.441084479847163 ], [ -122.241929402471882, 47.440806398246821 ], [ -122.242052947531079, 47.440807162955139 ], [ -122.242116337989302, 47.440807556009545 ], [ -122.242112222694232, 47.441113117645983 ], [ -122.242111918035917, 47.441135675318513 ], [ -122.242111906550406, 47.441136522722907 ], [ -122.241932395470812, 47.44113540982967 ], [ -122.241931952865741, 47.441107997224584 ] ] ] } },
{ "type": "Feature", "properties": { "Name": "", "Description": "" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.242879648626285, 47.441141279248839 ], [ -122.242879708336133, 47.441136829696333 ], [ -122.242879956621422, 47.441118333543038 ], [ -122.242881852003705, 47.44097755072135 ], [ -122.242884077211301, 47.440812311109838 ], [ -122.242884289433434, 47.440812312585336 ], [ -122.243086112607756, 47.440813562037043 ], [ -122.243083883891416, 47.440979171867042 ], [ -122.243081994438711, 47.441119705107965 ], [ -122.243081759335439, 47.441137115287269 ], [ -122.243081687278732, 47.441142528788298 ], [ -122.242879763847085, 47.44114128055886 ], [ -122.242879648626285, 47.441141279248839 ] ] ] } },

It extends on to finish listing the coordinates.

Is there any way to have the conversion from KML to JSON keep the extended data? This is the only way so far that's worked for me, the KML file is 2.6Gb and can't be read into JavaScript or Python.

  • You should paste the code instead of inserting pictures. Pressing the {} button will format the pasted code correctly. – Marcelo Villa May 3 '18 at 23:12
  • Does your GDAL have KML or LIBKML driver, or both? In which order they appear if you list the drivers with ogrinfo --formats? – user30184 May 4 '18 at 5:52
1

The MyGeodata Converter converts KML to GeoJSON (and other formats) with all attributes - also with extended data. I have just tried to convert some KMLs of King County to GeoJSON - all results include extended data attributes...

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.