Skip to content

Commit

Permalink
Merge pull request #16 from USEPA/owld_stubs
Browse files Browse the repository at this point in the history
merge for version 1.2
  • Loading branch information
pauldzy authored Jan 21, 2025
2 parents b74ca7c + 8046f94 commit 941736e
Show file tree
Hide file tree
Showing 230 changed files with 6,646 additions and 582 deletions.
32 changes: 30 additions & 2 deletions demo/Dockerfileng.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,30 @@ ARG ARG_POSTGREST_PORT
{%- else %}
{%- set postgrest_port = cip_pr_port %}
{%- endif %}

{%- if cip_gis_type == 'env.GIS_TYPE' %}
{%- set gis_type = '${ARG_GIS_TYPE}' %}
ARG ARG_GIS_TYPE
{%- else %}
{%- set gis_type = cip_gis_type %}
{%- endif %}
{%- if cip_gis_prot == 'env.GIS_PROT' %}
{%- set gis_prot = '${ARG_GIS_PROT}' %}
ARG ARG_GIS_PROT
{%- else %}
{%- set gis_prot = cip_gis_prot %}
{%- endif %}
{%- if cip_gis_host == 'env.GIS_HOST' %}
{%- set gis_host = '${ARG_GIS_HOST}' %}
ARG ARG_GIS_HOST
{%- else %}
{%- set gis_host = cip_gis_host %}
{%- endif %}
{%- if cip_gis_port == 'env.GIS_PORT' %}
{%- set gis_port = '${ARG_GIS_PORT}' %}
ARG ARG_GIS_PORT
{%- else %}
{%- set gis_port = cip_gis_prot %}
{%- endif %}
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update &&\
Expand All @@ -32,10 +55,15 @@ COPY ./nginx/html /usr/share/nginx/html
COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=docs ./openapi.yml /usr/share/nginx/html/openapi.yml

RUN printf "\
RUN printf "\
const postgrest_prot = '{{ postgrest_prot }}';\n\
const postgrest_host = '{{ postgrest_host }}';\n\
const postgrest_port = '{{ postgrest_port }}';\n\

const gis_type = '{{ gis_type }}';\n\
const gis_prot = '{{ gis_prot }}';\n\
const gis_host = '{{ gis_host }}';\n\
const gis_port = '{{ gis_port }}';\n\
" > /usr/share/nginx/html/config.js

