Skip to content
Dan Ellis edited this page Nov 17, 2022 · 2 revisions

Draw Route

The entry point to the app, housing all drawing tools.

Structure

 4.0K   │ │ ┌── AreaMap.svelte   │                   ░░░░▒█ │   1%
 4.0K   │ │ ├── mapstore.js      │                   ░░░░▒█ │   1%
 4.0K   │ │ ├── misc_utils.js    │                   ░░░░▒█ │   1%
 8.0K   │ │ ├── centroid_utils.js│                   ░░░░▒█ │   1%
 8.0K   │ │ ├── drawing_utils.js │                   ░░░░▒█ │   1%
  20K   │ │ ├── +page.svelte     │                   ░░░░▒█ │   3%
  48K   │ ├─┴ draw     

../ONSloader.svelte

The generic loader function for all main routes

mapstore.js

This houses the svelte store variables

misc_utils.json

Miscellaneous functions:

  • get the bounding box
  • round
  • round all
  • geomean
  • extent

+page.svelete

The main page file

init

The main function called after all svelte components have been mounted

Contains:

  • updates the access date
  • initialises a map
  • recolour function
  • hash function
  • loading previous layers

load_geo

Uploader details

savedata

download function for geography

AreaMap.svelte

init

Creates the map object and populates it

SetLayers

sets the layers from props

drawing_utils.json

Drawing functions:

cursor

Updates the cursor

init_draw

Sets up the drawing tools, and map

simplify_geo

Simplification tools for a geography

makeBoundary

Simplifies the coordinates for transferring to the build page

clear

clears the local data

clearpoly

clears the polygon selector

change_data

updates the data of a mapbox layer

update

changes the map

draw_point

Click tool

updatelocal

Updates the localStorage

draw_radius

Drawing tools

geo_blob

convert query to a json blob