Skip to content

Commit

Permalink
pc4 for world
Browse files Browse the repository at this point in the history
  • Loading branch information
Atma Mani committed Jan 12, 2024
1 parent 93ef914 commit 9e9bf84
Show file tree
Hide file tree
Showing 5 changed files with 499 additions and 145 deletions.
177 changes: 177 additions & 0 deletions docs/files/pc4-globe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<title>World Pluscodes 4</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.24/esri/themes/light/main.css" />
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
</head>

<body>
<div id="viewDiv"></div>

<script src="https://js.arcgis.com/4.24/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/GeoJSONLayer",
"esri/symbols/TextSymbol",
"esri/layers/support/LabelClass",
"esri/widgets/Search",
"esri/symbols/SimpleLineSymbol",
"dojo/domReady!"
], function (Map, MapView, GeoJSONLayer, TextSymbol, LabelClass, Search, SimpleLineSymbol) {
// Create the map
var map = new Map({
basemap: "streets-vector",
});

// Create the map view
var view = new MapView({
container: "viewDiv",
map: map,
center: [-97, 40],
// scale: 5000000
zoom: 4
});

// Define the GeoJSON layer
var pc4_layer = new GeoJSONLayer({
// url: "../data_files/world_pc4.geojson",
url: "https://atmamani.github.io/files/world_pc4.geojson",
// url: "http://127.0.0.1:8000/files/world_pc4.geojson",
renderer: {
type: "simple",
symbol: {
type: "simple-fill",
color: [0, 0, 0, 0],
outline: {
color: "brown",
width: 1.25
}
}
},
labelingInfo: [new LabelClass({
labelExpressionInfo: { expression: "$feature.trimmed_pl" },
symbol: {
type: "text",
color: "black",
haloColor: "white",
haloSize: "1px",
font: {
size: "13px",
weight: "bold"
}
},
labelPlacement: "always-horizontal"
})]
});

//Define PC2 layer
var pc2_layer = new GeoJSONLayer({
url: "https://atmamani.github.io/files/world_pc_len2.geojson",
renderer: {
type: "simple",
symbol: {
type: "simple-fill",
color: [0, 0, 0, 0.15],
outline: {
color: "green",
width: 4
}
}
},
labelingInfo: [new LabelClass({
labelExpressionInfo: { expression: "$feature.trimmed_pluscodes" },
symbol: new TextSymbol({
color: "red",
haloColor: "black",
haloSize: "2px",
font: {
size: "16px",
weight: "bold"
}
}),
labelPlacement: "always-horizontal"
})]
});

// Add the GeoJSON layer to the map
map.add(pc4_layer);
map.add(pc2_layer);

//Search widget
const searchWidget = new Search({
view: view,
allPlaceholder: "PC4 or PC2",
includeDefaultSources: false,
sources: [
// primary search source is the PC4 layer
{
layer: pc4_layer,
searchFields: ['trimmed_pl'],
displayField: 'trimmed_pl',
exactMatch: true,
outFields: ["trimmed_pl"],
placeholder: "PC4 or PC2 eg:76VV"

},
// Add AGS World Geocoding Service as a search source
{
name: "ArcGIS World Geocoding Service",
url: "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",
singleLineFieldName: "SingleLine",
}
]
});

// Earlier , I had another search widget for geocoding. Now I have consolidated both into one.
// const geocodeWidget = new Search({
// view: view,
// allPlaceholder: "Address",
// sources: [{
// name: "ArcGIS World Geocoding Service",
// url: "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer",
// // locator: new Locator({ url: "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer" }),
// singleLineFieldName: "SingleLine",
// placeholder: "Search for Addresses",
// // maxResults: 3,
// // maxSuggestions: 6,
// // suggestionsEnabled: true,
// // minSuggestCharacters: 0
// }]
});

// Add the search widget to the top right corner of the view
view.ui.add(searchWidget, {
position: "top-right"
});
// Commented out - earlier there were two search bars. Now they are consolidated into one.
// view.ui.add(geocodeWidget, {
// position: "top-right",
// index: 2
// });

// Bind the browser find keyboard shortcut to the search widget
document.addEventListener("keydown", function (event) {
if ((event.ctrlKey || event.metaKey) && event.key === "f") {
event.preventDefault();
searchWidget.focus();
}
});
});
</script>
</body>

</html>
8 changes: 4 additions & 4 deletions docs/projects/ml/gradient-descent-in-python/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4254,9 +4254,9 @@ <h2 id="plot-gradient-descent">Plot Gradient Descent<a class="anchor-link" href=
<div class="jp-OutputArea jp-Cell-outputArea">
<div class="jp-OutputArea-child">
<div class="jp-OutputPrompt jp-OutputArea-prompt"></div>
<div class="jp-RenderedJavaScript jp-OutputArea-output" data-mime-type="application/javascript" id="2f5fb5ae-f6e5-4a1e-aa07-04106a560cd6" tabindex="0">
<div class="jp-RenderedJavaScript jp-OutputArea-output" data-mime-type="application/javascript" id="9b35e8e7-eb43-43bf-8405-0d7682207035" tabindex="0">
<script type="text/javascript">
var element = document.getElementById('2f5fb5ae-f6e5-4a1e-aa07-04106a560cd6');
var element = document.getElementById('9b35e8e7-eb43-43bf-8405-0d7682207035');
/* Put everything inside the global mpl namespace */
window.mpl = {};

Expand Down Expand Up @@ -5303,9 +5303,9 @@ <h3 id="visualize-loss-function-as-contours">Visualize loss function as contours
<div class="jp-OutputArea jp-Cell-outputArea">
<div class="jp-OutputArea-child">
<div class="jp-OutputPrompt jp-OutputArea-prompt"></div>
<div class="jp-RenderedJavaScript jp-OutputArea-output" data-mime-type="application/javascript" id="9fc44bf1-5b8e-451b-84c5-c99fba6d1086" tabindex="0">
<div class="jp-RenderedJavaScript jp-OutputArea-output" data-mime-type="application/javascript" id="3cb0ba1e-231a-45f0-9c6a-024bab41250c" tabindex="0">
<script type="text/javascript">
var element = document.getElementById('9fc44bf1-5b8e-451b-84c5-c99fba6d1086');
var element = document.getElementById('3cb0ba1e-231a-45f0-9c6a-024bab41250c');
/* Put everything inside the global mpl namespace */
window.mpl = {};

Expand Down
Loading

0 comments on commit 9e9bf84

Please sign in to comment.