QGIS doesn't save customized visualization attributes when exporting to GeoJSON format. This is a known limitation because GeoJSON files don't inherently support storing styling information.
- Open QGIS
- Go to
Plugins→Manage and Install Plugins - Search for "qgis2web"
- Install the plugin
- Load your data layers in QGIS
- Apply your desired styling and symbology
- Ensure all custom attributes are properly configured
- Save your project (.qgz file)
- Go to
Web→qgis2web→Create web map - In the qgis2web dialog:
- Select your layers
- Choose export format (Leaflet, OpenLayers, or Mapbox)
- Configure popup fields to include your custom attributes
- Set styling options to preserve visual appearance
- Click "Update preview" to verify
- Click "Export" to generate the web map files
The qgis2web plugin generates:
data/folder containing GeoJSON files with preserved attributesjs/folder with JavaScript filescss/folder with styling filesindex.htmlfile
- Copy the generated GeoJSON files from
data/folder - Place them in your map dashboard's data directory
- Update your data loading logic to use these files
- Apply the generated CSS styles for consistent visualization
- GeoPackage format preserves both data and styling
- Use
Layer→Export→Save Features As - Choose GeoPackage format
- Import into your web application using appropriate libraries
- Export GeoJSON from QGIS
- Create a separate JSON file with styling information
- Merge styling data with GeoJSON in your application
Create a custom QGIS processing script that:
- Exports GeoJSON with all attributes
- Generates a companion styling file
- Combines both for web use
// Example of loading QGIS2Web generated data
const loadQGISData = async () => {
try {
// Load the GeoJSON with preserved attributes
const response = await fetch('/data/qgis-exported-layer.geojson');
const geojsonData = await response.json();
// Apply styling from qgis2web generated CSS
const style = {
color: '#ff0000',
weight: 2,
opacity: 0.8,
fillOpacity: 0.3
};
// Add to map with preserved attributes
L.geoJSON(geojsonData, {
style: style,
onEachFeature: (feature, layer) => {
// Access preserved custom attributes
const customAttr = feature.properties.customAttribute;
layer.bindPopup(`Custom: ${customAttr}`);
}
}).addTo(map);
} catch (error) {
console.error('Error loading QGIS data:', error);
}
};- Preserves all custom attributes and styling
- Generates web-ready files
- Maintains visual consistency with QGIS
- Easy integration with existing map dashboard
- No manual attribute recreation needed
data/layer_name.geojson- GeoJSON with all attributesjs/layer_name.js- JavaScript configurationcss/layer_name.css- Styling informationindex.html- Complete web map example