Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuse search failed to display search results popup #270

Open
tekash1997 opened this issue May 31, 2015 · 0 comments
Open

fuse search failed to display search results popup #270

tekash1997 opened this issue May 31, 2015 · 0 comments

Comments

@tekash1997
Copy link

fuse search could not display search results popup after clicking on the index keys from geojson file.
here goes my code..

sample geojson data

var exp_Parcel = {
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },

"features": [
{ "type": "Feature", "properties": { "color_qgis2leaf": '#e05acf', "border_color_qgis2leaf": '#000000', "radius_qgis2leaf": 1.3, "transp_qgis2leaf": 1.0, "transp_fill_qgis2leaf": 1.0, "pid": 37, "PIC": "F01", "Block_Code": "T01", "Purpose": "መንበሪ", "Lease_Period": 50, "Payment_Completion": 30, "Land_Type": "ዝተካረየ ቦታ", "Area": 500.000000, "Height": "g+3", "Expense": 1500.000000, "Initial_price": 1650.000000, "Grade": "1ይ - 2ይ", "Bid_Round": 0, "Complain": "No", "City": "መቐለ", "Sub_City": "ሓወልቲ", "Wereda": "", "kebele": "", "Location": "ሓወልቲ", "L_Description": "", "East": "????", "West": "f03", "North": "F01", "South": "f04", "Water": "Yes", "E_Power": "Yes", "Road": "Yes", "Telephone": "Yes", "Status": "Available", "_Flag": 0, "Reg_Date": "2007/09/20", "Given_Date": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 39.473685174223803, 13.527316687427279 ], [ 39.473677696856114, 13.527166422577492 ], [ 39.473914538972764, 13.527161760750269 ], [ 39.473924898816776, 13.527316233730463 ], [ 39.473685174223803, 13.527316687427279 ], [ 39.473685174223803, 13.527316687427279 ] ] ] } },
{ "type": "Feature", "properties": { "color_qgis2leaf": '#e05acf', "border_color_qgis2leaf": '#000000', "radius_qgis2leaf": 1.3, "transp_qgis2leaf": 1.0, "transp_fill_qgis2leaf": 1.0, "pid": 38, "PIC": "F02", "Block_Code": "T01", "Purpose": "መንበሪ", "Lease_Period": 50, "Payment_Completion": 25, "Land_Type": "ባዶ ቦታ", "Area": 345.000000, "Height": "g+1", "Expense": 320.000000, "Initial_price": 780.000000, "Grade": "1ይ - 3ይ", "Bid_Round": 0, "Complain": "No", "City": "መቐለ", "Sub_City": "ዓይደር", "Wereda": "", "kebele": "", "Location": "ዓይደር", "L_Description": "", "East": "F01", "West": "F01", "North": "መንገዲ", "South": "F03", "Water": "Yes", "E_Power": "Yes", "Road": "Yes", "Telephone": "Yes", "Status": "Available", "_Flag": 0, "Reg_Date": "2007/09/20", "Given_Date": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 39.473677696856114, 13.527166422577492 ], [ 39.473914538972764, 13.527161760750269 ], [ 39.473904905011707, 13.527005170551833 ], [ 39.473672358321409, 13.527004209120372 ], [ 39.473677696856114, 13.527166422577492 ], [ 39.473677696856114, 13.527166422577492 ] ] ] } },
.........

javascript code to load data

var exp_ParcelJSON = new L.geoJson(exp_Parcel,{
onEachFeature: function (feature, layer) {
//add label on load
var popupContent = 'some text contents goes here';
layer.bindPopup(popupContent);
var bounds = layer.getBounds();
// Get center of bounds
var center = bounds.getCenter();
// Use center to put marker on map
var marker = L.circleMarker(center).addTo(map); // Make appear above other map features
marker.bindLabel(feature.properties['PIC'],{noHide:true}).addTo(map);
},
style: function (feature) {
return {color: feature.properties.border_color_qgis2leaf,
fillColor: feature.properties.color_qgis2leaf,
weight: feature.properties.radius_qgis2leaf,
opacity: feature.properties.transp_qgis2leaf,
fillOpacity: feature.properties.transp_qgis2leaf};
}
});

javascript code to add the fuse search control

var searchCtrl = L.control.fuseSearch();
searchCtrl.addTo(map);
//load parcel data
searchCtrl.indexFeatures(exp_Parcel.features, ['PIC', 'Purpose', 'Area']);

map_screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant