Git Product home page Git Product logo

parkly's Introduction

parkly

parkly's People

Contributors

iivi avatar

Watchers

 avatar  avatar  avatar

parkly's Issues

Leafet with Mapbox tiles

@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?

Not inserting all data into my database from cartodb.com api

@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');
});
};
};

Associations

@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?

GeoJSON Object is Freezing my Machine

@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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.