rufuspollock-okfn / dataexplorer

View, visualize, clean and process data in the browser.
http://explorer.okfnlabs.org
148 stars 47 forks source link

Web page freezing on executing of script #153

Closed noelmas closed 10 years ago

noelmas commented 10 years ago

Web page freezes on execution of script for converting OSGR coordinates to lat/long. Worked on one occasion, now freezes. Also appeared to create duplicate projects on one attempt. Dataset possibly too large.

Data: http://explorer.okfnlabs.org/#noelmas/5f2bf36b37418bcf5ff8/view/grid

Script: // ============================================================ // Library stuff // // For real "meat" see loadDataset function below

// From http://www.movable-type.co.uk/scripts/latlong-convert-coords.html var CoordTransform = {}; // CoordTransform namespace, representing static class

function toRad(num) { // convert degrees to radians return num * Math.PI / 180; }

// ellipse parameters CoordTransform.ellipse = { WGS84: { a: 6378137, b: 6356752.3142, f: 1/298.257223563 }, GRS80: { a: 6378137, b: 6356752.314140, f: 1/298.257222101 }, Airy1830: { a: 6377563.396, b: 6356256.910, f: 1/299.3249646 }, AiryModified: { a: 6377340.189, b: 6356034.448, f: 1/299.32496 }, Intl1924: { a: 6378388.000, b: 6356911.946, f: 1/297.0 } };

// helmert transform parameters from WGS84 to other datums CoordTransform.datumTransform = { toOSGB36: { tx: -446.448, ty: 125.157, tz: -542.060, // m rx: -0.1502, ry: -0.2470, rz: -0.8421, // sec s: 20.4894 }, // ppm toED50: { tx: 89.5, ty: 93.8, tz: 123.1, // m rx: 0.0, ry: 0.0, rz: 0.156, // sec s: -1.2 }, // ppm toIrl1975: { tx: -482.530, ty: 130.596, tz: -564.557, // m rx: -1.042, ry: -0.214, rz: -0.631, // sec s: -8.150 } }; // ppm // ED50: og.decc.gov.uk/en/olgs/cms/pons_and_cop/pons/pon4/pon4.aspx // strictly, Ireland 1975 is from ETRF89: qv // www.osi.ie/OSI/media/OSI/Content/Publications/transformations_booklet.pdf // www.ordnancesurvey.co.uk/oswebsite/gps/information/coordinatesystemsinfo/guidecontents/guide6.html#6.5

/**

/**

// taken from http://www.movable-type.co.uk/scripts/latlong-gridref.html /**

function toDeg(num) { return num * 180 / Math.PI; }

// ============================================= // Our main function where we use the library to transform the data

loadDataset("original", function (error, dataset) { // error will be null unless there is an error // dataset is a Recline memory store (http://reclinejs.com//docs/src/backend.memory.html). // console.log(dataset); dataset.fields.splice(3, 0, {id: 'Latitude'}); dataset.fields.splice(3, 0, {id: 'Longitude'}); dataset.records = dataset.records.map(function(rec) { var out = transform(rec.Location_Easting_OSGR, rec.Location_Northing_OSGR); rec.Latitude = out.lat; rec.Longitude = out.lon; return rec; }); saveDataset(dataset); });

function transform(easting, northing) { var out = osGridToOSGB36(easting, northing); out = CoordTransform.convertOSGB36toWGS84(out); // console.log(out); return out; }

noelmas commented 10 years ago

Above problem was appearing in Google Chrome, also tried in Firefox, kept telling me the script was unresponsive.

rufuspollock commented 10 years ago

@noelmas it will be slow to load on that much data but looks like it has worked - when i look at http://explorer.okfnlabs.org/#noelmas/5f2bf36b37418bcf5ff8/view/grid there is 104210 records and they all seem to be convered. Note you can download the complete csv using the link at the top right called "Data"

noelmas commented 10 years ago

Great, looks like it did complete. I assume the script continues to run even if you close your browser? That would be useful info to have for people working with larger datasets.

rufuspollock commented 10 years ago

@noelmas in theory it should not continue to run if you close that window - but it does run in the background.

rufuspollock commented 10 years ago

INVALID.