sageroad 1.0.2__tar.gz → 1.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. {sageroad-1.0.2/src/sageroad.egg-info → sageroad-1.0.4}/PKG-INFO +10 -8
  2. {sageroad-1.0.2 → sageroad-1.0.4}/PYPI.md +9 -7
  3. {sageroad-1.0.2 → sageroad-1.0.4}/README.md +2 -2
  4. {sageroad-1.0.2 → sageroad-1.0.4}/pyproject.toml +1 -1
  5. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/form.js +8 -6
  6. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/homePage.js +13 -4
  7. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/model.js +8 -0
  8. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/auto.js +16 -12
  9. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/design.js +6 -4
  10. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/engineer.js +7 -7
  11. {sageroad-1.0.2 → sageroad-1.0.4/src/sageroad.egg-info}/PKG-INFO +10 -8
  12. {sageroad-1.0.2 → sageroad-1.0.4}/LICENSE +0 -0
  13. {sageroad-1.0.2 → sageroad-1.0.4}/setup.cfg +0 -0
  14. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/__init__.py +0 -0
  15. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/__main__.py +0 -0
  16. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/app.py +0 -0
  17. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/main.py +0 -0
  18. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/app.css +0 -0
  19. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/index.html +0 -0
  20. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/app.js +0 -0
  21. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/args.js +0 -0
  22. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/canvas.js +0 -0
  23. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/doc.js +0 -0
  24. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/draw.js +0 -0
  25. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/explore.js +0 -0
  26. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/format.js +0 -0
  27. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/geo.js +0 -0
  28. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/mapPage.js +0 -0
  29. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/markdown.js +0 -0
  30. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/models.js +0 -0
  31. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/modelsPage.js +0 -0
  32. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/planData.js +0 -0
  33. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/planView.js +0 -0
  34. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/report.js +0 -0
  35. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/schemaDoc.js +0 -0
  36. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/smoothing.js +0 -0
  37. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/tables.js +0 -0
  38. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/view3d.js +0 -0
  39. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/lib/viewPages.js +0 -0
  40. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/browser/buffer.js +0 -0
  41. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/browser/io.js +0 -0
  42. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/browser/zlib.js +0 -0
  43. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/draft.js +0 -0
  44. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/draws.js +0 -0
  45. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/elevationImage.js +0 -0
  46. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/features.js +0 -0
  47. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/numeric.js +0 -0
  48. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/ollama.js +0 -0
  49. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/planFile.js +0 -0
  50. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/plot.js +0 -0
  51. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/png.js +0 -0
  52. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/profile.js +0 -0
  53. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/roads.js +0 -0
  54. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/route.js +0 -0
  55. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/siteCommand.js +0 -0
  56. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/structures.js +0 -0
  57. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/terrain.js +0 -0
  58. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/plan/lib/usgs.js +0 -0
  59. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/sageroad.svg +0 -0
  60. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/schema-markdown/lib/parser.js +0 -0
  61. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/schema-markdown/lib/schema.js +0 -0
  62. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/schema-markdown/lib/schemaUtil.js +0 -0
  63. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad/static/schema-markdown/lib/typeModel.js +0 -0
  64. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad.egg-info/SOURCES.txt +0 -0
  65. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad.egg-info/dependency_links.txt +0 -0
  66. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad.egg-info/entry_points.txt +0 -0
  67. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad.egg-info/requires.txt +0 -0
  68. {sageroad-1.0.2 → sageroad-1.0.4}/src/sageroad.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sageroad
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: SageRoad engineers low-volume roads on USGS lidar terrain and views the resulting road plans
5
5
  Author: Craig A. Hobbs
6
6
  License-Expression: MIT
@@ -129,8 +129,9 @@ criteria, and marks), and what can be done with it:
129
129
  Options** clears them - the plan keeps its site's data.
130
130
  - **Save** the plan to its file - the file it was opened from, or saved to - or **Save As** another,
131
131
  to duplicate it (and run it with another config, say). In a browser that can't write to a file
