Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Rob Emanuele
    @lossyrob
    @harts-boundless I have some parsing. What’s the best interface to plug into what you have?
    Rob Emanuele
    @lossyrob
    Rob Emanuele
    @lossyrob
    {
        "name": "NAIP",
        "description": "Naip from AWS",
        "license": "PDDL-1.0",
    
        "assets": [ ],
    
        "contact": {
            "name": "Aerial Photography Field Office (APFO)",
            "email": "apfo.sales@slc.usda.gov",
            "phone": "801-844-2922"
        },
    
        "formats": [ "cog", "geotiff" ],
    
        "homepage": "https://aws.amazon.com/public-datasets/naip/",
    
        "provider": {
            "type": "aws",
            "region": "us-east-1",
            "requesterPays": "true"
        }
    }
    Rob Emanuele
    @lossyrob
    def feature_from_naip(key_template, naip_md):
    
        md = naip_md
        date = md.get("calendar_date")
        iso_date_time = arrow.get(date, 'YYYYMMDD').isoformat()
    
        bounds_md = md["identification_information"]["spatial_domain"]["bounding_coordinates"]
        xmin, xmax = float(bounds_md['west_bounding_coordinate']), float(bounds_md['east_bounding_coordinate'])
        ymin, ymax = float(bounds_md['south_bounding_coordinate']), float(bounds_md['north_bounding_coordinate'])
        geom = { 'type': 'Polygon', 'coordinates': [[[xmin, ymin],
                                                     [xmin, ymax],
                                                     [xmax, ymax],
                                                     [xmax, ymin],
                                                     [xmin, ymin]]] }
    
        id_components = key_template.split("/")[:-2]
        id = os.path.join(id_components[0], os.path.splitext(id_components[1])[0])
        return {
            'id': id,
            'type': 'Feature',
            'geometry': {
                'coordinates': [
                    [
                        [
                            -87.875,
                            30.625
                        ],
                        [
                            -87.875,
                            30.6875
                        ],
                        [
                            -87.8125,
                            30.6875
                        ],
                        [
                            -87.8125,
                            30.625
                        ],
                        [
                            -87.875,
                            30.625
                        ]
                    ]
                ],
                'type': 'Polygon'
            },
            'assets': [
                { 'format': 'cog',
                  'uri':  key_template.format('rgb'),
                  'bands': ["Red", "Green", "Blue"] },
                { 'format': 'geotiff',
                  'uri': key_template.format('rgbir'),
                  'bands': ["Red", "Green", "Blue", "NIR"] },
            ],
            'properties': {
                "startDate": iso_date_time,
                "endDate": iso_date_time,
                "geometry": geom,
                "source_metadata": md
            }
        }
    aws s3api get-object --bucket aws-naip --key al/2013/1m/fgdc/30087/m_3008718_sw_16_1_20130805.txt --request-payer requester m_3008718_sw_16_1_20130805.txt
    Sasha Hart
    @harts-boundless
    pushed version with your schema upgrade to that routine ^ but that doesn't achieve the newer 3-item structure