skaymen / nldi-services

Network Linked Data Index Navigation Web Services

Home Page:https://cida.usgs.gov/nldi/about

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NLDI REST (like) Services

Build Status

Public API

The services are accessed via an http GET request. All navigation output is generated as GeoJSON ("application/vnd.geo+json")

The root is {host}/nldi.

Both a test and a production are exposed to the public: https://cida-test.er.usgs.gov/nldi is the test root. https://cida.usgs.gov/nldi is the production root. This endpoint will give you the valid dataSource names for the other endpoints. There is documentation at /about and a demo UI at /about/demo.

Display Up/Down Stream Flow Lines

/{featureSource}/{featureSourceId}/navigate/{navigationMode} where:

  • {featureSource} identifies the source used to start navigation:
    • comid start the navigation from an NHDPlus comid
    • any of the network linked feature sources (listed at /)
  • {featureSourceId} the NHDPlus comid or feature from which to start the navigation
  • {navigationMode} is the direction and type of navigation:
    • DD is __D__ownstream navigation with __D__iversions
    • DM is __D__ownstream navigation on the __M__ain channel
    • PP is __P__oint to __P__oint navigation (the stopComid query parameter is required and must be downstream of the {comid})
    • UM is __U__pstream navigation on the __M__ain channel
    • UT is __U__pstream navigation including all __T__ributaries

Display Up/Down Stream Events

/{featureSource}/{featureSourceId}/navigate/{navigationMode}/{dataSource} where:

  • {featureSource} identifies the source used to start navigation (same values as for Flow Lines)
  • {featureSourceId} the NHDPlus comid or other feature from which to start the navigation
  • {navigationMode} is the direction and type of navigation (same values as for Flow Lines)
  • {dataSource} is the abbreviation of the data source from which events should be shown

Query Parameters

Both endpoints accept the same query parameters to further refine/restrict the navigation being requested

  • distance={dist} limit the navigation to {dist} kilometers from the starting point
  • stopComid={stopid} for use with PP navigation between the {featureSourceId} and {stopid}
    • (only applicable to NHDPlus comid navigation and the {stopid} must be downstream of the {featureSourceId})

Developer Environment

nldi-db contains everything you need to set up a development database environment. It includes data for the Yahara River in Wisconsin.

To run the project you will need to create the file application.yml in the project's root directory and add the following:

nldiDbHost: hostNameOfDatabase
nldiDbPort: portNumberForDatabase
nldiDbUsername: dbUserName
nldiDbPassword: dbPassword

serverPort: 8080
serverContext: '/nldi'

nldiProtocol: http
nldiHost: localhost:8080

To run:

% mvn spring-boot:run

This project has some integration testing against the database. The "package" goal of the maven command will stop the build before running them. To set up the project for running the integration tests, add the following to your maven settings.xml file (the values below will work with the nldi-db docker container running on the same machine as the tests):

<profiles>
  <profile>
    <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <nldi.url>jdbc:postgresql://127.0.0.1:5433/nldi</nldi.url>
        <nldi.dbUsername>nldi</nldi.dbUsername>
        <nldi.dbPassword>nldi</nldi.dbPassword>
        <nldi.dbUnitUsername>nldi</nldi.dbUnitUsername>
        <nldi.dbUnitPassword>nldi</nldi.dbUnitPassword>
      </properties>
  </profile>
</profiles>

If running integration tests without maven, you may specify the properties in the file, application-it.yml. See the maven-failsafe-plugin configuration in the pom.xml for the mapping of properties to varables.

About

Network Linked Data Index Navigation Web Services

https://cida.usgs.gov/nldi/about

License:Other


Languages

Language:Java 99.6%Language:Dockerfile 0.4%