New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

georender-pack

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

georender-pack - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

6

decode.js

@@ -48,3 +48,4 @@ var getNormals = require('polyline-normals')

types: new Float32Array(sizes.point.types),
ids: new Float32Array(sizes.point.ids),
//ids: new Float32Array(sizes.point.ids),
ids: Array(sizes.point.ids.length).fill(0),
positions: new Float32Array(sizes.point.positions),

@@ -55,3 +56,4 @@ labels: {}

types: new Float32Array(sizes.line.types),
ids: new Float32Array(sizes.line.ids),
//ids: new Float32Array(sizes.line.ids),
ids: Array(sizes.line.ids.length).fill(0),
positions: new Float32Array(sizes.line.positions),

@@ -58,0 +60,0 @@ normals: new Float32Array(sizes.line.normals),

@@ -38,22 +38,19 @@ var earcut = require('earcut')

if (osmIsArea(item)) {
var n = item.refs.length
var typeLen = varint.encodingLength(type)
var idLen = varint.encodingLength(id)
var pCount = varint.encodingLength(n)
var coords = []
item.refs.forEach(function (ref) {
coords.push(deps[ref].lon)
coords.push(deps[ref].lat)
})
for (var i=0; i<item.refs.length; i++) {
coords.push(deps[item.refs[i]].lon)
coords.push(deps[item.refs[i]].lat)
}
var pCount = coords.length/2
var pCountLen = varint.encodingLength(pCount)
var cells = earcut(coords)
var coords = []
item.refs.forEach(function (ref) {
coords.push(deps[ref].lon)
coords.push(deps[ref].lat)
})
var cells = earcut(coords)
var cLen = varint.encodingLength(earcut.length/3)
var cLen = varint.encodingLength(cells.length/3)
var cSize = 0
for (var i=0; i<cells.length; i++) {
cSize+=varint.encodingLength(cells[i])
}
var labelLen = getLabelLen(item.tags)
var buf = Buffer.alloc(1 + typeLen + idLen + pCount + cLen + n*4*2
+ (n-2)*3*2 + labelLen)
var buf = Buffer.alloc(1 + typeLen + idLen + pCountLen + pCount*4*2 + cLen + cSize + labelLen)
var offset = 0

@@ -66,25 +63,28 @@ buf.writeUInt8(0x03, 0)

offset+=varint.encode.bytes
varint.encode(item.refs.length, buf, offset)
varint.encode(pCount, buf, offset)
offset+=varint.encode.bytes
item.refs.forEach(function (ref) {
buf.writeFloatLE(deps[ref].lon, offset)
for (var i=0; i<coords.length; i++) {
buf.writeFloatLE(coords[i], offset)
offset+=4
buf.writeFloatLE(deps[ref].lat, offset)
offset+=4
})
}
varint.encode(cells.length/3, buf, offset)
offset+=varint.encode.bytes
cells.forEach(function (item) {
varint.encode(item, buf, offset)
for (var i=0; i<cells.length; i++){
varint.encode(cells[i], buf, offset)
offset+=varint.encode.bytes
})
}
writeLabelData(item.tags, buf, offset)
}
else if (item.refs.length > 1) {
var n = item.refs.length
var typeLen = varint.encodingLength(type)
var idLen = varint.encodingLength(id)
var pCount = varint.encodingLength(n)
var coords = []
for (var i=0; i<item.refs.length; i++) {
coords.push(deps[item.refs[i]].lon)
coords.push(deps[item.refs[i]].lat)
}
var pCount = coords.length/2
var pCountLen = varint.encodingLength(pCount)
var labelLen = getLabelLen(item.tags)
var buf = Buffer.alloc(1 + typeLen + idLen + pCount + n*8 + labelLen)
var buf = Buffer.alloc(1 + typeLen + idLen + pCount*4*2 + pCountLen + labelLen)
var offset = 0

@@ -97,9 +97,105 @@ buf.writeUInt8(0x02, 0)

offset+=varint.encode.bytes
varint.encode(item.refs.length, buf, offset)
varint.encode(pCount, buf, offset)
offset+=varint.encode.bytes
item.refs.forEach(function (ref) {
buf.writeFloatLE(deps[ref].lon, offset)
for (var i=0; i<coords.length; i++) {
buf.writeFloatLE(coords[i], offset)
offset+=4
buf.writeFloatLE(deps[ref].lat, offset)
}
writeLabelData(item.tags, buf, offset)
}
else {
var buf = Buffer.alloc(0)
}
}
if (item.type === 'relation') {
if (osmIsArea(item)) {
var typeLen = varint.encodingLength(type)
var idLen = varint.encodingLength(id)
var coords = []
var cells = []
var holes = []
var ppositions = []
var closed = false
var ref0 = -1
for (var i=0; i<item.members.length; i++){
var role = item.members[i].role
if (role === "outer") {
if (closed) {
var pcells = earcut(ppositions, holes)
for (var j=0; j<pcells.length; j++) {
cells.push(pcells[j] + coords.length/2 - ppositions.length/2)
}
ppositions = []
holes = []
ref0 = -1
}
if (!deps[item.members[i].id]) continue
var member = deps[item.members[i].id]
if (!member.refs) continue
for (var j=0; j<member.refs.length; j++) {
if (ref0 === member.refs[j]) {
closed = true
ref0 = -1
continue
}
if (ref0 < 0) { ref0 = member.refs[j] }
var ref = deps[member.refs[j]]
ppositions.push(ref.lon, ref.lat)
coords.push(ref.lon, ref.lat)
}
}
else if (item.members[i].role === "inner") {
if (!deps[item.members[i].id]) continue
var member = deps[item.members[i].id]
if (!member.refs) continue
for (var j=0; j<member.refs.length; j++) {
if (ref0 === member.refs[j]) {
ref0 = -1
continue
}
if (ref0 < 0) {
ref0 = member.refs[j]
holes.push(ppositions.length/2)
}
var ref = deps[member.refs[j]]
ppositions.push(ref.lon, ref.lat)
coords.push(ref.lon, ref.lat)
}
}
}
if (closed) {
var pcells = earcut(ppositions, holes)
for (var j=0; j<pcells.length; j++) {
cells.push(pcells[j] + coords.length/2 - ppositions.length/2)
}
ppositions = []
holes = []
}
var pCount = coords.length/2
var pCountLen = varint.encodingLength(pCount)
var cLen = varint.encodingLength(cells.length/3)
var cSize = 0
for (var i=0; i<cells.length; i++) {
cSize+=varint.encodingLength(cells[i])
}
var labelLen = getLabelLen(item.tags)
var buf = Buffer.alloc(1 + typeLen + idLen + pCountLen + pCount*4*2 + cLen + cSize + labelLen)
var offset = 0
buf.writeUInt8(0x03, 0)
offset+=1
varint.encode(type, buf, offset)
offset+=varint.encode.bytes
varint.encode(id, buf, offset)
offset+=varint.encode.bytes
varint.encode(pCount, buf, offset)
offset+=varint.encode.bytes
for (var i=0; i<coords.length; i++) {
buf.writeFloatLE(coords[i], offset)
offset+=4
}
varint.encode(cells.length/3, buf, offset)
offset+=varint.encode.bytes
cells.forEach(function (item) {
varint.encode(item, buf, offset)
offset+=varint.encode.bytes
})

@@ -106,0 +202,0 @@ writeLabelData(item.tags, buf, offset)

@@ -757,2 +757,3 @@ {

"building.other": 754,
"building.yes": 1239,
"craft.agricultural_engines": 755,

@@ -953,69 +954,69 @@ "craft.atelier": 756,

"man_made.other": 949,
"military:airfield": 950,
"military:barracks": 951,
"military:bunker": 952,
"military:checkpoint": 953,
"military:danger_area": 954,
"military:naval_base": 955,
"military:nuclear_explosion_site": 956,
"military:obstacle_course": 957,
"military:office": 958,
"military:range": 959,
"military:training_area": 960,
"military:trench": 961,
"military:other": 962,
"natural:wood": 963,
"natural:tree_row": 964,
"natural:tree": 965,
"natural:scrub": 966,
"natural:heath": 967,
"natural:moor": 968,
"natural:grassland": 969,
"natural:fell": 970,
"natural:bare_rock": 971,
"natural:scree": 972,
"natural:shingle": 973,
"natural:sand": 974,
"natural:mud": 975,
"natural:water": 976,
"natural:wetland": 977,
"natural:glacier": 978,
"natural:bay": 979,
"natural:strait": 980,
"natural:cape": 981,
"natural:beach": 982,
"natural:coastline": 983,
"natural:reef": 984,
"natural:spring": 985,
"natural:hot_spring": 986,
"natural:geyser": 987,
"natural:blowhole": 988,
"natural:peak": 989,
"natural:volcano": 990,
"natural:valley": 991,
"natural:peninsula": 992,
"natural:isthmus": 993,
"natural:ridge": 994,
"natural:arete": 995,
"natural:cliff": 996,
"natural:saddle": 997,
"natural:dune": 998,
"natural:rock": 999,
"natural:stone": 1000,
"natural:sinkhole": 1001,
"natural:cave_entrance": 1002,
"natural:other": 1003,
"office:accountant": 1004,
"office:adoption_agency": 1005,
"office:advertising_agency": 1006,
"office:architect": 1007,
"office:association": 1008,
"office:bail_bond_agent": 1009,
"office:charity": 1010,
"office:company": 1011,
"office:consulting": 1012,
"office:coworking": 1013,
"office:diplomatic": 1014,
"office:educational_institution": 1015,
"office:employment_agency": 1016,
"military.airfield": 950,
"military.barracks": 951,
"military.bunker": 952,
"military.checkpoint": 953,
"military.danger_area": 954,
"military.naval_base": 955,
"military.nuclear_explosion_site": 956,
"military.obstacle_course": 957,
"military.office": 958,
"military.range": 959,
"military.training_area": 960,
"military.trench": 961,
"military.other": 962,
"natural.wood": 963,
"natural.tree_row": 964,
"natural.tree": 965,
"natural.scrub": 966,
"natural.heath": 967,
"natural.moor": 968,
"natural.grassland": 969,
"natural.fell": 970,
"natural.bare_rock": 971,
"natural.scree": 972,
"natural.shingle": 973,
"natural.sand": 974,
"natural.mud": 975,
"natural.water": 976,
"natural.wetland": 977,
"natural.glacier": 978,
"natural.bay": 979,
"natural.strait": 980,
"natural.cape": 981,
"natural.beach": 982,
"natural.coastline": 983,
"natural.reef": 984,
"natural.spring": 985,
"natural.hot_spring": 986,
"natural.geyser": 987,
"natural.blowhole": 988,
"natural.peak": 989,
"natural.volcano": 990,
"natural.valley": 991,
"natural.peninsula": 992,
"natural.isthmus": 993,
"natural.ridge": 994,
"natural.arete": 995,
"natural.cliff": 996,
"natural.saddle": 997,
"natural.dune": 998,
"natural.rock": 999,
"natural.stone": 1000,
"natural.sinkhole": 1001,
"natural.cave_entrance": 1002,
"natural.other": 1003,
"office.accountant": 1004,
"office.adoption_agency": 1005,
"office.advertising_agency": 1006,
"office.architect": 1007,
"office.association": 1008,
"office.bail_bond_agent": 1009,
"office.charity": 1010,
"office.company": 1011,
"office.consulting": 1012,
"office.coworking": 1013,
"office.diplomatic": 1014,
"office.educational_institution": 1015,
"office.employment_agency": 1016,
"office.energy_supplier": 1017,

@@ -1130,3 +1131,116 @@ "office.engineer": 1018,

"tourism.zoo": 1125,
"tourism.other": 1126
"tourism.other": 1126,
"communication.line": 1127,
"border_type.baseline": 1128,
"border_type.contiguous": 1129,
"border_type.eez": 1130,
"border_type.territorial": 1131,
"seamark:type.anchorage": 1152,
"seamark:type.anchor_berth": 1153,
"seamark:type.beacon_cardinal": 1154,
"seamark:type.beacon_isolated_danger": 1138,
"seamark:type.beacon_lateral": 1135,
"seamark:type.beacon_safe_water": 1155,
"seamark:type.beacon_special_purpose": 1141,
"seamark:type.berth": 1156,
"seamark:type.bridge": 1146,
"seamark:type.building": 1158,
"seamark:type.bunker_station": 1157,
"seamark:type.buoy_cardinal": 1145,
"seamark:type.buoy_installation": 1159,
"seamark:type.buoy_isolated_danger": 1160,
"seamark:type.buoy_lateral": 1133,
"seamark:type.buoy_safe_water": 1161,
"seamark:type.buoy_special_purpose": 1143,
"seamark:type.cable_area": 1162,
"seamark:type.cable_overhead": 1163,
"seamark:type.cable_submarine": 1164,
"seamark:type.calling-in_point": 1207,
"seamark:type.causeway": 1165,
"seamark:type.checkpoint": 1166,
"seamark:type.coastguard_station": 1167,
"seamark:type.communication_area": 1168,
"seamark:type.control_point": 1169,
"seamark:type.daymark": 1170,
"seamark:type.distance_mark": 1140,
"seamark:type.dredged_area": 1171,
"seamark:type.dumping_ground": 1172,
"seamark:type.exceptional_structure": 1173,
"seamark:type.fairway": 1174,
"seamark:type.ferry_route": 1175,
"seamark:type.fishing_facility": 1179,
"seamark:type.fog_signal": 1177,
"seamark:type.fortified_structure": 1178,
"seamark:type.gate": 1180,
"seamark:type.gridirom": 1181,
"seamark:type.harbour": 1147,
"seamark:type.harbour_basin": 1182,
"seamark:type.hulk": 1183,
"seamark:type.inshore_traffic_zone": 1184,
"seamark:type.landmark": 1142,
"seamark:type.light": 1185,
"seamark:type.light_float": 1186,
"seamark:type.light_vessel": 1187,
"seamark:type.light_major": 1148,
"seamark:type.light_minor": 1136,
"seamark:type.lock_basin": 1188,
"seamark:type.marine_farm": 1189,
"seamark:type.military_area": 1190,
"seamark:type.mooring": 1134,
"seamark:type.navigation_line": 1151,
"seamark:type.notice": 1137,
"seamark:type.obstruction": 1192,
"seamark:type.oil_barrier": 1193,
"seamark:type.pile": 1139,
"seamark:type.pilot_boarding": 1196,
"seamark:type.pipeline_area": 1197,
"seamark:type.pipeline_overhead": 1198,
"seamark:type.pipeline_submarine": 1199,
"seamark:type.platform": 1194,
"seamark:type.pontoon": 1200,
"seamark:type.precautionary_area": 1201,
"seamark:type.production_area": 1195,
"seamark:type.protected_area": 1191,
"seamark:type.pylon": 1192,
"seamark:type.radar_line": 1202,
"seamark:type.radar_range": 1203,
"seamark:type.radar_reflector": 1204,
"seamark:type.radar_transponder": 1205,
"seamark:type.radar_station": 1206,
"seamark:type.radio_station": 1208,
"seamark:type.recommended_route_centreline": 1209,
"seamark:type.recommended_track": 1210,
"seamark:type.recommended_traffic_lane": 1211,
"seamark:type.rescue_station": 1212,
"seamark:type.restricted_area": 1150,
"seamark:type.retro_reflector": 1213,
"seamark:type.rock": 1132,
"seamark:type.sand_waves": 1214,
"seamark:type.sea_area": 1215,
"seamark:type.seabed_area": 1216,
"seamark:type.seaplane_landing_area": 1217,
"seamark:type.separation_boundary": 1225,
"seamark:type.separation_crossing": 1226,
"seamark:type.separation_lane": 1227,
"seamark:type.separation_line": 1228,
"seamark:type.separation_roundabout": 1229,
"seamark:type.separation_zone": 1230,
"seamark:type.shoreline_construction": 1219,
"seamark:type.signal_station_traffic": 1220,
"seamark:type.signal_station_warning": 1221,
"seamark:type.small_craft_facility": 1144,
"seamark:type.spring": 1222,
"seamark:type.submarine_transit_lane": 1223,
"seamark:type.tank": 1218,
"seamark:type.topmark": 1224,
"seamark:type.turning_basin": 1231,
"seamark:type.two-way_route": 1232,
"seamark:type.vehicle_transfer": 1235,
"seamark:type.vegetation": 1233,
"seamark:type.virtual_aton": 1234,
"seamark:type.wall": 1176,
"seamark:type.water_turbulence": 1236,
"seamark:type.waterway_gauge": 1237,
"seamark:type.weed": 1238,
"seamark:type.wreck": 1149
}
{
"name": "georender-pack",
"version": "2.0.1",
"version": "2.1.0",
"description": "pack and unpack osm data based on the peermaps buffer schema",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc