Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group Shapefiles in Folder #2572

Closed
rajadain opened this issue Dec 28, 2017 · 3 comments
Closed

Group Shapefiles in Folder #2572

rajadain opened this issue Dec 28, 2017 · 3 comments
Assignees
Labels
HydroShare Export WPF Funding Source: William Penn Foundation WPF 2-4

Comments

@rajadain
Copy link
Member

rajadain commented Dec 28, 2017

Currently, the Shapefiles are exported to HydroShare at the top level, where they are mixed in with other file types:

HydroShare Resource Files

In order to open a Shapefile, all the files have to be available in the same folder. hs_restclient supports creating folders, as does their UI. However, while a user can create folders in the UI, creating those via hs_restclient or the API results in a HydroShareNotAuthorized error. This is a problem on their end and they are looking in to it: hydroshare/hydroshare#2537.

Once that is resolved, uncomment these lines:

# TODO Re-enable once hydroshare/hydroshare#2537 is fixed,
# and export all GeoJSON and Shapefiles in that folder
# aoi_folder = 'area-of-interest'
# hs.createResourceFolder(resource, pathname=aoi_folder)

And update these lines:

for ext in SHAPEFILE_EXTENSIONS:
filename = '/tmp/{}.{}'.format(resource, ext)
with open(filename) as shapefile:
hs.addResourceFile(resource, shapefile,
'area-of-interest.{}'.format(ext))
os.remove(filename)

to reflect the folder name, like this:

for ext in SHAPEFILE_EXTENSIONS:
    filename = '/tmp/{}.{}'.format(resource, ext)
    with open(filename) as shapefile:
        hs.addResourceFile(resource, shapefile,
                           '{}/shape.{}'.format(aoi_folder, ext))
    os.remove(filename)
@rajadain rajadain added blocked HydroShare Export WPF Funding Source: William Penn Foundation WPF 2-4 labels Dec 28, 2017
@rajadain rajadain added queue and removed blocked labels Jan 11, 2018
@rajadain
Copy link
Member Author

Unblocked as hydroshare/hydroshare#2537 is complete.

@rajadain rajadain self-assigned this Jan 15, 2018
@rajadain
Copy link
Member Author

Still seeing the same behavior on beta, it is likely that their update hasn't been deployed yet.

rajadain added a commit that referenced this issue Jan 15, 2018
Currently all shapefiles are exported to the root as
area-of-interest.shp, .prj, .shx, etc. All these files
need to be present in the same folder to open them, so
to make it easier to use they should be grouped together
rather than in the same space as all the rest.

With this update, we'll have:

    - analyze_land.csv
      ...
    - area-of-interest.geojson
    - area-of-interest/
      - shape.shp
      - shape.shx
      - shape.prj
        ...
    - scenario_current_conditions.gms
      ...

Refs #2572
@rajadain
Copy link
Member Author

Interestingly, this seems to be happening by itself now:

image

image

Possibly a consequence of

# Add geographic coverage
endpoint.functions.set_file_type({
'file_path': 'area-of-interest.shp',
'hs_file_type': 'GeoFeature',
})

in #2609.

I'm going to add a commit to remove the TODOs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HydroShare Export WPF Funding Source: William Penn Foundation WPF 2-4
Projects
None yet
Development

No branches or pull requests

2 participants