我有一个 geoJSON 文件,我vector.tiles使用这个 npm 包转换成它。我用const tileIndex = geojsonvt(geoJSON). geoJSON 文件具有以下格式,并且在转换时没有任何错误。
const geoJSON = {
type: 'FeatureCollection',
crs: {
type: 'name',
properties: { name: 'urn:ogc:def:crs:OGC:1.3:CRS84' }
},
features: [
{
properties: [Object],
geometry: [Object],
type: 'Feature',
_id: '5ed7b221a61a4b2970433932'
},
... 1840 more items
]
}
Run Code Online (Sandbox Code Playgroud)
转换后得到的结果(geoJSON vector-tiles)如下 -
const tiles = {
options: {},
tiles: {
'0': {
features: [Array],
numPoints: 540529,
numSimplified: 3,
numFeatures: 1940,
source: null,
x: 0,
y: 0,
z: …Run Code Online (Sandbox Code Playgroud) 我尝试了所有与使用 node.js 在 MongoDB 中删除引用文档相关的堆栈溢出解决方案。但是他们中的大多数要么有不推荐使用的方法的解决方案,其中一些根本不起作用。
我有两个模型,Parent并且Child有one-to-many关系。父文档包含一组引用的子文档 ID,如下面的架构所示。
//file => parent.js
const parentSchema = new mongoose.Schema({
parentName: {
type: String,
},
childrens : [
{
type: mongoose.Schema.Types.ObjectId,
ref: 'Children'
}
]
});
const Parent = mongoose.model("Parent", parentSchema);
module.exports = Parent ;
Run Code Online (Sandbox Code Playgroud)
下一个文件具有成功触发的children带有childrenSchema.pre()中间件或钩子的模型-
//file => children.js
const mongoose = require("mongoose");
const Parent = require("./parent");
const childrenSchema = new mongoose.Schema({
childrenId: Number,
info: String,
type: String,
});
childrenSchema.pre('findOneAndDelete', async function(next) {
console.log('trigger when …Run Code Online (Sandbox Code Playgroud) 添加可复制性:
data.frame(
product=c(rep("x",2),rep("y",3)),
price_category_from=c(10,20,10,20,30),
price=c(30,31,31,30,27)
Run Code Online (Sandbox Code Playgroud)
)
如下所示,我有一个表格,我想对其进行分组product并更改price_category_from列的值以找到最小值price。
product price_category_from price
x 10 30
x 20 31
y 10 31
y 20 30
y 30 27
Run Code Online (Sandbox Code Playgroud)
如下所示,结果表应包含price.new用于更改列中值的最小price_category_from列。例如,price.new在产品的两行中x都是30因为类别的后续price值price_category_from更大。而对于产品y,每个后续price_category_from类别的最小值都会发生变化,因为下一个price值较小。
中的值price_category_from是按递增顺序排列的间隔。
product price_category_from price price.new
x 10 30 30
x 20 31 30 **
y 10 31 31
y 20 30 30
y 30 27 27 …Run Code Online (Sandbox Code Playgroud) 我有两个文件 - 其中之一是公共文件,其中包含使用 axios 进行请求的逻辑PUT。progress bar另一个文件包含根据progressEventfrom方法的值进行更新的组件onUploadProgress。我想setUploadPercentage用发出的当前值设置状态。但我很难重构我的代码以访问我的类组件中的这个值FileUpload。任何帮助,将不胜感激。
export function putData(formData) {
return axios.put('/update', formData, {
headers: {
"Content-Type": "multipart/form-data",
},
onUploadProgress : (progressEvent) => {
return parseInt(Math.round((progressEvent.loaded * 100) / progressEvent.total))
},
});
}
Run Code Online (Sandbox Code Playgroud)
import React, { useState } from "react";
import { putData } from "../../services/clientService";
import Progress from "../common/progress";
const FileUpload = () => {
const [uploadPercentage, setUploadPercentage] = useState(0);
const onChange = …Run Code Online (Sandbox Code Playgroud) javascript ×2
reactjs ×2
axios ×1
data.table ×1
dplyr ×1
express ×1
mapbox ×1
mapbox-gl ×1
mapbox-gl-js ×1
mongodb ×1
mongoose ×1
node.js ×1
r ×1
react-state ×1
reshape2 ×1
vector-tiles ×1