EXPOSE 80
Expand Down
20 changes: 20 additions & 0 deletions demo/docker-compose.j2
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@ services:
ARG_POSTGREST_PORT: ${POSTGREST_PORT:-3000}
{%- else %}
ARG_POSTGREST_PORT: {{ cip_pr_port }}
{%- endif %}
{%- if cip_gis_type == "env.GIS_TYPE" %}
ARG_GIS_TYPE: ${GIS_TYPE:-geoserver}
{%- else %}
ARG_GIS_TYPE: {{ cip_gis_type }}
{%- endif %}
{%- if cip_gis_prot == "env.GIS_PROT" %}
ARG_GIS_PROT: ${GIS_PROT:-http}
{%- else %}
ARG_GIS_PROT: {{ cip_gis_prot }}
{%- endif %}
{%- if cip_gis_host == "env.GIS_HOST" %}
ARG_GIS_HOST: ${GIS_HOST:-localhost}
{%- else %}
ARG_GIS_HOST: {{ cip_gis_host }}
{%- endif %}
{%- if cip_gis_port == "env.GIS_PORT" %}
ARG_GIS_PORT: ${GIS_PORT:-8081}
{%- else %}
ARG_GIS_PORT: {{ cip_gis_port }}
{%- endif %}
image: cip-service-demo-cip_ng
hostname: cip_ng
Expand Down
8 changes: 8 additions & 0 deletions demo/env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
#POSTGREST_HOST=localhost
#POSTGREST_PORT=3000
#
# The demos run locally within a web browser and thus must "know" where the GIS services resides. In the most straightforward case that will be your http localhost
# address where docker is running geoserver dwon port 8081. If docker resides elsewhere or you are using an external GIS server, then update these values to that location.
# Leave commented to use http localhost port 8081 defaults.
#GIS_TYPE=geoserver
#GIS_PROT=http
#GIS_HOST=localhost
#GIS_PORT=8081
#
# The demos run locally within a web browser against the Nginx server in the demo bundle. By default that server is exposed as port 8080. Uncomment and
# change this value if you need that server exposed on a different port
#NGINX_PORT=808
2 changes: 1 addition & 1 deletion demo/nginx/html/cipsrv_attains.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service vs ATTAINS</h2>
</div>
</div>
<script src='https://unpkg.com/[email protected]/dist/leaflet.js'></script>
<script src='https://unpkg.com/[email protected].12/dist/esri-leaflet.js'></script>
<script src='https://unpkg.com/[email protected].14/dist/esri-leaflet.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js'></script>
<script>
document.getElementById("dz_run_service").disabled = true;
Expand Down
2 changes: 1 addition & 1 deletion demo/nginx/html/cipsrv_indexer.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Test Indexing Harnes
</div>
</div>
<script src='https://unpkg.com/[email protected]/dist/leaflet.js'></script>
<script src='https://unpkg.com/[email protected].12/dist/esri-leaflet.js'></script>
<script src='https://unpkg.com/[email protected].14/dist/esri-leaflet.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js'></script>
<script>
document.getElementById("dz_run_service").disabled = true;
Expand Down
103 changes: 98 additions & 5 deletions demo/nginx/html/delineate.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Delineation Test Har
<input id="pPoint2" name="pPoint2" type="text" class="textbox" style="width: 400px;" onchange="updatept2(this.value);blank_stop_nhdplusids();check_start();" />
<br/>
<span style="font-family: Arial; font-size: 12px;">NHDPlus Version:&nbsp;</span>
<select name="pNHDPlusVersion" id="pNHDPlusVersion" style="font-family: Arial; font-size: 11px; width:170px" onChange="blank_nhdplusids();">
<select name="pNHDPlusVersion" id="pNHDPlusVersion" style="font-family: Arial; font-size: 11px; width:170px" onChange="change_resolution();">
<option value="nhdplus_m" SELECTED>Medium Resolution</option>
<option value="nhdplus_h">High Resolution</option>
</select>
Expand Down Expand Up @@ -136,7 +136,7 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Delineation Test Har
<div id="output" style="width: 1200px; text-align: left; font-family: Arial; font-size: 15px;" />
</div>
<script src='https://unpkg.com/[email protected]/dist/leaflet.js'></script>
<script src='https://unpkg.com/[email protected].12/dist/esri-leaflet.js'></script>
<script src='https://unpkg.com/[email protected].14/dist/esri-leaflet.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js'></script>
<script>
document.getElementById("dz_run_service").disabled = true;
Expand All @@ -152,6 +152,9 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Delineation Test Har
});
basemap.addTo(map);

var lyr_nhdplus_m_flowlines = null;
var lyr_nhdplus_h_flowlines = null;

