Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import json
import os
import requests
dir_path = os.path.dirname(os.path.realpath(__file__))
r_roads = requests.get('https://omnesviae.org/roads.php')
r_all = requests.get('https://omnesviae.org/all.php')

Debug https://gis.stackexchange.com/questions/405081/wkb-structure-does-not-match-expected-size?noredirect=1#comment662385_405081

The original_string provided is at https://jsfiddle.net/ovr1798k/1/

Then, the query that you can run to see a working geometry

SELECT ST_AsText(ST_GeomFromWKB(E'\\x0103000020E610000001000000700700007AA86DC3280E56C089CDC7B5A1B441402E90A0F8310E56C0BF0E9C33A2B44140F9B9A1293B0E56C05E9ECE15A5B44140B648DA8D3E0E56C0DBBFB2D2A4B44140027E8D24410E56C0FA0CA837A3B441407DE9EDCF450E56C0A391CF2B9EB441406A300DC3470E56C0A94E07B29EB4414086ADD9CA4B0E56C01E17D522A2B441403DB324404D0E56C09B38B9DFA1B4414090BFB4A84F0E56C0B0A71DFE9AB441407172BF43510E56C0BEBD6BD097B44140F2E84658540E56C065A6B4FE96B441408CA19C68570E56C0E02BBAF59AB44140B4006DAB590E56C048DE3994A1B44140A1478C9E5B0E56C04F20EC14ABB44140E8F351465C0E56C0B7D26BB3B1B44140DD79E2395B0E56C0F64201DBC1B4414065187783680E56C06682E15CC3B44140287E8CB96B0E56C0F1272A1BD6B44140B741EDB7760E56C0FC8A355CE4B44140DF6C73637A0E56C007EE409DF2B441406C5D6A847E0E
var reproject=function(e,r){"use strict";var t=r.hasOwnProperty("default")?r.default:r;function n(e,r){return(t=e).length>=2&&"number"==typeof t[0]&&"number"==typeof t[1]?r(e):e.map((function(e){return n(e,r)}));var t}function o(e,r,t){if(null==t)return t;var n=function(e){if(null==e||"object"!=typeof e)return e;var r=e.constructor();for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r}(t),i=o.bind(this,e,r);switch(t.type){case"Feature":n.geometry=i(t.geometry);break;case"FeatureCollection":n.features=n.features.map(i);break;case"GeometryCollection":n.geometries=n.geometries.map(i);break;default:e(n)}return r&&r(n),n}function i(e,r){var t,n=e.crs;if(void 0===n)throw new Error('Unable to detect CRS, GeoJSON has no "crs" property.');if("name"===n.type?t=r[n.properties.name]:"EPSG"===n.type&&(t=r["EPSG:"+n.properties.code]),!t)throw new Error("CRS defined in crs section could not be identified: "+JSON.stringify(n));return t}function u(e,r){return"string"==typeof e||e instanceof String?r[e]||t.Proj(e):e}funct
import os
# Look at https://github.com/qgis/QGIS/blob/2d1aa68f0d044f2aced7ebeca8d2fa6b754ac970/src/app/qgsstatusbarcoordinateswidget.cpp#L113
# and https://github.com/qgis/QGIS/tree/master/resources/data
iface.newProject()
data_base_path = [QgsApplication.pkgDataPath(), 'resources', 'data']
world_map_path = os.path.join(*data_base_path, 'world_map.gpkg')
layers_world_map = ['countries', 'states_provinces', 'disputed_borders']
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis saveUser="thomasg" projectname="" saveDateTime="2021-07-04T01:28:15" version="3.16.3-Hannover" saveUserFull="thomasg">
<homePath path=""/>
<title></title>
<autotransaction active="0"/>
<evaluateDefaultValues active="0"/>
<trust active="0"/>
<projectCrs>
<spatialrefsys>
<wkt>GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]</wkt>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Display a map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js"></script>
<script src="https://unpkg.com/@turf/turf/turf.min.js"></script>
<!DOCTYPE model>
<Option type="Map">
<Option name="children" type="Map">
<Option name="qgis:importintopostgis_1" type="Map">
<Option name="active" type="bool" value="true"/>
<Option name="alg_config"/>
<Option name="alg_id" type="QString" value="qgis:importintopostgis"/>
<Option name="color" type="QString" value=""/>
<Option name="comment" type="Map">
<Option name="color" type="QString" value=""/>