132
- (Firefox and Safari), a save downloads the plan's file. A plan with road options keeps its config
133
- and its map image, so it's one file - and a plan without road options is its config's file.
132
+ (Firefox and Safari), it's **Download** - the plan's file is downloaded. A plan with road options
133
+ keeps its config and its map image, so it's one file - and a plan without road options is its
134
+ config's file.
134
135
  - **Close** it - if it has changes that aren't saved, you're asked first.
135
136
  - **Ollama Models** - Ollama's models on this computer: whether each reads images, its parameters,
136
137
  size, and modified date. **Delete** a model, or **Update** it (download it again), and see a
@@ -171,9 +172,10 @@ A plan's config - its **road site model** - is a JSON file:
171
172
  ```
172
173
 
173
174
  The points' latitudes and longitudes are decimal degrees, as a phone or a map application gives them
174
- (the United States' longitudes are negative). A config may also have design criteria (`criteria`),
175
- cost rates (`costRates`), the distance its site extends beyond the start and end points (`margin`),
176
- its terrain grid's spacing (`spacing`), and its **marks** - the areas the road must avoid
175
+ (the United States' longitudes are negative). A config may also have design criteria (`criteria` -
176
+ the road's width and surface, its maximum grade and minimum radius, and more), cost rates
177
+ (`costRates`), the distance its site extends beyond the start and end points (`margin`), its terrain
178
+ grid's spacing (`spacing`), and its **marks** - the areas the road must avoid
177
179
  (`exclusions`, polygons of latitudes and longitudes), the existing roads the USGS doesn't map (`roads`
178
180
  - a track, a driveway - that a road may follow), and the places a road must pass through
179
181
  (`passThrough`) - draw them with **Edit Map**. The model documentation (linked from the viewer's
@@ -241,8 +243,8 @@ The model's questions are small - a paragraph, and a map image - with a JSON ans
241
243
  the model doesn't run the plan. Without a model, the notes aren't read, and the plan is the tools'
242
244
  alone.
243
245
 
244
- Typical criteria for the notes (from the USFS *Low-Volume Roads Engineering Best Management Practices
245
- Field Guide*, AASHTO low-volume road guidance, and fire codes):
246
+ Typical criteria, for the config's design criteria or the notes (from the USFS *Low-Volume Roads
247
+ Engineering Best Management Practices Field Guide*, AASHTO low-volume road guidance, and fire codes):
246
248
 
247
249
  | | Driveway / fire access | Rural access road | Forest / ranch road |
248
250
  | --- | --- | --- | --- |
@@ -104,8 +104,9 @@ criteria, and marks), and what can be done with it:
104
104
  Options** clears them - the plan keeps its site's data.
105
105
  - **Save** the plan to its file - the file it was opened from, or saved to - or **Save As** another,
106
106
  to duplicate it (and run it with another config, say). In a browser that can't write to a file
107
- (Firefox and Safari), a save downloads the plan's file. A plan with road options keeps its config
108
- and its map image, so it's one file - and a plan without road options is its config's file.
107
+ (Firefox and Safari), it's **Download** - the plan's file is downloaded. A plan with road options
108
+ keeps its config and its map image, so it's one file - and a plan without road options is its
109
+ config's file.
109
110
  - **Close** it - if it has changes that aren't saved, you're asked first.
110
111
  - **Ollama Models** - Ollama's models on this computer: whether each reads images, its parameters,
111
112
  size, and modified date. **Delete** a model, or **Update** it (download it again), and see a
@@ -146,9 +147,10 @@ A plan's config - its **road site model** - is a JSON file:
146
147
  ```
147
148
 
148
149
  The points' latitudes and longitudes are decimal degrees, as a phone or a map application gives them
