mapshaper 0.7.6 → 0.7.8

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.
package/www/index.html CHANGED
@@ -1,22 +1,18 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <title>mapshaper</title>
5
- <meta name="Description" content="A tool for topologically aware shape simplification. Reads and writes Shapefile, GeoJSON, TopoJSON, KML, GeoPackage and FlatGeobuf formats.">
4
+ <title>Mapshaper</title>
5
+ <meta name="Description" content="A topology-aware tool for editing and converting geospatial vector data. Works with Shapefile, GeoJSON, TopoJSON, GeoPackage, FlatGeobuf, GeoParquet and KML — in the browser or on the command line.">
6
6
  <meta charset="UTF-8">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
8
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
9
9
  <script>
10
- // If the page is opened with preloaded data (?files= or ?catalog= in the
11
- // URL), tag <html> so CSS hides the splash-screen header links right away.
12
- // Without this they flash into view for ~a second before the editor mounts
13
- // and hides them. Done as the first script in <head> so the class is set
14
- // before any layout. bin/mapshaper-gui adds the same class server-side
15
- // when files are passed on the command line.
16
10
  (function() {
17
11
  try {
18
12
  var s = location.search || '';
19
- if (s.indexOf('files=') !== -1 || s.indexOf('catalog=') !== -1) {
13
+ if (!window.location.hostname.endsWith("mapshaper.org") ||
14
+ s.indexOf('files=') !== -1 || s.indexOf('catalog=') !== -1) {
15
+ // hide spash-screen header links
20
16
  document.documentElement.className += ' mapshaper-preload';
21
17
  }
22
18
  } catch (e) {}
@@ -26,7 +22,7 @@
26
22
  <link rel="stylesheet" href="elements.css">
27
23
  <link rel="icon" type="image/png" href="images/icon.png">
28
24
  </head>
29
- <body class="mapshaper-preload">
25
+ <body>
30
26
  <div class="hidden">
31
27
  <svg version="1.1" id="home-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
32
28
  y="0px" width="14px" height="19px" viewBox="0 0 14 16">
@@ -72,7 +68,7 @@
72
68
  <div class="page-header">
73
69
  <div class="mapshaper-logo">map<span class="logo-highlight">shaper</span></div>
74
70
 
75
- <div class="layer-control-btn"><span class="btn header-btn layer-name"></span></div>
71
+ <div class="layer-control-btn icon-duo"><span class="btn header-btn layer-name"></span></div>
76
72
 
77
73
  <div class="simplify-control-wrapper"><div class="simplify-control"><div class="header-btn btn simplify-settings-btn">Settings</div>
78
74
  <div class="slider">
@@ -323,7 +319,7 @@ a smoother appearance.</div></div></div></div>
323
319
  <span><input type="checkbox" class="advanced-import-options">with advanced options</span>
324
320
  <div class="mini-drop-area">
325
321
  <div class="subtitle">Drop, paste or <span class="add-btn inline-btn btn"><span class="label-text">select</span></span> files to import.</div>
326
- <div class="subtitle">Shapefile, GeoJSON, TopoJSON, GeoPackage, FlatGeobuf, KML and CSV formats are supported. Files can be zipped or gzipped.</div>
322
+ <div class="subtitle">Shapefile, GeoJSON, TopoJSON, GeoPackage, FlatGeobuf, GeoParquet, KML and CSV formats are supported. Files can be zipped or gzipped.</div>
327
323
  </div>
328
324
  </div>
329
325
  <div class="queued-file-section">
@@ -2064,6 +2064,7 @@
2064
2064
  }
2065
2065
 
2066
2066
  var geopackagePromise = null;
2067
+ var geoParquetPromise = null;
2067
2068
 
2068
2069
  async function loadGeopackageLib() {
2069
2070
  if (!window.modules || !window.modules['@ngageoint/geopackage']) {
@@ -2097,6 +2098,16 @@
2097
2098
  }
2098
2099
  }
2099
2100
 
2101
+ async function loadGeoParquetLib() {
2102
+ if (!window.modules || !window.modules.hyparquet || !window.modules['hyparquet-writer']) {
2103
+ if (!geoParquetPromise) {
2104
+ geoParquetPromise = loadScript('geoparquet.js');
2105
+ }
2106
+ await geoParquetPromise;
2107
+ geoParquetPromise = null;
2108
+ }
2109
+ }
2110
+
2100
2111
  // @cb function(<FileList>)
2101
2112
  function DropControl(gui, el, cb) {
2102
2113
  var area = El(el);
@@ -2515,7 +2526,10 @@
2515
2526
  if (group.gpkg) {
2516
2527
  await loadGeopackageLib();
2517
2528
  }
2518
- if (group.gpkg || group.fgb) {
2529
+ if (group.parquet) {
2530
+ await loadGeoParquetLib();
2531
+ }
2532
+ if (group.gpkg || group.fgb || group.parquet) {
2519
2533
  dataset = await internal.importContentAsync(group, importOpts);
2520
2534
  } else {
2521
2535
  dataset = internal.importContent(group, importOpts);
@@ -2546,7 +2560,7 @@
2546
2560
  function filesMayContainPaths(files) {
2547
2561
  return utils$1.some(files, function(f) {
2548
2562
  var type = internal.guessInputFileType(f.name);
2549
- return type == 'shp' || type == 'json' || type == 'gpkg' || internal.isZipFile(f.name);
2563
+ return type == 'shp' || type == 'json' || type == 'gpkg' || type == 'parquet' || internal.isZipFile(f.name);
2550
2564
  });
2551
2565
  }
2552
2566
 
@@ -4968,6 +4982,8 @@
4968
4982
  var opts = getExportOpts();
4969
4983
  if (opts.format == 'geopackage') {
4970
4984
  await loadGeopackageLib();
4985
+ } else if (opts.format == 'geoparquet') {
4986
+ await loadGeoParquetLib();
4971
4987
  }
4972
4988
  opts.active_layer = gui.model.getActiveLayer().layer; // kludge to support restoring active layer in gui
4973
4989
  if (opts.format == internal.PACKAGE_EXT) {
@@ -5108,7 +5124,7 @@
5108
5124
 
5109
5125
  function getExportFormats() {
5110
5126
  // return ['shapefile', 'geojson', 'topojson', 'json', 'dsv', 'kml', 'svg', internal.PACKAGE_EXT];
5111
- return ['shapefile', 'json', 'geojson', 'dsv', 'topojson', 'flatgeobuf', 'geopackage', 'kml', internal.PACKAGE_EXT, 'svg'];
5127
+ return ['shapefile', 'json', 'geojson', 'dsv', 'topojson', 'flatgeobuf', 'geopackage', 'geoparquet', 'kml', internal.PACKAGE_EXT, 'svg'];
5112
5128
  }
5113
5129
 
5114
5130
  function initFormatMenu() {
@@ -15412,7 +15428,8 @@ GUI and setting the size and crop of SVG output.</p><div><input type="text" clas
15412
15428
  gui = new GuiInstance('body');
15413
15429
 
15414
15430
  if (!importOpts.files?.length) {
15415
- El('body').removeClass('mapshaper-preload');
15431
+ // show header links if not preloading files
15432
+ document.documentElement.classList.remove('mapshaper-preload');
15416
15433
  }
15417
15434
 
15418
15435
  new AlertControl(gui);