├── .gitignore ├── README.md ├── qgis1.8 ├── projects │ └── Natural_Earth_quick_start_for_QGIS_1.7.qgs ├── styles │ ├── README.md │ ├── clc_2006_SLC_de.sld │ ├── corine_nice_de.qml │ ├── corine_nice_pl.qml │ ├── corine_nice_pl.sld │ ├── nvc_phase_1.qml │ ├── ogdwien_realnut_level2.qml │ ├── osm2pgsql_google_line_map.qml │ ├── osm2pgsql_google_line_satellite.qml │ ├── osm2pgsql_google_polygon_map.qml │ ├── osm2po_google.qml │ ├── osm2po_light.qml │ ├── osm_light_line.qml │ ├── osm_light_polygon.qml │ └── v_osm_roads_google.qml └── symbols │ ├── colorbrewer_polygon_diverging_7classes.xml │ ├── colorbrewer_polygon_sequential_5classes.xml │ ├── colorbrewer_symbols.xml │ ├── osm_symbols.xml │ └── rainbows.xml ├── qgis2 ├── gip_styles │ └── class_oneway.qml ├── osm_spatialite │ ├── README.md │ ├── osm_spatialite_googlemaps_lines.qml │ ├── osm_spatialite_googlemaps_multipolygon.qml │ ├── osm_spatialite_googlemaps_places.qml │ ├── osm_spatialite_googlemaps_roadshields.qml │ ├── osm_spatialite_tonerlite_lines.qml │ ├── osm_spatialite_tonerlite_multipolygon.qml │ └── osm_spatialite_tonerlite_point.qml └── scripts │ ├── LICENSE │ ├── game_of_life │ ├── conways_game_of_life.py │ ├── conways_game_of_life.qml │ ├── gosper_glidergun.csv │ └── gosper_glidergun.csvt │ ├── ogd │ ├── Routingexport_Wien_OGD.licence.txt │ ├── Routingexport_Wien_OGD.txt │ ├── idf_router.py │ └── read_idf.py │ └── osm │ ├── route_turns.py │ └── visually_check_turns.py ├── qgis3 └── notebooks │ ├── basemaps.ipynb │ ├── data │ ├── geolife_small.gpkg │ ├── test.geojson │ └── traj.geojson │ ├── hello-world.ipynb │ ├── layer-styling.ipynb │ ├── mapping.ipynb │ └── neo4j.ipynb └── svg └── pastel.svg /.gitignore: -------------------------------------------------------------------------------- 1 | qgis2/scripts/ogd/Routingexport_Klagenfurt_OGD.txt 2 | qgis3/notebooks/symbology-style.db 3 | qgis3/notebooks/data/vertices.geojson 4 | qgis3/notebooks/my-map.pgw 5 | qgis3/notebooks/my-map.png 6 | qgis3/notebooks/my-traj.pgw 7 | qgis3/notebooks/my-traj.png 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # QGIS Resources 2 | 3 | This repository is home to QGIS resources featured on my blog [anitagraser.com](http://anitagraser.com), including symbols, styles, and scripts. 4 | -------------------------------------------------------------------------------- /qgis1.8/styles/README.md: -------------------------------------------------------------------------------- 1 | # QGIS Styles 2 | 3 | This is a collection of QGIS .qml and .sld styles. SLD is supported by QGIS >= 1.8 4 | 5 | ## Contents 6 | 7 | * clc_2006_SLC_de.sld - Corine Land Cover - official colors (German labels) 8 | * corine_nice_de.qml - Corine Land Cover - nice colors (German) 9 | * corine_nice_pl.qml - Corine Land Cover - nice colors (Polish) 10 | * corine_nice_pl.sld - Corine Land Cover - nice colors (Polish) 11 | * nvc_phase_1.qml - National Vegetation Classification 12 | * ogdwien_realnut_level2 - OGDWien Realnutzung Level 2 13 | * osm_light_line.qml - OpenStreetMap light line style, mostly road classes 14 | * osm_light_polygon.qml - OpenStreetMap light polygon styles, mostly water, forest and buildings 15 | * osm2po_google.qml - Road style inspired by Google Maps for OpenStreetMap data loaded into PostGIS using osm2po tool 16 | * osm2pgsql_google_line_map.qml - Roadway line style inspired by Google Maps Map View for OpenStreetMap data loaded into PostGIS using osm2pgsql tool 17 | * osm2pgsql_google_polygon_map.qml - Roadway polygon style inspired by Google Maps Map View for OpenStreetMap data loaded into PostGIS using osm2pgsql tool 18 | * osm2pgsql_google_line_satellite.qml - Roadway line style inspired by Google Maps Satellite View for OpenStreetMap data loaded into PostGIS using osm2pgsql tool 19 | * osm2po_light.qml - Light road style for OpenStreetMap data loaded into PostGIS using osm2po tool 20 | * v_osm_roads_google.qml - Roadstyle for OpenStreetMap roads shapfiles loaded into PostGIS with advanced data-defined labeling rules 21 | -------------------------------------------------------------------------------- /qgis1.8/styles/clc_2006_SLC_de.sld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anitagraser/QGIS-resources/14c846b4f144e1327ad5c9bc68575327ed1000e6/qgis1.8/styles/clc_2006_SLC_de.sld -------------------------------------------------------------------------------- /qgis1.8/styles/ogdwien_realnut_level2.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 255 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | ogc_fid 238 | 239 | 240 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | -------------------------------------------------------------------------------- /qgis1.8/styles/osm2pgsql_google_line_satellite.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 255 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | name 226 | 227 | name 228 | 229 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | . 311 | 312 | . 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | Pie 321 | 0 322 | 323 | 0 324 | 325 | 326 | -------------------------------------------------------------------------------- /qgis1.8/styles/osm2pgsql_google_polygon_map.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 255 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | name 147 | 148 | name 149 | 150 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | . 232 | 233 | . 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | Pie 242 | 0 243 | 244 | 0 245 | 246 | 247 | -------------------------------------------------------------------------------- /qgis1.8/styles/osm2po_google.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 255 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | osm_name 237 | 238 | 239 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | Pie 288 | 0 289 | 290 | 0 291 | 292 | 293 | -------------------------------------------------------------------------------- /qgis1.8/styles/osm2po_light.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 255 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | osm_name 246 | 247 | 248 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | . 287 | 288 | . 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | Pie 297 | 0 298 | 299 | 0 300 | 301 | 302 | -------------------------------------------------------------------------------- /qgis1.8/styles/osm_light_line.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 255 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | name 269 | 270 | 271 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | . 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | Pie 332 | 0 333 | 334 | 0 335 | 336 | 337 | -------------------------------------------------------------------------------- /qgis1.8/styles/osm_light_polygon.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 255 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | name 84 | 85 | 86 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | . 137 | 138 | . 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | Pie 147 | 0 148 | 149 | 0 150 | 151 | 152 | -------------------------------------------------------------------------------- /qgis1.8/styles/v_osm_roads_google.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 255 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | name 225 | 226 | 227 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | Pie 294 | 0 295 | 296 | 0 297 | 298 | 299 | -------------------------------------------------------------------------------- /qgis1.8/symbols/colorbrewer_symbols.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /qgis1.8/symbols/osm_symbols.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /qgis1.8/symbols/rainbows.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /qgis2/osm_spatialite/README.md: -------------------------------------------------------------------------------- 1 | Styles for SpatiaLite databases 2 | =============================== 3 | These styles can be applied to layers from SpatiaLite databases which were create from OSM using ogr2ogr. 4 | For more details check http://anitagraser.com/2014/05/31/a-guide-to-googlemaps-like-maps-with-osm-in-qgis/ 5 | 6 | 7 | Google Maps Style 8 | ----------------- 9 | ![alt tag](https://underdark.files.wordpress.com/2014/05/qgis_osm_google_100k.png) 10 | ![alt tag](https://farm4.staticflickr.com/3897/14576977464_bae47b3edd_o_d.png) 11 | 12 | Stamen Toner Lite Style 13 | ----------------------- 14 | ![alt tag](https://farm4.staticflickr.com/3870/14606719083_f6925de916_o_d.png) 15 | -------------------------------------------------------------------------------- /qgis2/osm_spatialite/osm_spatialite_googlemaps_places.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 0 199 | 0 200 | 100 201 | name 202 | 203 | 204 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 0 240 | ../../../../OSGEO4~1/bin 241 | generatedlayout 242 | 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /qgis2/osm_spatialite/osm_spatialite_googlemaps_roadshields.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 0 170 | 0 171 | 100 172 | name 173 | 174 | 175 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | . 207 | 208 | 0 209 | . 210 | generatedlayout 211 | 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /qgis2/osm_spatialite/osm_spatialite_tonerlite_multipolygon.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 0 187 | 0 188 | 0 189 | name 190 | 191 | 192 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | . 241 | 242 | 0 243 | ../../../../OSGeo4W64/bin 244 | generatedlayout 245 | 246 | 247 | 248 | 249 | -------------------------------------------------------------------------------- /qgis2/osm_spatialite/osm_spatialite_tonerlite_point.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 0 245 | 0 246 | 0 247 | name 248 | 249 | 250 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | . 284 | 285 | 0 286 | . 287 | generatedlayout 288 | 289 | 290 | 291 | 292 | -------------------------------------------------------------------------------- /qgis2/scripts/game_of_life/conways_game_of_life.py: -------------------------------------------------------------------------------- 1 | import processing 2 | import time 3 | from PyQt4.QtCore import * 4 | 5 | class GameOfLife(QObject): 6 | 7 | def __init__(self,steps,alive_field): 8 | QObject.__init__(self) 9 | #self.input = "C:/Users/anita_000/Dropbox/QgisSandbox/grid15.shp" 10 | self.input = "C:/Users/anita_000/Dropbox/QgisSandbox/gosper_glidergun.csv" 11 | self.input_layer = processing.load(self.input) 12 | self.input_layer.loadNamedStyle("C:/Users/anita_000/Dropbox/QgisSandbox/conways_game_of_life.qml") 13 | self.alive_field = alive_field 14 | self.index = QgsSpatialIndex() 15 | self._state = 0 16 | self.anim = QPropertyAnimation(self, "state") 17 | self.anim.setStartValue(0) 18 | self.anim.setEndValue(steps) 19 | self.anim.setDuration(5000) 20 | self.anim.valueChanged.connect(self.computeNextStep) 21 | 22 | @pyqtProperty(int) 23 | def state(self): 24 | return self._state 25 | 26 | @state.setter 27 | def state(self, value): 28 | self._state = value 29 | 30 | def countLivingNeighbors(self,cell): 31 | cell_geom = cell.geometry() 32 | living_neighbors = 0 33 | nearest = self.index.nearestNeighbor(cell.geometry().centroid().asPoint(),8) 34 | #for id in nearest: 35 | req = QgsFeatureRequest().setFilterFids(nearest) 36 | f = self.input_layer.getFeatures(request=req) 37 | for feature in f: 38 | if cell_geom.touches(feature.geometry()): 39 | living_neighbors += feature[self.alive_field] 40 | return living_neighbors 41 | 42 | def getNewState(self,cell_state,living_neighbors): 43 | new_state = 0 44 | if cell_state and living_neighbors < 2: 45 | pass 46 | elif cell_state and living_neighbors < 4: 47 | new_state = 1 48 | elif cell_state: 49 | pass 50 | elif living_neighbors == 3: 51 | new_state = 1 52 | else: 53 | pass 54 | return new_state 55 | 56 | def computeNextStep(self,alive_field='alive'): 57 | self.anim.pause() 58 | print self.anim.currentValue() 59 | i = self.anim.currentValue() 60 | l = QgsVectorLayer("Polygon?crs=epsg:4326&field=%s:integer" %(self.alive_field), "step%d" %(i), "memory") 61 | if not l.isValid(): 62 | raise Exception("Failed to create memory layer") 63 | mem_layer_provider = l.dataProvider() 64 | 65 | self.index = QgsSpatialIndex() 66 | for cell in self.input_layer.getFeatures(): 67 | self.index.insertFeature(cell) 68 | 69 | for cell in self.input_layer.getFeatures(): 70 | cell_state = cell[self.alive_field] 71 | living_neighbors = self.countLivingNeighbors(cell) 72 | new_state = self.getNewState(cell_state,living_neighbors) 73 | output_feature = QgsFeature() 74 | output_feature.setGeometry(cell.geometry()) 75 | attrs = [new_state] 76 | output_feature.setAttributes(attrs) 77 | mem_layer_provider.addFeatures([output_feature]) 78 | 79 | QgsMapLayerRegistry.instance().addMapLayer(l) 80 | l.loadNamedStyle("C:/Users/anita_000/Dropbox/QgisSandbox/conways_game_of_life.qml") 81 | self.input_layer = l 82 | #iface.mapCanvas().refresh() 83 | self.anim.resume() 84 | 85 | def run(self): 86 | self.anim.start() 87 | 88 | global g 89 | g = GameOfLife(100,'alive') 90 | g.run() -------------------------------------------------------------------------------- /qgis2/scripts/game_of_life/conways_game_of_life.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 0 209 | 0 210 | 0 211 | ID 212 | 213 | 214 | 233 | 234 | 235 | 0 236 | 237 | generatedlayout 238 | 239 | 240 | 241 | 242 | -------------------------------------------------------------------------------- /qgis2/scripts/game_of_life/gosper_glidergun.csvt: -------------------------------------------------------------------------------- 1 | String,Real(24.16),Real(24.16),Real(24.16),Real(24.16),Integer(1) 2 | -------------------------------------------------------------------------------- /qgis2/scripts/ogd/Routingexport_Wien_OGD.licence.txt: -------------------------------------------------------------------------------- 1 | Routing graph 2 | 3 | Source: https://www.data.gv.at/katalog/dataset/intermodales-verkehrsreferenzsystem-osterreich-gip-at-beta/resource/0775cf69-7119-43ec-af09-9da1016a4b94 4 | 5 | License: 6 | CC BY 3.0 AT, published by Geoland.at 7 | -------------------------------------------------------------------------------- /qgis2/scripts/ogd/Routingexport_Wien_OGD.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anitagraser/QGIS-resources/14c846b4f144e1327ad5c9bc68575327ed1000e6/qgis2/scripts/ogd/Routingexport_Wien_OGD.txt -------------------------------------------------------------------------------- /qgis2/scripts/ogd/read_idf.py: -------------------------------------------------------------------------------- 1 | from PyQt4.QtCore import * 2 | 3 | def read_idf(idf_file): 4 | status = "" 5 | nodes = {} 6 | links = {} 7 | node_features = [] 8 | link_features = [] 9 | 10 | counter = 0 11 | 12 | with open(idf_file) as f: 13 | 14 | for line in f: 15 | 16 | if counter % 100000 == 0: 17 | print "." 18 | counter +=1 19 | 20 | line = line.strip().split(';') 21 | if line[0] == "tbl": 22 | status = line[1] 23 | print status 24 | 25 | """ NODE """ 26 | 27 | if status == "Node" and line[0] == "atr": 28 | attribute_names = line[1:] 29 | if status == "Node" and line[0] == "frm": 30 | node_layer = QgsVectorLayer( 31 | "Point?crs=epsg:4326&index=yes", 32 | "nodes", 33 | "memory") 34 | node_pr = node_layer.dataProvider() 35 | for frm in line [1:]: 36 | atr = attribute_names.pop(0) 37 | frm = frm.split("(")[0] 38 | if frm == "decimal": 39 | field = QgsField(atr,QVariant.Double) 40 | elif frm == "string": 41 | field = QgsField(atr,QVariant.String) 42 | node_pr.addAttributes([field]) 43 | node_layer.updateFields() 44 | if status == "Node" and line[0] == "rec": 45 | id = int(line[1]) 46 | x = float(line[4]) 47 | y = float(line[5]) 48 | # add a feature 49 | fet = QgsFeature() 50 | nodes[id] = QgsPoint(x,y) 51 | fet.setGeometry(QgsGeometry.fromPoint(QgsPoint(x,y))) 52 | fet.setAttributes(line[1:]) 53 | node_features.append(fet) 54 | 55 | 56 | """ LINK """ 57 | 58 | if status == "Link" and line[0] == "atr": 59 | node_pr.addFeatures(node_features) 60 | node_features = [] 61 | attribute_names = line[1:] 62 | if status == "Link" and line[0] == "frm": 63 | link_layer = QgsVectorLayer( 64 | "LineString?crs=epsg:4326&index=yes", 65 | "links", 66 | "memory") 67 | link_pr = link_layer.dataProvider() 68 | for frm in line [1:]: 69 | atr = attribute_names.pop(0) 70 | frm = frm.split("(")[0] 71 | if frm == "decimal": 72 | field = QgsField(atr,QVariant.Double) 73 | elif frm == "string": 74 | field = QgsField(atr,QVariant.String) 75 | link_pr.addAttributes([field]) 76 | link_layer.updateFields() 77 | if status == "Link" and line[0] == "rec": 78 | id = int(line[1]) 79 | from_node = nodes[int(line[4])] 80 | to_node = nodes[int(line[5])] 81 | links[id] = (line[1:], [from_node,to_node]) 82 | 83 | """ LINK COORDINATE """ 84 | if status == "LinkCoordinate" and line[0] == "rec": 85 | id = int(line[1]) 86 | #count = int(line[2]) 87 | x = float(line[3]) 88 | y = float(line[4]) 89 | links[id][1].insert(-1,QgsPoint(x,y)) 90 | 91 | """ LINK USE""" 92 | if status == "LinkUse": 93 | """ not implemented yet """ 94 | 95 | """ prepare the links and return the layers """ 96 | for id,[attrs,line] in links.iteritems(): 97 | fet = QgsFeature() 98 | fet.setGeometry(QgsGeometry.fromPolyline(line)) 99 | fet.setAttributes(attrs) 100 | link_features.append(fet) 101 | 102 | link_pr.addFeatures(link_features) 103 | link_features = [] 104 | 105 | return [node_layer, link_layer] 106 | 107 | 108 | idf_file = "D:\Documents\QGIS\scripts\Routingexport_Wien_OGD.txt" 109 | 110 | layers = read_idf(idf_file) 111 | 112 | for layer in layers: 113 | layer.updateExtents() 114 | QgsMapLayerRegistry.instance().addMapLayer(layer) 115 | 116 | -------------------------------------------------------------------------------- /qgis2/scripts/osm/route_turns.py: -------------------------------------------------------------------------------- 1 | from PyQt4.QtCore import * 2 | from xml.etree import ElementTree 3 | import urllib2, os, qgis.utils, os.path, resources_rc, time 4 | 5 | def requestRoute(start_point,stop_point): 6 | travel_type = 'Car' 7 | mode = 'Shortest' 8 | 9 | text = ''' 10 | 11 | 12 | 13 | 14 | 15 | 16 | ''' 17 | text+=travel_type 18 | text+=''' 19 | 20 | ''' 21 | text+=mode 22 | text+=''' 23 | 24 | 25 | 26 | 27 | 28 | ''' 29 | text+=start_point 30 | text+=''' 31 | 32 | 33 | ''' 34 | 35 | text+=''' 36 | 37 | 38 | ''' 39 | text+=stop_point 40 | text+=''' 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | ''' 54 | url="http://openls.geog.uni-heidelberg.de/testing2015/routing?apikey=e2017639f5e987e6dc1f5f69a66d049c" 55 | req = urllib2.Request(url=url, data=text, headers={'Content-Type': 'application/xml'}) 56 | response_route=urllib2.urlopen(req).read() 57 | newstr = response_route.replace("\n", "") 58 | response_route = newstr.replace(" ", "") 59 | 60 | #print response_route 61 | 62 | if response_route != "": 63 | xml_route = ElementTree.fromstring(response_route) 64 | 65 | fet = QgsFeature() 66 | seg=[] 67 | for i in range(0,len(xml_route[1][0][1][0])): 68 | seg.append(QgsPoint(float(str.split(xml_route[1][0][1][0][i].text)[0]),float(str.split(xml_route[1][0][1][0][i].text)[1]))) 69 | print seg 70 | fet.setGeometry(QgsGeometry.fromPolyline(seg)) 71 | fet.setAttributes(["route provided by openrouteservice.org", float(xml_route[1][0][0][1].attrib['value']), xml_route[1][0][0][0].text]) 72 | return fet 73 | else: 74 | return None 75 | 76 | input_layer = iface.activeLayer() 77 | features = input_layer.getFeatures() 78 | 79 | layer = QgsVectorLayer('LineString?crs=EPSG:4326', 'route_OSM', "memory") 80 | pr = layer.dataProvider() 81 | pr.addAttributes([QgsField("TURN_ID", QVariant.String)]) 82 | pr.addAttributes([QgsField("distance", QVariant.Double)]) 83 | pr.addAttributes([QgsField("time", QVariant.String)]) 84 | layer.updateFields() 85 | 86 | fet=[] 87 | 88 | for id,feature in enumerate(features): 89 | print id 90 | #print feature.geometry().asPolyline() 91 | start_point = feature.geometry().asPolyline()[0] 92 | stop_point = feature.geometry().asPolyline()[-1] 93 | start_point = '%f %f' % (start_point.x(),start_point.y()) 94 | stop_point = '%f %f' % (stop_point.x(),stop_point.y()) 95 | print "Requesting route from %s to %s ..." % (start_point,stop_point) 96 | f = requestRoute(start_point,stop_point) 97 | if f: 98 | f.setAttribute(0,feature["TURN_ID"]) 99 | fet.append(f) 100 | 101 | 102 | 103 | pr.addFeatures(fet) 104 | 105 | layer.updateExtents() #update it 106 | QgsMapLayerRegistry.instance().addMapLayer(layer) 107 | -------------------------------------------------------------------------------- /qgis2/scripts/osm/visually_check_turns.py: -------------------------------------------------------------------------------- 1 | def next(): 2 | f = features.next() 3 | id = f['TURN_ID'] 4 | print "Going to %s" % (id) 5 | QgsExpressionContextUtils.setProjectVariable('myvar',id) 6 | iface.mapCanvas().zoomToFeatureExtent(f.geometry().boundingBox()) 7 | if iface.mapCanvas().scale() < 500: 8 | iface.mapCanvas().zoomScale(500) 9 | 10 | layer = iface.activeLayer() 11 | features = layer.getFeatures() 12 | next() -------------------------------------------------------------------------------- /qgis3/notebooks/data/geolife_small.gpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anitagraser/QGIS-resources/14c846b4f144e1327ad5c9bc68575327ed1000e6/qgis3/notebooks/data/geolife_small.gpkg -------------------------------------------------------------------------------- /qgis3/notebooks/data/test.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "name": "test", 4 | "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, 5 | "features": [ 6 | { "type": "Feature", "properties": { "id": "a" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -6.339578454332562, -5.365339578454333 ], [ -6.339578454332562, 2.69086651053864 ], [ 1.866510538641679, 2.69086651053864 ], [ 1.866510538641679, -5.365339578454333 ], [ -6.339578454332562, -5.365339578454333 ] ] ] } } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /qgis3/notebooks/data/traj.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "features": [ 4 | { "type": "Feature", "properties": { "speed": 1.0, "t": "2018-01-01T12:00:06", "prev_t": "2018-01-01T12:00:00" }, "geometry": { "type": "LineString", "coordinates": [ [ 0.0, 0.0 ], [ 6.0, 0.0 ] ] } }, 5 | { "type": "Feature", "properties": { "speed": 1.5, "t": "2018-01-01T12:00:10", "prev_t": "2018-01-01T12:00:06" }, "geometry": { "type": "LineString", "coordinates": [ [ 6.0, 0.0 ], [ 6.0, 6.0 ] ] } }, 6 | { "type": "Feature", "properties": { "speed": 3.0, "t": "2018-01-01T12:00:15", "prev_t": "2018-01-01T12:00:10" }, "geometry": { "type": "LineString", "coordinates": [ [ 6.0, 6.0 ], [ 9.0, 9.0 ] ] } } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /qgis3/notebooks/mapping.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from PyQt5.QtWidgets import QApplication\n", 10 | "from qgis.core import QgsApplication, QgsVectorLayer, QgsProject\n", 11 | "from qgis.gui import QgsMapCanvas" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 2, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "app = QApplication([])\n", 21 | "qgs = QgsApplication([], False)" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": 3, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "canvas = QgsMapCanvas()\n", 31 | "project = QgsProject.instance()" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": 4, 37 | "metadata": {}, 38 | "outputs": [], 39 | "source": [ 40 | "vlayer = QgsVectorLayer(\"./data/test.geojson\", \"My layer\")\n", 41 | "if not vlayer.isValid():\n", 42 | " print(\"Layer failed to load!\")" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 5, 48 | "metadata": {}, 49 | "outputs": [ 50 | { 51 | "data": { 52 | "text/plain": [ 53 | "{'My_layer_7ffb7290_4bdd_4c5f_8e4c_8bc748faff6d': }" 54 | ] 55 | }, 56 | "execution_count": 5, 57 | "metadata": {}, 58 | "output_type": "execute_result" 59 | } 60 | ], 61 | "source": [ 62 | "project.addMapLayer(vlayer)\n", 63 | "project.mapLayers()" 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": 6, 69 | "metadata": {}, 70 | "outputs": [], 71 | "source": [ 72 | "canvas.setExtent(vlayer.extent())\n", 73 | "canvas.setLayers([vlayer])" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": 9, 79 | "metadata": {}, 80 | "outputs": [ 81 | { 82 | "data": { 83 | "text/plain": [ 84 | "0" 85 | ] 86 | }, 87 | "execution_count": 9, 88 | "metadata": {}, 89 | "output_type": "execute_result" 90 | } 91 | ], 92 | "source": [ 93 | "canvas.show()\n", 94 | "app.exec_()" 95 | ] 96 | }, 97 | { 98 | "cell_type": "code", 99 | "execution_count": 8, 100 | "metadata": {}, 101 | "outputs": [ 102 | { 103 | "data": { 104 | "image/png": "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", 105 | "text/plain": [ 106 | "" 107 | ] 108 | }, 109 | "execution_count": 8, 110 | "metadata": {}, 111 | "output_type": "execute_result" 112 | } 113 | ], 114 | "source": [ 115 | "from IPython.display import Image\n", 116 | "\n", 117 | "def saveImage(path, show=True): \n", 118 | " canvas.saveAsImage(path)\n", 119 | " if show: return Image(path)\n", 120 | "\n", 121 | "saveImage(\"my-map.png\")" 122 | ] 123 | }, 124 | { 125 | "cell_type": "code", 126 | "execution_count": null, 127 | "metadata": {}, 128 | "outputs": [], 129 | "source": [] 130 | } 131 | ], 132 | "metadata": { 133 | "kernelspec": { 134 | "display_name": "qgis", 135 | "language": "python", 136 | "name": "python3" 137 | }, 138 | "language_info": { 139 | "codemirror_mode": { 140 | "name": "ipython", 141 | "version": 3 142 | }, 143 | "file_extension": ".py", 144 | "mimetype": "text/x-python", 145 | "name": "python", 146 | "nbconvert_exporter": "python", 147 | "pygments_lexer": "ipython3", 148 | "version": "3.9.15" 149 | }, 150 | "orig_nbformat": 4, 151 | "vscode": { 152 | "interpreter": { 153 | "hash": "7f7e04976b05f00de8e9b2faf1971fe6c0ccb79b820f40e57c1c24b6d3a6758d" 154 | } 155 | } 156 | }, 157 | "nbformat": 4, 158 | "nbformat_minor": 2 159 | } 160 | -------------------------------------------------------------------------------- /qgis3/notebooks/neo4j.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from neo4j import GraphDatabase\n", 10 | "\n", 11 | "URI = \"neo4j://localhost\"\n", 12 | "AUTH = (\"neo4j\", \"password\")\n", 13 | "\n", 14 | "with GraphDatabase.driver(URI, auth=AUTH) as driver:\n", 15 | " driver.verify_connectivity()" 16 | ] 17 | }, 18 | { 19 | "cell_type": "code", 20 | "execution_count": null, 21 | "metadata": {}, 22 | "outputs": [], 23 | "source": [ 24 | "QUERY = \"MATCH (p:Stop) RETURN p.name AS name, p.location AS geom\"\n", 25 | "\n", 26 | "records, summary, keys = driver.execute_query(\n", 27 | " QUERY, database_=\"neo4j\",\n", 28 | ")\n", 29 | "\n", 30 | "for rec in records:\n", 31 | " print(rec)" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": null, 37 | "metadata": {}, 38 | "outputs": [], 39 | "source": [ 40 | "import geopandas as gpd\n", 41 | "from datetime import datetime\n", 42 | "\n", 43 | "with driver.session(database=\"neo4j\") as session:\n", 44 | " tx = session.begin_transaction()\n", 45 | " results = tx.run(QUERY)\n", 46 | " df = results.to_df(expand=True)\n", 47 | " df = df[df[\"geom[].0\"]>0]\n", 48 | " gdf = gpd.GeoDataFrame(\n", 49 | " df[['name']], crs=4326,\n", 50 | " geometry=gpd.points_from_xy(df['geom[].0'], df['geom[].1']))\n", 51 | " print(gdf)\n", 52 | "\n", 53 | "tx.close() " 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": null, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [ 62 | "gdf.explore()" 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": null, 68 | "metadata": {}, 69 | "outputs": [], 70 | "source": [ 71 | "QUERY = \"\"\"MATCH (\n", 72 | " t:Trip {id: \"17\"})\n", 73 | " <-[:BELONGS_TO]-\n", 74 | " (st:StopTime)\n", 75 | " -[:STOPS_AT]->\n", 76 | " (s:Stop)\n", 77 | "RETURN st ,s\n", 78 | "ORDER BY st.stopSequence\n", 79 | "\"\"\"\n", 80 | "\n", 81 | "records, summary, keys = driver.execute_query(\n", 82 | " QUERY, database_=\"neo4j\",\n", 83 | ")\n", 84 | "\n", 85 | "for rec in records:\n", 86 | " print(rec)" 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": null, 92 | "metadata": {}, 93 | "outputs": [], 94 | "source": [ 95 | "from shapely.geometry import Point\n", 96 | "\n", 97 | "QUERY = \"\"\"MATCH (\n", 98 | " t:Trip {id: \"17\"})\n", 99 | " <-[:BELONGS_TO]-\n", 100 | " (st:StopTime)\n", 101 | " -[:STOPS_AT]->\n", 102 | " (s:Stop)\n", 103 | "RETURN st ,s\n", 104 | "ORDER BY st.stopSequence\n", 105 | "\"\"\"\n", 106 | "\n", 107 | "with driver.session(database=\"neo4j\") as session:\n", 108 | " tx = session.begin_transaction()\n", 109 | " results = tx.run(QUERY)\n", 110 | " df = results.to_df(expand=True)\n", 111 | " gdf = gpd.GeoDataFrame(\n", 112 | " df[['s().prop.name']], crs=4326,\n", 113 | " geometry=df[\"s().prop.location\"].apply(Point)\n", 114 | " )\n", 115 | "\n", 116 | "tx.close() \n", 117 | "m = gdf.explore()\n", 118 | "m" 119 | ] 120 | }, 121 | { 122 | "cell_type": "code", 123 | "execution_count": null, 124 | "metadata": {}, 125 | "outputs": [], 126 | "source": [ 127 | "QUERY = \"\"\"\n", 128 | "MATCH (t:Trip {id: \"17\"})\n", 129 | " <-[:BELONGS_TO]-\n", 130 | " (st1:StopTime)\n", 131 | " -[:NEXT_STOP]->\n", 132 | " (st2:StopTime)\n", 133 | "MATCH (st1)-[:STOPS_AT]->(s1:Stop)\n", 134 | "MATCH (st2)-[:STOPS_AT]->(s2:Stop)\n", 135 | "RETURN st1, st2, s1, s2\n", 136 | "\"\"\"\n", 137 | "\n", 138 | "from shapely.geometry import Point, LineString\n", 139 | "\n", 140 | "def make_line(row):\n", 141 | " s1 = Point(row[\"s1().prop.location\"])\n", 142 | " s2 = Point(row[\"s2().prop.location\"])\n", 143 | " return LineString([s1,s2])\n", 144 | "\n", 145 | "with driver.session(database=\"neo4j\") as session:\n", 146 | " tx = session.begin_transaction()\n", 147 | " results = tx.run(QUERY)\n", 148 | " df = results.to_df(expand=True)\n", 149 | " gdf = gpd.GeoDataFrame(\n", 150 | " df[['s1().prop.name']], crs=4326,\n", 151 | " geometry=df.apply(make_line, axis=1)\n", 152 | " )\n", 153 | "\n", 154 | "tx.close() \n", 155 | "gdf.explore(m=m)" 156 | ] 157 | }, 158 | { 159 | "cell_type": "code", 160 | "execution_count": null, 161 | "metadata": {}, 162 | "outputs": [], 163 | "source": [ 164 | "QUERY = \"\"\"\n", 165 | "MATCH (t:Trip {id: \"17\"})\n", 166 | " <-[:BELONGS_TO]-\n", 167 | " (st1:StopTime)\n", 168 | " -[:NEXT_STOP]->\n", 169 | " (st2:StopTime)\n", 170 | "MATCH (st1)-[:STOPS_AT]->(s1:Stop)\n", 171 | "MATCH (st2)-[:STOPS_AT]->(s2:Stop)\n", 172 | "RETURN st1.departureTime AS time1, \n", 173 | " st2.arrivalTime AS time2, \n", 174 | " s1.location AS geom1, \n", 175 | " s2.location AS geom2, \n", 176 | " duration.inSeconds(\n", 177 | " time(st1.departureTime), \n", 178 | " time(st2.arrivalTime)\n", 179 | " ).seconds AS traveltime\n", 180 | "\"\"\"\n", 181 | "\n", 182 | "import pandas as pd \n", 183 | "from shapely.geometry import Point, LineString\n", 184 | "\n", 185 | "def make_line(row):\n", 186 | " s1 = Point(row[\"geom1\"])\n", 187 | " s2 = Point(row[\"geom2\"])\n", 188 | " return LineString([s1,s2])\n", 189 | "\n", 190 | "with driver.session(database=\"neo4j\") as session:\n", 191 | " tx = session.begin_transaction()\n", 192 | " results = tx.run(QUERY)\n", 193 | " df = results.to_df()\n", 194 | " gdf = gpd.GeoDataFrame(\n", 195 | " df[['time1', 'time2', 'traveltime']], crs=4326,\n", 196 | " geometry=df.apply(make_line, axis=1)\n", 197 | " )\n", 198 | " #gdf['seconds'] = (\n", 199 | " # pd.to_datetime(gdf.time2, format=\"%H:%M:%S\") - \n", 200 | " # pd.to_datetime(gdf.time1, format=\"%H:%M:%S\")\n", 201 | " # ).dt.total_seconds()\n", 202 | "\n", 203 | "tx.close() \n", 204 | "gdf.explore(m=m)" 205 | ] 206 | }, 207 | { 208 | "cell_type": "code", 209 | "execution_count": null, 210 | "metadata": {}, 211 | "outputs": [], 212 | "source": [] 213 | } 214 | ], 215 | "metadata": { 216 | "kernelspec": { 217 | "display_name": "neo4j", 218 | "language": "python", 219 | "name": "python3" 220 | }, 221 | "language_info": { 222 | "codemirror_mode": { 223 | "name": "ipython", 224 | "version": 3 225 | }, 226 | "file_extension": ".py", 227 | "mimetype": "text/x-python", 228 | "name": "python", 229 | "nbconvert_exporter": "python", 230 | "pygments_lexer": "ipython3", 231 | "version": "3.9.18" 232 | } 233 | }, 234 | "nbformat": 4, 235 | "nbformat_minor": 2 236 | } 237 | --------------------------------------------------------------------------------