149
- (the United States' longitudes are negative). A config may also have design criteria (`criteria`),
150
- cost rates (`costRates`), the distance its site extends beyond the start and end points (`margin`),
151
- its terrain grid's spacing (`spacing`), and its **marks** - the areas the road must avoid
150
+ (the United States' longitudes are negative). A config may also have design criteria (`criteria` -
151
+ the road's width and surface, its maximum grade and minimum radius, and more), cost rates
152
+ (`costRates`), the distance its site extends beyond the start and end points (`margin`), its terrain
153
+ grid's spacing (`spacing`), and its **marks** - the areas the road must avoid
152
154
  (`exclusions`, polygons of latitudes and longitudes), the existing roads the USGS doesn't map (`roads`
153
155
  - a track, a driveway - that a road may follow), and the places a road must pass through
154
156
  (`passThrough`) - draw them with **Edit Map**. The model documentation (linked from the viewer's
@@ -216,8 +218,8 @@ The model's questions are small - a paragraph, and a map image - with a JSON ans
216
218
  the model doesn't run the plan. Without a model, the notes aren't read, and the plan is the tools'
217
219
  alone.
218
220
 
219
- Typical criteria for the notes (from the USFS *Low-Volume Roads Engineering Best Management Practices
220
- Field Guide*, AASHTO low-volume road guidance, and fire codes):
221
+ Typical criteria, for the config's design criteria or the notes (from the USFS *Low-Volume Roads
222
+ Engineering Best Management Practices Field Guide*, AASHTO low-volume road guidance, and fire codes):
221
223
 
222
224
  | | Driveway / fire access | Rural access road | Forest / ranch road |
223
225
  | --- | --- | --- | --- |
@@ -61,8 +61,8 @@ once it's run), run it (its steps - the planning tools' `autoSteps` - and its ti
61
61
  report when it's done; it's stopped with an abort signal, when its current step's work is done, and its work is
62
62
  thrown away; the last model chosen is remembered; a plan's site's data is kept, unless the site changed or it's
63
63
  fetched again), clear its road options (its site's data is kept), save it (to its file, or another - the browser's
64
- save dialog, or a download), and close it (the user is asked first, if it has changes that aren't saved). A plan with
65
- road options is one file: it keeps its config and its map image (a data URL). The recent files are listed - a file is
64
+ save dialog, or a download - "Download", in a browser without one), and close it (the user is asked first, if it has
65
+ changes that aren't saved). A plan with road options is one file: it keeps its config and its map image (a data URL). The recent files are listed - a file is
66
66
  opened, or removed (but for the loaded plan's road options' file).
67
67
 
68
68
  The engineering isn't the back end's: a plan is run in the browser, by the planning tools' procedure (`autoPlan`,
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sageroad"
7
- version = "1.0.2"
7
+ version = "1.0.4"
8
8
  description = "SageRoad engineers low-volume roads on USGS lidar terrain and views the resulting road plans"
9
9
  readme = "PYPI.md"
10
10
  license = "MIT"
@@ -102,9 +102,10 @@ export function formHtml(types, typeName, value = {}, path = '') {
102
102
  controlHtml = `<textarea ${attrs} rows="5">${escapeHtml(text)}</textarea>`;
103
103
  } else if (kind === 'enum') {
104
104
  const values = [...(optional ? [''] : []), ...types[type.user].enum.values.map((enumValue) => enumValue.name)];
105
- const optionsHtml = values.map((enumValue) => (
106
- `<option${enumValue === memberValue ? ' selected' : ''}>${escapeHtml(enumValue)}</option>`
107
- ));
105
+ const optionsHtml = values.map((enumValue) => {
106
+ const optionAttrs = `${enumValue === '' ? ' value=""' : ''}${enumValue === memberValue ? ' selected' : ''}`;
107
+ return `<option${optionAttrs}>${escapeHtml(enumValue)}</option>`;
108
+ });
108
109
  controlHtml = `<select ${attrs}>${optionsHtml.join('')}</select>`;
109
110
  isWide = false;
110
111
  } else if (kind !== null) {
@@ -174,12 +175,13 @@ export function formPastePoint(element, event) {
174
175
 
175
176
 
176
177
  // Set a form's controls' placeholders - "placeholders" is a member path's placeholder text (a member's default, say;
177
- // "" for none)
178
+ // "" for none). An optional enumeration's placeholder is its choice of none's text.
178
179
  export function formPlaceholders(element, placeholders) {
179
180
  for (const [memberPath, text] of Object.entries(placeholders)) {
180
181
  const control = element.querySelector(`[data-member="${memberPath}"]`);
181
- if (control !== null) {
182
- control.placeholder = text !== '' ? `Default: ${text}` : '';
182
+ const target = control !== null && control.tagName === 'SELECT' ? control.querySelector('option[value=""]') : control;
183
+ if (target !== null) {
184
+ target[target === control ? 'placeholder' : 'textContent'] = text !== '' ? `Default: ${text}` : '';
183
185
  }
184
186
  }
185
187
  }
@@ -19,6 +19,12 @@ export function titleFileName(title) {
19
19
  }
20
20
 
21
21
 
22
+ // Whether the browser has a save dialog that writes to a file (the File System Access API's - Chromium's)
23
+ function hasSaveDialog(window) {
24
+ return typeof window.showSaveFilePicker === 'function';
25
+ }
26
+
27
+
22
28
  // The plan config's design criteria's and cost rates' text - each member's words, and its value
23
29
  function memberText(members) {
24
30
  return Object.entries(members).map(([name, value]) => `${memberWords(name)} ${value}`).join(', ');
@@ -137,7 +143,8 @@ export class HomePage {
137
143
  return;
138
144
  }
139
145
 
140
- // The plan's title, its file, and its actions - its road options are viewed with "View Plan", in a new tab
146
+ // The plan's title, its file, and its actions - its road options are viewed with "View Plan", in a new tab, and
147
+ // a browser without a save dialog (Firefox and Safari) downloads the plan ("Download" - save and save as are the same)
141
148
  const button = (id, text, isDisabled = false) => (
142
149
  `<button type="button" id="${id}" class="sageroad-button"${isDisabled ? ' disabled' : ''}>${escapeHtml(text)}</button>`
143
150
  );
@@ -152,7 +159,8 @@ export class HomePage {
152
159
  '<p class="sageroad-actions">' +
153
160
  `${viewHtml}${button('sageroad-edit', 'Edit Plan', site === null)}` +
154
161
  `${button('sageroad-map', 'Edit Map', site === null || !('georeference' in (value ?? {})))}` +
155
- `${button('sageroad-save', 'Save')}${button('sageroad-save-as', 'Save As…')}${button('sageroad-close', 'Close')}</p>`,
162
+ `${hasSaveDialog(app.window) ? `${button('sageroad-save', 'Save')}${button('sageroad-save-as', 'Save As…')}` :
163
+ button('sageroad-save', 'Download')}${button('sageroad-close', 'Close')}</p>`,
156
164
  '<p id="sageroad-save-status"></p>'
157
165
  ];
158
166
  if (value === null) {
@@ -439,7 +447,7 @@ export class HomePage {
439
447
  let name = loaded.name ?? titleFileName(loaded.site.title);
440
448
  try {
441
449
  let handle = isSaveAs ? null : app.fileHandle;
442
- if (handle === null && typeof window.showSaveFilePicker === 'function') {
450
+ if (handle === null && hasSaveDialog(window)) {
443
451
  handle = await window.showSaveFilePicker({
444
452
  'suggestedName': name, 'types': [{'description': 'SageRoad plan', 'accept': {'application/json': ['.json']}}]
445
453
  });
@@ -474,7 +482,8 @@ export class HomePage {
474
482
  app.setLoaded({...loaded, name, file, 'saved': true});
475
483
  if (!this.closed) {
476
484
  await this.renderLoaded();
477
- document.getElementById('sageroad-save-status').textContent = `Saved the plan, "${name}".`;
485
+ const verb = hasSaveDialog(window) ? 'Saved' : 'Downloaded';
486
+ document.getElementById('sageroad-save-status').textContent = `${verb} the plan, "${name}".`;
478
487
  await this.renderRecent();
479
488
  }
480
489
  }
@@ -165,6 +165,12 @@ export const sageRoadTypes = parseSchemaMarkdown([
165
165
  '# The road design criteria',
166
166
  'struct DesignCriteria',
167
167
  '',
168
+ ' # The road width, including shoulders (default is 14 feet / 4.3 meters)',
169
+ ' optional float(> 0) width',
170
+ '',
171
+ ' # The road surface (default is "gravel")',
172
+ ' optional Surface surface',
173
+ '',
168
174
  ' # The maximum road grade, in percent (default is 12)',
169
175
  ' optional float(> 0) maxGrade',
170
176
  '',
@@ -662,6 +668,8 @@ export function validateSite(siteValue) {
662
668
  export function planCriteria(plan) {
663
669
  const criteria = plan.criteria ?? {};
664
670
  return {
671
+ 'width': criteria.width ?? unitLength(plan, 4.3, 14),
672
+ 'surface': criteria.surface ?? 'gravel',
665
673
  'maxGrade': criteria.maxGrade ?? 12,
666
674
  'minRadius': criteria.minRadius ?? unitLength(plan, 15, 50),
667
675
  'rockCutSlope': criteria.rockCutSlope ?? 0.5,
@@ -113,9 +113,9 @@ const pointSchema = {
113
113
  // the model's saved answers, and the plots the model was asked of), and its map image is its file's. The options are
114
114
  // the "model" to ask (null for none - the notes aren't read), whether to ask it again ("isFresh" - its saved answers
115
115
  // aren't used, and the notes' places are found again), whether to fetch the site's data again ("isFetch"), and the
116
- // road's "width" and "surface" (null for the notes', or the defaults). Returns the exit "code", the report's "lines",
117
- // the "plan" (null if its site wasn't created - if the plan failed, it's the plan as it was last whole), and the plan
118
- // config ("site" - the run's, if its marks or its margin changed).
116
+ // road's "width" and "surface" (null for the plan config's design criteria's, the notes', or the defaults). Returns the
117
+ // exit "code", the report's "lines", the "plan" (null if its site wasn't created - if the plan failed, it's the plan as
118
+ // it was last whole), and the plan config ("site" - the run's, if its marks or its margin changed).
119
119
  export async function autoPlan(io, planPath, site, planValue, options = {}) {
120
120
  const {model = null, isFresh = false, isFetch = false, width = null, surface = null} = options;
121
121
  const work = `${planPath.replace(/\.json$/i, '')}.work`;
@@ -220,20 +220,24 @@ export async function autoPlan(io, planPath, site, planValue, options = {}) {
220
220
  const answer = await ask('notes', notesSchema, () => ({question}));
221
221
  directives = notesDirectives(answer, units, notes);
222
222
 
223
- // The design criteria - the plan config's own are the plan's
224
- for (const member of ['maxGrade', 'minRadius']) {
225
- if (directives[member] !== null && !(member in (config.criteria ?? {}))) {
223
+ // The design criteria - the plan config's own are the plan's, and the run's road is its options'
224
+ const runCriteria = {width, surface};
225
+ for (const member of ['width', 'surface', 'maxGrade', 'minRadius']) {
226
+ if (directives[member] !== null && !(member in (config.criteria ?? {})) && (runCriteria[member] ?? null) === null) {
226
227
  notesCriteria[member] = directives[member];
227
228
  }
228
229
  }
229
230
  if (Object.keys(notesCriteria).length > 0) {
230
231
  plan.criteria = {...plan.criteria, ...notesCriteria};
231
- report(`Notes: ${Object.entries(notesCriteria).map(([member, value]) => `${criteriaNames[member]} ${value}`).join(', ')}`);
232
232
  }
233
- if (directives.width !== null || directives.surface !== null) {
233
+ const limitCriteria = Object.entries(notesCriteria).filter(([member]) => member in criteriaNames);
234
+ if (limitCriteria.length > 0) {
235
+ report(`Notes: ${limitCriteria.map(([member, value]) => `${criteriaNames[member]} ${value}`).join(', ')}`);
236
+ }
237
+ if ('width' in notesCriteria || 'surface' in notesCriteria) {
234
238
  report(`Notes: the road is ${[
235
- ...(directives.width !== null ? [`${directives.width} ${units} wide`] : []),
236
- ...(directives.surface !== null ? [directives.surface] : [])
239
+ ...('width' in notesCriteria ? [`${notesCriteria.width} ${units} wide`] : []),
240
+ ...('surface' in notesCriteria ? [notesCriteria.surface] : [])
237
241
  ].join(', ')}`);
238
242
  }
239
243
  if (directives.bridgeFill !== null) {
@@ -269,8 +273,8 @@ export async function autoPlan(io, planPath, site, planValue, options = {}) {
269
273
  // options cross no unmapped draws (it's a choice against the standard options as they'll be, and it's often not an
270
274
  // option) - if it's an option that crosses unmapped draws, they're added, and the options are engineered again.
271
275
  const roadArgs = roadArguments({
272
- 'width': width ?? directives.width,
273
- 'surface': surface ?? directives.surface ?? roadArguments().surface,
276
+ width,
277
+ surface,
274
278
  'bridgeFill': directives.bridgeFill,
275
279
  'ruleOut': ruledOut
276
280
  });
@@ -6,13 +6,15 @@ import {elevation, linearAreas, planCriteria, planRates, unitScale} from '../../
6
6
 
7
7
  // Create the road design parameters and unit costs (per plan unit) of a plan and the route and profile commands'
8
8
  // arguments: "grade" and "switchbackGrade" (percent), "width", "surface", "cutSlope", "fillSlope", "turnouts", and
9
- // "bridgeFill". The grade, width, turnouts, and bridge fill arguments may be null.
9
+ // "bridgeFill". The grade, width, surface, turnouts, and bridge fill arguments may be null - a null width or surface is
10
+ // the plan's design criteria's.
10
11
  export function createDesign(plan, args) {
11
12
  const feet = plan.units === 'feet';
12
13
  const criteria = planCriteria(plan);
13
14
  const maxGrade = criteria.maxGrade / 100;
14
15
  const grade = args.grade ? args.grade / 100 : Math.max(maxGrade - 0.01, maxGrade * 0.9);
15
- const width = args.width ? args.width : (feet ? 14 : 4.3);
16
+ const width = args.width || criteria.width;
17
+ const surface = args.surface ?? criteria.surface;
16
18
  const rates = planRates(plan);
17
19
  const scale = unitScale(plan);
18
20
  const scale2 = scale * scale;
@@ -27,7 +29,7 @@ export function createDesign(plan, args) {
27
29
  'rockCutSlope': criteria.rockCutSlope,
28
30
  width,
29
31
  'halfWidth': width * 0.5,
30
- 'surface': args.surface,
32
+ surface,
31
33
  'cutSlope': args.cutSlope,
32
34
  'fillSlope': args.fillSlope,
33
35
 
@@ -42,7 +44,7 @@ export function createDesign(plan, args) {
42
44
  'costWaste': rates.waste * scale3,
43
45
  'costArea': clearing * scale2,
44
46
  'costWall': rates.retainingWall * scale2,
45
- 'costLength': width * (rates[args.surface] + rates.clearing + rates.erosionControl) * scale2 + rates.drainage * scale,
47
+ 'costLength': width * (rates[surface] + rates.clearing + rates.erosionControl) * scale2 + rates.drainage * scale,
46
48
  'costCulvert': rates.culvertEnds + rates.culvert * (feet ? 1.5 * scale : 0.45) * scale * width * 3,
47
49
  'costExisting': width * rates.existingRoad * scale2,
48
50
  'shrink': rates.shrink,
@@ -17,15 +17,15 @@ import {designProfile} from './profile.js';
17
17
 
18
18
 
19
19
  // Create a road's engineering arguments - the defaults, with other arguments: its option's "name" and "description"
20
- // (lines, or null to keep the option's), the road's "width" and "surface", its "cutSlope" and "fillSlope" ratios, its
21
- // design "grade" and "switchbackGrade" (in percent), its "turnouts" spacing, the fill depth of a stream crossing that a
22
- // bridge replaces ("bridgeFill"), its "existingRoads" ([station, end station] ranges - null to find them), its "via"
23
- // points ([x, y] arrays), whether it's all new ("allNew" - it doesn't follow the plan's existing roads), the names of
24
- // the existing roads it doesn't follow ("ruleOut"), and its route search's "gradeWeight" (null for the best of several)
25
- // and "slopeWeight". A null argument is its default.
20
+ // (lines, or null to keep the option's), the road's "width" and "surface" (null for the plan's design criteria's), its
21
+ // "cutSlope" and "fillSlope" ratios, its design "grade" and "switchbackGrade" (in percent), its "turnouts" spacing, the
22
+ // fill depth of a stream crossing that a bridge replaces ("bridgeFill"), its "existingRoads" ([station, end station]
23
+ // ranges - null to find them), its "via" points ([x, y] arrays), whether it's all new ("allNew" - it doesn't follow the
24
+ // plan's existing roads), the names of the existing roads it doesn't follow ("ruleOut"), and its route search's
25
+ // "gradeWeight" (null for the best of several) and "slopeWeight". A null argument is its default.
26
26
  export function roadArguments(args = {}) {
27
27
  return {
28
- 'description': null, 'width': null, 'surface': 'gravel', 'cutSlope': 1, 'fillSlope': 1.5, 'grade': null, 'switchbackGrade': 8,
28
+ 'description': null, 'width': null, 'surface': null, 'cutSlope': 1, 'fillSlope': 1.5, 'grade': null, 'switchbackGrade': 8,
29
29
  'turnouts': null, 'bridgeFill': null, 'existingRoads': null, 'via': [], 'allNew': false, 'ruleOut': [], 'gradeWeight': null,
30
30
  'slopeWeight': 1, ...args
31
31
  };
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sageroad
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: SageRoad engineers low-volume roads on USGS lidar terrain and views the resulting road plans
5
5
  Author: Craig A. Hobbs
6
6
  License-Expression: MIT
@@ -129,8 +129,9 @@ criteria, and marks), and what can be done with it:
129
129
  Options** clears them - the plan keeps its site's data.
130
130
  - **Save** the plan to its file - the file it was opened from, or saved to - or **Save As** another,
131
131
  to duplicate it (and run it with another config, say). In a browser that can't write to a file
132
- (Firefox and Safari), a save downloads the plan's file. A plan with road options keeps its config
133
- and its map image, so it's one file - and a plan without road options is its config's file.
132
+ (Firefox and Safari), it's **Download** - the plan's file is downloaded. A plan with road options
133
+ keeps its config and its map image, so it's one file - and a plan without road options is its
134
+ config's file.
134
135
  - **Close** it - if it has changes that aren't saved, you're asked first.
135
136
  - **Ollama Models** - Ollama's models on this computer: whether each reads images, its parameters,
136
137
  size, and modified date. **Delete** a model, or **Update** it (download it again), and see a
@@ -171,9 +172,10 @@ A plan's config - its **road site model** - is a JSON file:
171
172
  ```
172
173
 
173
174
  The points' latitudes and longitudes are decimal degrees, as a phone or a map application gives them
174
- (the United States' longitudes are negative). A config may also have design criteria (`criteria`),
175
- cost rates (`costRates`), the distance its site extends beyond the start and end points (`margin`),
176
- its terrain grid's spacing (`spacing`), and its **marks** - the areas the road must avoid
175
+ (the United States' longitudes are negative). A config may also have design criteria (`criteria` -
176
+ the road's width and surface, its maximum grade and minimum radius, and more), cost rates
177
+ (`costRates`), the distance its site extends beyond the start and end points (`margin`), its terrain
178
+ grid's spacing (`spacing`), and its **marks** - the areas the road must avoid
177
179
  (`exclusions`, polygons of latitudes and longitudes), the existing roads the USGS doesn't map (`roads`
178
180
  - a track, a driveway - that a road may follow), and the places a road must pass through
179
181
  (`passThrough`) - draw them with **Edit Map**. The model documentation (linked from the viewer's
@@ -241,8 +243,8 @@ The model's questions are small - a paragraph, and a map image - with a JSON ans
241
243
  the model doesn't run the plan. Without a model, the notes aren't read, and the plan is the tools'
242
244
  alone.
243
245
 
244
- Typical criteria for the notes (from the USFS *Low-Volume Roads Engineering Best Management Practices
245
- Field Guide*, AASHTO low-volume road guidance, and fire codes):
246
+ Typical criteria, for the config's design criteria or the notes (from the USFS *Low-Volume Roads
247
+ Engineering Best Management Practices Field Guide*, AASHTO low-volume road guidance, and fire codes):
246
248
 
247
249
  | | Driveway / fire access | Rural access road | Forest / ranch road |
248
250
  | --- | --- | --- | --- |
File without changes
File without changes
File without changes
File without changes