iivi / parkly Goto Github PK
View Code? Open in Web Editor NEWsuite parking app, brough
suite parking app, brough
@harimohanraj89 @DrRobotmck @WilliamfShaw @bigtone1284
Can't get Leaflet to work with a Mapbox street tile. Followed tutorial, and no success. Tried alternate, hacky-seeming ways from various stack overflow threads, and still no success.
Has anyone worked with Leaflet and Mapbox before? Perhaps can point me towards an easier map to use for making polygons in js?
@harimohanraj89 @DrRobotmck @WilliamfShaw @bigtone1284
Wrote a script to grab all parking regulation info from my cartodb.com db via an api call, and create these in my database. However, when I run this, it only grabs about 5k of the roughly 360k objects.
var testAdd = function () {
$.ajax({
url: 'http://andrewcarton1.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT%20*%20FROM%20parking_regulationshp_1&api_key=a8614e1207568c75211faba281eda4f8d56c8164',
method: 'get'
}).done(testAddData);
};
var testAddData = function (regulationsCarto) {
debugger;
for(var i = 0; i < regulationsCarto.features.length; i++) {
$.ajax({
url: '/regulations/newpoop',
method: 'post',
data: {
object_id: regulationsCarto.features[i].properties.objectid,
borough: regulationsCarto.features[i].properties.sg_key_bor,
location_id: regulationsCarto.features[i].properties.sg_order_n,
sign_sequence: regulationsCarto.features[i].properties.sg_seqno_n,
curb_distance: regulationsCarto.features[i].properties.sr_dist,
sign_code: regulationsCarto.features[i].properties.sg_mutcd_c,
sign_faces: regulationsCarto.features[i].properties.sg_sign_fc,
sign_arrow: regulationsCarto.features[i].properties.sg_arrow_d,
sign_description: regulationsCarto.features[i].properties.signdesc1,
cartodb_id: regulationsCarto.features[i].properties.cartodb_id,
x: regulationsCarto.features[i].geometry.coordinates[1],
y: regulationsCarto.features[i].geometry.coordinates[0]
}
}).done(function() {
console.log('done with one');
});
};
};
@harimohanraj89 @DrRobotmck @WilliamfShaw @bigtone1284
Trying to associate two tables, signs and locations, via a foreign key (status_code) that is not the primary key (id) of the one-side table (location). Setting the foreign key in my models to this column did not work.
"use strict";
module.exports = function(sequelize, DataTypes) {
var signs = sequelize.define("signs", {
status_code: DataTypes.TEXT,
sign_sequence: DataTypes.INTEGER,
curb_distance: DataTypes.INTEGER,
arrow_points: DataTypes.STRING,
sign_description: DataTypes.TEXT,
sign_code: DataTypes.STRING,
location_id: DataTypes.INTEGER
}, {
timestamps:false,
underscored:true,
classMethods: {
associate: function(models) {
signs.belongsTo(models.locations, { foreignKey: 'status_code' });
}
}
});
return signs;
};
"use strict";
module.exports = function(sequelize, DataTypes) {
var locations = sequelize.define("locations", {
on_street: DataTypes.STRING,
cross_street_one: DataTypes.STRING,
cross_street_two: DataTypes.STRING,
side_of_street: DataTypes.STRING,
status_code: DataTypes.TEXT
}, {
timestamps:false,
underscored:true,
classMethods: {
associate: function(models) {
locations.hasMany(models.signs, { foreignKey: 'status_code' });
}
}
});
return locations;
};
Setting this column as the primary key and then setting the association did not work.
Tried writing a little script that would populate a new column (location_id) with the id of the of the location row matching the status_code, but it times out; probably because there are 750k rows.
Sign.findAll()
.then(function(signs) {
for (var i = 0; i < signs.length; i++) {
Location.findAll({
where: {status_id: signs[i].status_id}
})
.then(function (location) {
newId = location.id;
res.send(location);
});
signs[i].update({location_id: newId})
.then(function() {
res.send(signs[i]);
})
};
})
-How do I set up a foreign key that is a string, and also not the primary key of one table?
@harimohanraj89 @DrRobotmck @WilliamfShaw @bigtone1284
I'm trying to work with GeoJSONs to render cool data to my leaflet map. After converting a .shp (GIS shape file) to GeoJSON, I try to open it in Sublime Text to add a line. However, Sublime freezes before ever displaying the file. Text Editor can open and display it after a few minutes, but takes several minutes to even register a keystroke.
How can I better deal with huge JSON files?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.