var drawnItems = new L.FeatureGroup().addTo(map);
var drawControl = new L.Control.Draw({
draw: {
Expand Down Expand Up @@ -253,10 +256,77 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Delineation Test Har
}).addTo(map);

var layer_items = {
"Snap path" : snap_path
,"Delineated Area": delineated_area
,"Streams" : flowlines
"Snap path" : snap_path
,"Delineated Area" : delineated_area
,"Delineated Streams": flowlines
};

if (
typeof gis_host === "undefined" ||
gis_host === null ||
gis_host == "NONE"
) {
null;
} else {
zgis_host = gis_host;

if (
typeof gis_type === "undefined" ||
gis_type === null ||
gis_type == "NONE"
) {
zgis_type = "geoserver";
} else {
zgis_type = gis_type;
}

if (
typeof gis_prot === "undefined" ||
gis_prot === null ||
gis_prot == "NONE"
) {
zgis_prot = "http";
} else {
zgis_prot = gis_prot;
}

if (
typeof gis_port === "undefined" ||
gis_port === null ||
gis_port == "NONE"
) {
zgis_port = "";
} else {
zgis_port = ":" + gis_port;
}

if ( zgis_type == "geoserver" ) {
gis_server = zgis_prot + "://" + zgis_host + zgis_port;

lyr_nhdplus_m_flowlines = L.tileLayer.wms(gis_server + "/wms",{
layers: 'cipsrv:nhdplus_m_flowlines'
,format: 'image/png'
,transparent: true
,version: '1.3.0'
,attribution: "US EPA"
});
lyr_nhdplus_m_flowlines.addTo(map);
layer_items["MR Flowlines"] = lyr_nhdplus_m_flowlines;

lyr_nhdplus_h_flowlines = L.tileLayer.wms(gis_server + "/wms",{
layers: 'cipsrv:nhdplus_h_flowlines'
,format: 'image/png'
,transparent: true
,version: '1.3.0'
,attribution: "US EPA"
});
//lyr_nhdplus_h_flowlines.addTo(map);
layer_items["HR Flowlines"] = lyr_nhdplus_h_flowlines;

}

}

L.control.layers(null, layer_items).addTo(map);

function onEachFeature_snap_path(feature,layer) {
Expand Down Expand Up @@ -673,6 +743,29 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Delineation Test Har
function blank_pt2() {
document.getElementById("pPoint2").value = "";
}

function change_resolution() {
var resolution = get_select_values(document.getElementById("pNHDPlusVersion"));
blank_nhdplusids();

if (lyr_nhdplus_m_flowlines !== null && resolution == "nhdplus_m" ) {
if (map.hasLayer(lyr_nhdplus_h_flowlines) ) {
map.removeLayer(lyr_nhdplus_h_flowlines);
}
if (! map.hasLayer(lyr_nhdplus_m_flowlines) ) {
map.addLayer(lyr_nhdplus_m_flowlines);
}

} else if (lyr_nhdplus_h_flowlines !== null && resolution == "nhdplus_h" ) {
if (map.hasLayer(lyr_nhdplus_m_flowlines) ) {
map.removeLayer(lyr_nhdplus_m_flowlines);
}
if (! map.hasLayer(lyr_nhdplus_h_flowlines) ) {
map.addLayer(lyr_nhdplus_h_flowlines);
}

}
}

function blank_nhdplusids() {
blank_start_nhdplusids();
Expand Down
98 changes: 95 additions & 3 deletions demo/nginx/html/navigate.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Navigation Test Harn
<input id="pPoint2" name="pPoint2" type="text" class="textbox" style="width: 400px;" onchange="updatept2(this.value);blank_stop_nhdplusids();check_start();" />
<br/>
<span style="font-family: Arial; font-size: 12px;">NHDPlus Version:&nbsp;</span>
<select name="pNHDPlusVersion" id="pNHDPlusVersion" style="font-family: Arial; font-size: 11px; width:170px" onChange="blank_nhdplusids();">
<select name="pNHDPlusVersion" id="pNHDPlusVersion" style="font-family: Arial; font-size: 11px; width:170px" onChange="change_resolution();">
<option value="nhdplus_m" SELECTED>Medium Resolution</option>
<option value="nhdplus_h">High Resolution</option>
</select>
Expand Down Expand Up @@ -120,7 +120,7 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Navigation Test Harn
<div id="output" style="width: 1200px; text-align: left; font-family: Arial; font-size: 15px;" />
</div>
<script src='https://unpkg.com/[email protected]/dist/leaflet.js'></script>
<script src='https://unpkg.com/[email protected].12/dist/esri-leaflet.js'></script>
<script src='https://unpkg.com/[email protected].14/dist/esri-leaflet.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js'></script>
<script>
document.getElementById("dz_run_service").disabled = true;
Expand All @@ -136,6 +136,9 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Navigation Test Harn
});
basemap.addTo(map);

var lyr_nhdplus_m_flowlines = null;
var lyr_nhdplus_h_flowlines = null;

var drawnItems = new L.FeatureGroup().addTo(map);
var drawControl = new L.Control.Draw({
draw: {
Expand Down Expand Up @@ -236,7 +239,73 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Navigation Test Harn
"Snap path": snap_path,
"Returned Streams": flowlines
};
L.control.layers(null, layer_items).addTo(map);

if (
typeof gis_host === "undefined" ||
gis_host === null ||
gis_host == "NONE"
) {
null;
} else {
zgis_host = gis_host;

if (
typeof gis_type === "undefined" ||
gis_type === null ||
gis_type == "NONE"
) {
zgis_type = "geoserver";
} else {
zgis_type = gis_type;
}

if (
typeof gis_prot === "undefined" ||
gis_prot === null ||
gis_prot == "NONE"
) {
zgis_prot = "http";
} else {
zgis_prot = gis_prot;
}

if (
typeof gis_port === "undefined" ||
gis_port === null ||
gis_port == "NONE"
) {
zgis_port = "";
} else {
zgis_port = ":" + gis_port;
}

if ( zgis_type == "geoserver" ) {
gis_server = zgis_prot + "://" + zgis_host + zgis_port;

lyr_nhdplus_m_flowlines = L.tileLayer.wms(gis_server + "/wms",{
layers: 'cipsrv:nhdplus_m_flowlines'
,format: 'image/png'
,transparent: true
,version: '1.3.0'
,attribution: "US EPA"
});
lyr_nhdplus_m_flowlines.addTo(map);
layer_items["MR Flowlines"] = lyr_nhdplus_m_flowlines;

lyr_nhdplus_h_flowlines = L.tileLayer.wms(gis_server + "/wms",{
layers: 'cipsrv:nhdplus_h_flowlines'
,format: 'image/png'
,transparent: true
,version: '1.3.0'
,attribution: "US EPA"
});
//lyr_nhdplus_h_flowlines.addTo(map);
layer_items["HR Flowlines"] = lyr_nhdplus_h_flowlines;

}

}
L.control.layers(null, layer_items).addTo(map);

function onEachFeature_snap_path(feature,layer) {
if (feature.properties && feature.properties.snap_distancekm) {
Expand Down Expand Up @@ -609,6 +678,29 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Navigation Test Harn
function blank_pt2() {
document.getElementById("pPoint2").value = "";
}

function change_resolution() {
var resolution = get_select_values(document.getElementById("pNHDPlusVersion"));
blank_nhdplusids();

if (lyr_nhdplus_m_flowlines !== null && resolution == "nhdplus_m" ) {
if (map.hasLayer(lyr_nhdplus_h_flowlines) ) {
map.removeLayer(lyr_nhdplus_h_flowlines);
}
if (! map.hasLayer(lyr_nhdplus_m_flowlines) ) {
map.addLayer(lyr_nhdplus_m_flowlines);
}

} else if (lyr_nhdplus_h_flowlines !== null && resolution == "nhdplus_h" ) {
if (map.hasLayer(lyr_nhdplus_m_flowlines) ) {
map.removeLayer(lyr_nhdplus_m_flowlines);
}
if (! map.hasLayer(lyr_nhdplus_h_flowlines) ) {
map.addLayer(lyr_nhdplus_h_flowlines);
}

}
}

function blank_nhdplusids() {
blank_start_nhdplusids();
Expand Down
2 changes: 1 addition & 1 deletion demo/nginx/html/pointindexing.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Point Indexing Test
</div>

<script src='https://unpkg.com/[email protected]/dist/leaflet.js'></script>
<script src='https://unpkg.com/[email protected].10/dist/esri-leaflet.js'></script>
<script src='https://unpkg.com/[email protected].14/dist/esri-leaflet.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js'></script>
<script>
document.getElementById("dz_run_service").disabled = true;
Expand Down
Loading

0 comments on commit 941736e

Please sign in to comment.