diff --git a/lots/static/js/largelots_cleveland.js b/lots/static/js/largelots_cleveland.js index 54f71c0..5cea84a 100644 --- a/lots/static/js/largelots_cleveland.js +++ b/lots/static/js/largelots_cleveland.js @@ -48,12 +48,12 @@ var LargeLots = { if(props.number){ info += "

Address: " + LargeLots.formatAddress(props) + "

"; } - info += "

PPN: " + props.parcel + "
"; + info += "

PPN: " + props.parcelpo_1 + "
"; // if (props.build){ // info += "Zoned: " + props.build + "
"; // } - if (props.sqft){ - info += "

Sq Ft: " + props.sqft + "
"; + if (props.landreus_3){ + info += "

Sq Ft: " + props.landreus_3 + "
"; } this._div.innerHTML = info; } @@ -65,14 +65,14 @@ var LargeLots = { LargeLots.info.addTo(LargeLots.map); - var fields = "ppn,parcel,address,sqft,street,number" //"pin14,zoning_classification,ward,street_name,street_dir,street_number,street_type,city_owned,residential" + var fields = "parcelpo_5,parcelpo_1,parcelpo_4,landreus_3,parcelpo_3,parcelpo_2" //"pin14,zoning_classification,ward,street_name,street_dir,street_number,street_type,city_owned,residential" var layerOpts = { - user_name: 'opencleveland', + user_name: 'openclevelandgis', type: 'cartodb', cartodb_logo: false, sublayers: [ { - sql: "SELECT * FROM joined WHERE (street != '') AND (number != '')", + sql: "SELECT * FROM sideyard WHERE (parcelpo_3 != '') AND (parcelpo_2 != '')", cartocss: $('#egp-styles').html().trim(), interactivity: fields } @@ -82,6 +82,7 @@ var LargeLots = { // } ] } + cartodb.createLayer(LargeLots.map, layerOpts) .addTo(LargeLots.map) .done(function(layer) { @@ -97,11 +98,11 @@ var LargeLots = { }); LargeLots.lotsLayer.on('featureClick', function(e, pos, latlng, data){ // console.log(data['parcel']); - LargeLots.getOneParcel(data['parcel']); + LargeLots.getOneParcel(data['parcelpo_1']); }); window.setTimeout(function(){ - if($.address.parameter('ppn')){ - LargeLots.getOneParcel($.address.parameter('parcel')) + if($.address.parameter('parcelpo_5')){ + LargeLots.getOneParcel($.address.parameter('parcelpo_1')) } }, 1000) }).error(function(e) { @@ -109,7 +110,7 @@ var LargeLots = { console.log(e) }); - $("#search_address").val(LargeLots.convertToPlainString($.address.parameter('address'))); + $("#search_address").val(LargeLots.convertToPlainString($.address.parameter('parcelpo_4'))); LargeLots.addressSearch(); $('.toggle-parcels').on('click', function(e){ if($(e.target).is(':checked')){ @@ -128,7 +129,7 @@ var LargeLots = { checks.push($(box).attr('id')) } }); - var sql = 'select * from joined where '; + var sql = 'select * from sideyard where '; var clauses = [] if(checks.indexOf('applied') >= 0){ clauses.push('status = 1') @@ -140,23 +141,23 @@ var LargeLots = { clauses = clauses.join(' or '); sql += clauses; } else { - sql = 'select * from joined where status not in (0,1)' + sql = 'select * from sideyard where status not in (0,1)' } LargeLots.lotsLayer.setSQL(sql); }, formatAddress: function (prop) { - return prop.number + " " + " " + prop.street; + return prop.parcelpo_2 + " " + " " + prop.parcelpo_3; }, getOneParcel: function(ppn_current){ if (LargeLots.lastClickedLayer){ LargeLots.map.removeLayer(LargeLots.lastClickedLayer); } - var sql = new cartodb.SQL({user: 'opencleveland', format: 'geojson'}); + var sql = new cartodb.SQL({user: 'openclevelandgis', format: 'geojson'}); //Issue #4: using apostrophes instead of casting to keep leading zeros. - ASKoiman 12/6/2014 -- \'{{num}}\' -- cwang console.log(ppn_current); - sql.execute('SELECT * from joined WHERE parcel = \'{{num}}\'', {num:ppn_current}) + sql.execute('SELECT * from sideyard WHERE parcelpo_1 = \'{{num}}\'', {num:ppn_current}) .done(function(data){ var shape = data.features[0]; LargeLots.lastClickedLayer = L.geoJson(shape); @@ -170,28 +171,28 @@ var LargeLots = { selectParcel: function (props){ // console.log(props); - var address = LargeLots.formatAddress(props); + var parcelpo_4 = LargeLots.formatAddress(props); var info = "

\ \ - \ - "; + \ + "; // if (props.build){ // info += ""; // } if (props.sqft){ - info += ""; + info += ""; } - info += "" + info += "" // info += "
Address" + address + "
Parcel Number" + props.parcel + " (info)
Address" + parcelpo_4 + "
Parcel Number" + props.parcelpo_1 + " (info)
Zoned" + props.build + "
Square feet" + LargeLots.addCommas(props.sqft) + "
Square feet" + LargeLots.addCommas(props.landreus_3) + "
\ //
"; - $.address.parameter('parcel', props.parcel) + $.address.parameter('parcelpo_1', props.parcelpo_1) $('#lot-info').html(info); $("#lot_apply").on("click", function(){ // if ($("#id_lot_1_address").val() == "") { - $("#id_lot_1_address").val($(this).data('address')); - $("#id_lot_1_ppn").val($(this).data('ppn')); + $("#id_lot_1_address").val($(this).data('parcelpo_4')); + $("#id_lot_1_ppn").val($(this).data('parcelpo_1')); // } // else if ($("#id_lot_1_address").val() != $(this).data('address')){ @@ -225,7 +226,7 @@ var LargeLots = { } } - $.address.parameter('address', encodeURIComponent(searchAddress)); + $.address.parameter('parcelpo__4', encodeURIComponent(searchAddress)); var s = document.createElement("script"); s.type = "text/javascript"; @@ -237,7 +238,7 @@ var LargeLots = { returnAddress: function (response){ if(!response.length){ - $('#addr_search_modal').html(LargeLots.convertToPlainString($.address.parameter('address'))); + $('#addr_search_modal').html(LargeLots.convertToPlainString($.address.parameter('parcelpo_4'))); $('#modalGeocode').modal('show'); return; }