geolicious / qgis2leaf Goto Github PK
View Code? Open in Web Editor NEWA QGIS plugin to create a working leaflet based webmap from it
A QGIS plugin to create a working leaflet based webmap from it
Traceback (most recent call last):
File "/home/ubuntu/.qgis2/python/plugins/qgis2leaf/qgis2leafdialog.py", line 85, in export2leaf
qgis2leaf_exec(self.outFileName, self.basemapName, self.width, self.height, self.extent, self.full_screen)
File "/home/ubuntu/.qgis2/python/plugins/qgis2leaf/qgis2leaf_exec.py", line 110, in qgis2leaf_exec
qgis.core.QgsVectorFileWriter.writeAsVectorFormat(i,dataStore + os.sep + str(i.name()) + '.js', 'utf-8', exp_crs, 'GeoJson')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 19: ordinal not in range(128)
Versione Python:
2.7.3 (default, Feb 27 2014, 20:09:21)
[GCC 4.6.3]
The index.html should be written with more structure as it makes it easier to read for the developer who would like to enhance the webmap.
the symbol of the plugin is the standard symbol. there should be a symbol which identifies the functionality more.
You might want to add an option to make map full screen.
You can do this by adding:
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
width: 100%;
}
</style>
and removing the css in currently in the map div.
the current webmap is produced by mimicking the current webmap. Yet it would be a benefit to define a custom icon for points in the map.
When loading index.html I get the following in my console:
Not allowed to load local resource: file:///C:/wamp/www/qgis2leaf/data/Boundary.js
I changed to: <script src='data/Boundary.js' ></script> instead and this worked fine.
Perhaps you could change the plugin to do this.
Matt
You should add a drop down menu to choose the background layer for leaflet
the attribute table should be visible as a plain table in the standard popup
in the leaflet webmap I cannot change the layers. There should be a layer control for the exported layers.
Leaflet webmap can be altered very easily to work smoothly on mobile systems. It justed needs some style statements in the beginning of the file. Enhance the source code to publiah a mobile frendly version.
I want to export around 160 layers to leaflet using qgis2leaf. But, just let me to export only 2 layers. When I try to export more than 2 layers, appears the following message:
Traceback (most recent call last):
File "C:/Users/Administrador/.qgis2/python/plugins\qgis2leaf\qgis2leafdialog.py", line 104, in export2leaf
qgis2leaf_exec(self.outFileName, self.basemapName, self.width, self.height, self.extent, self.full_screen, self.layer_list, self.visible)
File "C:/Users/Administrador/.qgis2/python/plugins\qgis2leaf\qgis2leaf_exec.py", line 289, in qgis2leaf_exec
print table
IOError: [Errno 9] Bad file descriptor
Python version:
2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]
QGIS version:
2.2.0-Valmiera Valmiera, c3a2817
Python path: ['C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins\processing', 'C:/PROGRA~1/QGISVA~1/apps/qgis/./python', u'C:/Users/Administrador/.qgis2/python', u'C:/Users/Administrador/.qgis2/python/plugins', 'C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins', 'C:\PROGRA~1\QGISVA~1\bin\python27.zip', 'C:\PROGRA~1\QGISVA~1\apps\Python27\DLLs', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\plat-win', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\lib-tk', 'C:\PROGRA~1\QGISVA~1\bin', 'C:\PROGRA~1\QGISVA~1\apps\Python27', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\win32', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win32.egg', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\PROGRA~1\QGISVA~1\apps\qgis\python\plugins\fTools\tools```
The files are on this url: http://www.sendspace.com/file/jbcode
when exporting the vector file they have a special styling in qgis. this styling should be imitated in leaflet
Firstly, thanks for creating this plugin. I'm a massive fan of both leaflet and QGIS so this is very welcome.
Can I just ask if you have though about adding some functionality to the plugin that checks the CRS of the data and makes sure its exporting as WGS84. I think this should be possible using the QGIS API.
This would beneficial to users that have all their data in a different CRS.
Thanks
Matt
I've exported some layers on my town, points and lines, the browser (firefox) freeze
Having default all layers active can be the cause of overloading browser visualization... ?
If yes: can we have an option to manage the ".addTo(map);" on every single layer.
With default: "only one overlay layer has to be added to map by default".
Testing it: disabling into generate index.html code the ".addTo(map);" default option on exported layers, made things go better...
so in my test i disabled the row n. 306 in qgis2leaf_exec.py
#f5.write("""exp_""" + re.sub('[\W_]+', '', i.name()) + """JSON.addTo(map);""")
and i can load a lot of layers without browser freeze... after i will activate by layer control button.
Thank
Would be nice if I could get layers then have the option to remove layers I don't want to include in the final output
the plugin meant to work under windows. especially writing a folder structure is os specific.
Environment: qgis 2.2
OS: windows 64bit and Windows 32bit!
if there are no raster layers for export, the webmap fails to load as the function creation misses a "{"
change line 802-803 to:
opacityStart = """
function updateOpacity(value) {
"""
Klas from http://geosupportsystem.wordpress.com/2014/04/29/skapa-leafletkarta-direkt-fran-qgis/ : If I make the effort to hide attributes and create aliases for better descriptions and nicer viewing experience in QGIS, it would be as nice if these changes also would follow on to Leaflet.
add a checkbox to show/hide an opacity control in the webmap
Data attribution is CC-BY-SA, but it has to be ODbL, since OSM changed its license.
It would be cool if there's an option to choose only an attribute which contains the popup text, for example:
Enhance the UI to let the user define width and height of the webmap. Nevertheless there should be a default value given.
git should only be used for managing code, not binaries. As the .pyc binaries are compiled from python source files, the are not needed anyway. So it is best practice to add them to the .gitignore file.
Klas from http://geosupportsystem.wordpress.com/2014/04/29/skapa-leafletkarta-direkt-fran-qgis/ would like to have an export of postgis and WFS layers. is this possible?! can anyone provide solution or testdata/test-wfs?
I found would be great to have a default output dir value set /showed into dialog window.
I suggest you to set it to the system temp dir...
Best regard and thank for your work
@marcobra asked this one. Unfortunately I need to iterate over the curre nt map window to get all activated layers. this is implemented in the current main program. but I haven't figured out how to iterate over the map canvas at GUI startup.
I see the help provides useful information for persons who used the plugin for the first time but the location takes a lot of space. How about adding a button where people can clic and a window with a help file opens?
Qgis projects and shape files can get extremely large. Leaflet is capable to use topojson which are damn small compared to geojson. Shall we implement a switch for geojson/topojson?
Hi,
if I use large shapefiles, the browser eats too much memory and makes system unusable.
Test them on (click on "SHP" text at the middle of page, after the description)
Street numbers - http://dati.trentino.it/dataset/comune-di-trento-numeri-civici
Street graph - http://dati.trentino.it/dataset/comune-di-trento-stradario
the plugin works under mac. as there are just few older mac os in use this could be done using the latest mac os and qgis 2.2 by kyngchaos: http://www.kyngchaos.com/software/qgis
most user do have some temporary layers in their workspace. I think about a list of layers in the GUI which holds the list of layers. The list is defaulted to export every vector layer. by unchecking some of them it enables the user to export just a part of the workspace.
there was a user who had issues in installing it under qgis 2.0. does it work?
Hi. I used Google Translate, Sorry. :).
On output project folder, I selected my desktop ... ALL INFORMATION IS DELETED. HUNDREDS OF GIGAS !!!!!!!!!!!!!!!!!
Ubuntu 14.04, Qgis 2.2 and python 2.7.6
Exporting polygon layer with different color in qgis are exported and filled with the unique same color
Please send me mail if you want test layers...
Thank you
the exported qgis layers have a given extend. the leaflet webmap should have this extend instead of showing the whole world.
At the moment we just serve three different basemap styles. We should add more basemap layers. I would stick with the list provided by https://github.com/leaflet-extras/leaflet-providers
someone should look through the code to make sure there is no junk in it as it was coded using some templates.
If the name of a datasource starts with numerals, these are passed unvalidated, but cause a javascript syntax error later ("SyntaxError: identifier starts immediately after numeric literal").
Generate an automatic map legend based on the active qgis layers.
Not on all export... but i get on a layer...
Traceback (most recent call last):
File "/home/ubuntu/.qgis2/python/plugins/qgis2leaf/qgis2leafdialog.py", line 107, in export2leaf
qgis2leaf_exec(self.outFileName, self.basemapName, self.width, self.height, self.extent, self.full_screen, self.layer_list, self.visible)
File "/home/ubuntu/.qgis2/python/plugins/qgis2leaf/qgis2leaf_exec.py", line 149, in qgis2leaf_exec
line = line.replace(""""type": "Feature", "properties": { """,""""type": "Feature", "properties": { "color_qgis2leaf": '""" + color_str + """', "radius_qgis2leaf": """ + radius_str + """, "transp_qgis2leaf": """ + transp_str + """, "transp_fill_qgis2leaf": """ + transp_str2 + """, """ )
UnboundLocalError: local variable 'radius_str' referenced before assignment
Versione Python:
2.7.3 (default, Feb 27 2014, 20:09:21)
[GCC 4.6.3]
Please consider to a GUI checkbox option to auto run/open the index page after export creation...
Tank you
Marco
Currently the generated map loads via http, sometimes it's needed to be loaded in https.
Other cdns which give the possibility: http://cdnjs.com/libraries/leaflet/
some people might have a zip output at the end only or additionally to the folder structure. might this be of interest for the plugin?!
test test test
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.