create a shapefile from PlanetScope scene coordinates

Comments

6 comments

  • Official comment
    Frank Warmerdam

    Daniel,

    You can query the data api for products with the "planet" command which returns geojson, then it is easy to change that to a shapefile with ogr2ogr, or use the geojson directly with most applications. 

     

    eg.

    $ planet data search --item-type PSScene3Band \
    --date published gt 2014-01-01 --date published lt 2017-01-01 \
    --limit=1000 > result.geojson
    $ ogr2ogr -f "ESRI Shapefile" result.shp result.geojson
    Warning 6: Field acquired create as date field, though DateTime requested.
    Warning 6: Normalized/laundered field name: 'satellite_id' to 'satellite_'
    Warning 6: Normalized/laundered field name: 'sun_elevation' to 'sun_elevat'
    Warning 6: Normalized/laundered field name: 'pixel_resolution' to 'pixel_reso'
    Warning 6: Normalized/laundered field name: 'usable_data' to 'usable_dat'
    Warning 6: Normalized/laundered field name: 'ground_control' to 'ground_con'
    Warning 6: Normalized/laundered field name: 'anomalous_pixels' to 'anomalous_'
    Warning 6: Field updated create as date field, though DateTime requested.
    Warning 6: Normalized/laundered field name: 'quality_category' to 'quality_ca'
    Warning 6: Normalized/laundered field name: 'sun_azimuth' to 'sun_azimut'
    Warning 6: Normalized/laundered field name: 'cloud_cover' to 'cloud_cove'
    Warning 6: Field published create as date field, though DateTime requested.
    $ ls -l result.*
    -rw-rw-r-- 1 frank frank 778802 Mar 21 20:59 result.dbf
    -rw-rw-r-- 1 frank frank 1673394 Mar 21 20:59 result.geojson
    -rw-rw-r-- 1 frank frank 143 Mar 21 20:59 result.prj
    -rw-rw-r-- 1 frank frank 136100 Mar 21 20:59 result.shp
    -rw-rw-r-- 1 frank frank 8100 Mar 21 20:59 result.shx

    If you have a recent version of GDAL/OGR, you can also use the PLScenes: driver like this to directly create a shapefile.

    $ export PL_API_KEY=xxx
    $ ogr2ogr -f "ESRI Shapefile" \
    query_out.shp \
    PLScenes: \
    PSScene3Band \
    -where "published > '2015-01-01' and published > '2014-01-01'" \
    -spat -117 33 -116 34 -limit 1000

     

  • Daniel Rodriguez

    Is this done in the Planet Explorer or when you select the scenes and click on the API icon and where do you download GDAL/OGR ?

     

    Any help would be appreciated.

  • Sara Safavi

    Hi Daniel,

     

    Frank's example above is using the "planet" CLI tool to interact with Planet's Data API -- you can learn more about that tool in this recent blog post from Sam Roy: https://medium.com/@samapriyaroy/demystifying-planets-command-line-tool-660870b32317

     

    To learn more about downloading and installing GDAL/OGR, check out this guide: https://developers.planet.com/planetschool/gdal-qgis-installation-setup/

  • Daniel Rodriguez

    It seems to difficult for a non programmer to learn.

    I don't have the time to learn a new program plus the link is not straight forward to download the planet CLI tool with Planet's Data API for a non programmer.

  • Daniel Rodriguez

    Where do type this statement below? 

    $ planet data search --item-type PSScene3Band \
    --date published gt 2014-01-01 --date published lt 2017-01-01 \
    --limit=1000 > result.geojson

  • Frank Warmerdam

    Daniel,

    I think Sam's post that Sara referenced is the best starting point for someone new to the planet command line interface.  

    https://medium.com/planet-stories/demystifying-planets-command-line-tool-660870b32317

    I had not understood from your first question that you were ideally looking for a solution from within Planet Explorer.

    Best regards,

    Frank

Please sign in to leave a comment.