tag:blogger.com,1999:blog-3640333015804774602024-03-13T23:25:02.380+01:00Spatial MountyLocation with Informationspatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.comBlogger58125tag:blogger.com,1999:blog-364033301580477460.post-41146346174042735322023-01-18T22:55:00.003+01:002023-01-18T22:57:06.403+01:00How to import an Autocad DXF file into a Postgresql with PostGIS database.<p> <span style="background-color: #393e40; color: #ece8e1; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; white-space: pre-wrap;">To import an AutoCAD DXF file into a Postgresql database with the Postgis extension, you can use the </span><code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; white-space: pre-wrap;">ogr2ogr</code><span style="background-color: #393e40; color: #ece8e1; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; white-space: pre-wrap;"> command line tool. Here is an example of the code you would use:</span></p><pre style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #393e40; border-radius: 0.375rem; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: #ece8e1; font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; line-height: 1.71429; margin-bottom: 0px; margin-top: 0px; overflow-x: auto; padding: 0px;"><div class="bg-black mb-4 rounded-md" style="--darkreader-bg--tw-bg-opacity: 1; --darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-bg-opacity: 1; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: black; border-radius: 0.375rem; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; margin-bottom: 1rem;"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans" style="--darkreader-bg--tw-bg-opacity: 1; --darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --darkreader-text--tw-text-opacity: 1; --tw-bg-opacity: 1; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-text-opacity: 1; --tw-translate-x: 0; --tw-translate-y: 0; align-items: center; background-color: #292d2f; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: #f2eee9; display: flex; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 0.75rem; line-height: 1rem; padding: 0.5rem 1rem; position: relative;"><button class="flex ml-auto gap-2" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; appearance: button; background-image: none; border-color: rgb(125, 117, 104); border-style: solid; border-width: 0px; cursor: pointer; display: flex; font-family: inherit; font-size: 12px; font-weight: inherit; gap: 0.5rem; line-height: inherit; margin: 0px 0px 0px auto; padding: 0px;"><svg class="h-4 w-4" data-darkreader-inline-stroke="" fill="none" height="1em" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" stroke="currentColor" style="--darkreader-inline-stroke: currentColor;" viewbox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect height="4" rx="1" ry="1" width="8" x="8" y="2"></rect></svg>Copy code</button></div><div class="p-4 overflow-y-auto" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; overflow-y: auto; padding: 1rem;"><code class="!whitespace-pre-wrap hljs language-php-template" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background: none; border-radius: 0.3em; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: white; font-family: inherit; font-size: inherit; font-weight: inherit; hyphens: none; line-height: 1.5; overflow-wrap: normal; padding: 0.1em; tab-size: 4; white-space: normal; word-break: normal; word-spacing: normal;"><span class="xml" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;">ogr2ogr -f "PostgreSQL" PG:"dbname=<span class="hljs-tag" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;"><<span class="hljs-name" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;">DATABASE</span>></span> user=<span class="hljs-tag" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;"><<span class="hljs-name" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;">USERNAME</span>></span> host=<span class="hljs-tag" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;"><<span class="hljs-name" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;">HOST</span>></span> port=<span class="hljs-tag" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;"><<span class="hljs-name" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;">PORT</span>></span>" <span class="hljs-tag" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;"><<span class="hljs-name" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;">DXF_FILE</span>></span>.dxf -nln <span class="hljs-tag" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;"><<span class="hljs-name" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;">SCHEMA</span>></span>.<span class="hljs-tag" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;"><<span class="hljs-name" style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box;">TABLE</span>></span> -lco GEOMETRY_NAME=geom -lco FID=gid -lco PRECISION=NO -nlt PROMOTE_TO_MULTI
</span></code></div></div></pre><ul style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #393e40; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: #ece8e1; display: flex; flex-direction: column; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; list-style-image: initial; list-style-position: initial; margin: 1.25em 0px; padding: 0px 0px 0px 1rem; white-space: pre-wrap;"><li style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; display: block; margin: 0px; padding-left: 0.375em; position: relative;"><code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; margin-bottom: 1.25em; margin-top: 1.25em;">-f "PostgreSQL"</code> specifies that the output format is PostgreSQL</li><li style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; display: block; margin: 0px; padding-left: 0.375em; position: relative;"><code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; margin-bottom: 1.25em; margin-top: 1.25em;">PG:"dbname=<DATABASE> user=<USERNAME> host=<HOST> port=<PORT>"</code> specifies the connection parameters to the PostgreSQL database.</li><li style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; display: block; margin: 0px; padding-left: 0.375em; position: relative;"><code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; margin-bottom: 1.25em; margin-top: 1.25em;"><DXF_FILE>.dxf</code> is the file path of the .dxf file you want to import</li><li style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; display: block; margin: 0px; padding-left: 0.375em; position: relative;"><code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; margin-bottom: 1.25em; margin-top: 1.25em;">-nln <SCHEMA>.<TABLE></code> specifies the schema and table name you want to import the data into in the database</li><li style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; display: block; margin: 0px; padding-left: 0.375em; position: relative;"><code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; margin-bottom: 1.25em; margin-top: 1.25em;">-lco GEOMETRY_NAME=geom</code> specifies the name of the geometry column in the table</li><li style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; display: block; margin: 0px; padding-left: 0.375em; position: relative;"><code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; margin-bottom: 1.25em; margin-top: 1.25em;">-lco FID=gid</code> specifies the name of the feature ID column in the table</li><li style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; display: block; margin: 0px; padding-left: 0.375em; position: relative;"><code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; margin-bottom: 1.25em; margin-top: 1.25em;">-lco PRECISION=NO</code> tells ogr2ogr not to use a high precision geometry format</li><li style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; display: block; margin: 0px; padding-left: 0.375em; position: relative;"><code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600; margin-bottom: 1.25em; margin-top: 1.25em;">-nlt PROMOTE_TO_MULTI</code> promotes single-part geometries to multi-part geometries</li></ul><p style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #393e40; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: #ece8e1; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px; white-space: pre-wrap;">It is important to note that the PostGIS extension needs to be enabled for the database you want to import the data into before running this command.</p><p style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: #393e40; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: #ece8e1; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; margin: 1.25em 0px 0px; white-space: pre-wrap;">You will also need to have the GDAL library installed on your system to use the <code style="--darkreader-bg--tw-ring-color: rgba(10, 68, 163, 0.5); --darkreader-bg--tw-ring-offset-color: #111314; --darkreader-bg--tw-ring-offset-shadow: 0 0 transparent; --darkreader-bg--tw-ring-offset-width: 0px; --darkreader-bg--tw-ring-shadow: 0 0 transparent; --darkreader-bg--tw-shadow-colored: 0 0 transparent; --darkreader-bg--tw-shadow: 0 0 transparent; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 transparent; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(57, 62, 64); box-sizing: border-box; color: var(--darkreader-text--tw-prose-code); font-family: "Söhne Mono", Monaco, "Andale Mono", "Ubuntu Mono", monospace !important; font-size: 0.875em; font-weight: 600;">ogr2ogr</code> command.</p>spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-31536305794520541922022-03-19T15:18:00.004+01:002022-03-19T15:21:50.665+01:00How to delete a Geoserver layer using the Geoserver API with Python and Requests<h1 style="text-align: left;">How to delete a Geoserver Layer using the Geoserver API with Python and Requests.</h1><h4 style="text-align: left;">We assume you have basic authentication on your Geoserver instance.</h4><p>## Python Code ###</p><p><span data-darkreader-inline-color="" style="--darkreader-inline-color: #85f4ff; color: #66d9ef; font-family: "Fira Code", monospace; font-style: italic;">import requests</span></p><p><span data-darkreader-inline-color="" style="--darkreader-inline-color: #85f4ff; color: #66d9ef; font-family: "Fira Code", monospace; font-style: italic;"><br /></span></p><p><span data-darkreader-inline-color="" style="--darkreader-inline-color: #85f4ff; color: #66d9ef; font-family: "Fira Code", monospace; font-style: italic;">def </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdff63; color: #a6e22e; font-family: "Fira Code", monospace;">delete_layer</span><span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #161718; --darkreader-inline-color: #fffff9; background-color: #272822; color: #f8f8f2; font-family: "Fira Code", monospace;">(l</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #ffb74b; color: #fd971f; font-family: "Fira Code", monospace; font-style: italic;">ayer_name</span><span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #161718; --darkreader-inline-color: #fffff9; background-color: #272822; color: #f8f8f2; font-family: "Fira Code", monospace;">)</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672; font-family: "Fira Code", monospace;">:</span></p><pre data-darkreader-inline-bgcolor="" style="--darkreader-inline-bgcolor: #161718; background-color: #272822; font-family: "Fira Code", monospace;"><span data-darkreader-inline-color="" style="--darkreader-inline-color: #b9b3a7; color: #75715e;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">s </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">= </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">requests.</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #85f4ff; color: #66d9ef;">Session</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">()</span></pre><pre data-darkreader-inline-bgcolor="" style="--darkreader-inline-bgcolor: #161718; background-color: #272822; font-family: "Fira Code", monospace;"><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;"> GEOSERVER_USER </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">= </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffb95; color: #e6db74;">'someusername'<br /></span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffb95; color: #e6db74;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">GEOSERVER_PASS </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">= 'asecretthingy'</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffb95; color: #e6db74;"><br /></span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffb95; color: #e6db74;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">s.auth </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">= </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">(GEOSERVER_USER, GEOSERVER_PASS)</span></pre><pre data-darkreader-inline-bgcolor="" style="--darkreader-inline-bgcolor: #161718; background-color: #272822; font-family: "Fira Code", monospace;"><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;"><pre data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #161718; --darkreader-inline-color: #fffff9; background-color: #272822; color: #f8f8f2; font-family: "Fira Code", monospace;"> headers_json <span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">= </span>{<span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffb95; color: #e6db74;">'Content-type'</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">: </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffb95; color: #e6db74;">'application/json'</span>, }</pre> del_url </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">= </span><span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff2; color: #fffff9;">"https:/yourgeoserver.com</span></span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffb95; color: #e6db74;">/workspaces/SsmeWorkspaceName/datastores/someDataStoreName/featuretypes/" </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">+ </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">layer_name </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">+ </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffb95; color: #e6db74;">"?recurse=true"<br /></span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;"> r </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">= </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">s.</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #85f4ff; color: #66d9ef;">delete</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">(del_url, </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #ea9171; color: #aa4926;">headers</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">=</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">headers_json, </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #ea9171; color: #aa4926;">data</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fc3f83; color: #f92672;">=</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">{})</span></pre><pre data-darkreader-inline-bgcolor="" style="--darkreader-inline-bgcolor: #161718; background-color: #272822; font-family: "Fira Code", monospace;"><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;"><br /></span></pre><p data-darkreader-inline-bgcolor="" style="--darkreader-inline-bgcolor: #161718; background-color: #272822; text-align: left;"></p><ol style="text-align: left;"><li style="font-family: "Fira Code", monospace;"><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">Create a requests session</span></li><li style="font-family: "Fira Code", monospace;"><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">Enter your geoserver usernmame and password. A more secure way to do this would be to use dot env or simply have the environemental variables on the server already in place</span></li><li style="font-family: "Fira Code", monospace;"><span data-darkreader-inline-color="" style="--darkreader-inline-color: #fffff9; color: #f8f8f2;">Pass in basic authentication to requests</span></li><li style="font-family: "Fira Code", monospace;">I choose the JSON api application content-type but Geoserver also support XML if thats your thing.</li><li><span style="font-family: Fira Code, monospace;">Create your URL. Here the </span><span style="font-family: courier;">"?recurse=true"</span><span style="font-family: Fira Code, monospace;"> is needed as a layer could be in a group. A 403 will be returned if this is missing</span></li><li style="font-family: "Fira Code", monospace;">Make the DELETE request by passing in your URL and header data.</li></ol><p></p><pre data-darkreader-inline-bgcolor="" style="--darkreader-inline-bgcolor: #161718; background-color: #272822; font-family: "Fira Code", monospace; text-align: left;"><br /></pre>spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-35505905661753966172021-03-22T06:59:00.002+01:002021-03-22T21:40:54.856+01:00OGR2OGR Geopackage (gpkg) and GeoJSON<h1 style="text-align: left;"> How to export GeoPackage (.gpkg) table to GeoJSON file using OGR2OGR</h1><div><br /></div><div>Long story really, really short do this from the command line, terminal, Windows PowerShell what have you.</div><div><br /></div><div><div><b>How to export a single GeoPackage table to a single GeoJSON file:</b></div><div><br /></div><div><span style="background-color: #20124d; font-family: courier;">ogr2ogr -f GeoJSON -t_srs crs:84 yourtablename.geojson -sql "select * from yourtablename" yourgeopackage.gpkg</span></div><div><br /></div></div><div><br /></div><div><div><b>Assumptions making this work for you: </b> </div><div><ol><li>ogr2ogr is installed</li><li>you execute this command from within the same folder as the GeoPackage file itself</li><li>you want your GeoJSON file output to the current folder</li></ol><div></div></div></div><div><br /></div><div><div><div><br /></div></div></div><div><b>How to export all GeoPackage tables to Shapefiles?</b></div><div><br /></div><div><span style="background-color: #20124d; font-family: courier;">ogr2ogr -f "ESRI Shapefile" yourgeopackage.gpkg</span></div><div><br /></div><div><div>This will export all tables to the current folder where your GeoPackage is located.</div></div><div><br /></div><div><br /></div><div><br /></div><p><br /></p><p><br /></p>spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-10103177384575509432021-01-10T21:55:00.006+01:002021-02-14T23:06:30.917+01:00Personal Growth 2021<p> </p><h1>Personal Adventures</h1><p>This post is about personal objectives (goals) for 2021. I read that making your goals public makes them more real and more accountable, so I will give it a try.</p><h3>Objectives (goals) and Key Results (Personal OKR's) for 2021:</h3><p></p><ol><li><b><span style="font-family: helvetica; font-size: medium;">Be a better person, role model.</span></b> Well that is a big statement with only 4 words. I mean I need to wake up every day and just try to see each day as an adventure and chance to be better than yesterday. Sure there will be slip ups were the kids drive me mad but that comes with the territory of having kids. The hardest thing in life I find is just trying to figure out how to do things where there are no wright or wrong answers when trying to help or guide your kids. <br /><br />Key Result: a min. of 2 hrs every day with the kids<br />Key Result: try to teach the kids 10 things they enjoy by 31.12.2021<br /><br /></li><li><b><span style="font-family: helvetica; font-size: medium;">Read or listen(audibles) to 12 books.</span></b> One book a month is going to be a challenge, but this year started good with me diving into "Managing Humans" by Michael Lopp, and I am more than halfway done already as 10 Jan 2021. Next up, create a new habit, read at least 1hr a day. <br />Key Result: read 12 books by 31 Dec 2021<br /><br /></li><li><b><span style="font-family: helvetica; font-size: medium;">Write at least 12 blog posts. </span></b>I want to improve my writing skills. The only way to get better at writing is to write.<br />Key Results: write 6 blog posts by 30 June 2021<br />Key Results: write 6 more blog posts by 31 Dec 2021<br /><br /></li><li><b><span style="font-family: helvetica; font-size: medium;">Fitness get fit. </span></b>I think I am fit, but I know I can be fitter. I want to surpass my personal best scores of 2020.<br />Key Result: reach 34000 m elevation gain in 2021 by 31.12.2021<br />Key Result: MTB total distance of 1500 km <br />Key Result: 90 Activities, i.e. bike trips, strength training, hiking</li></ol><p></p><p><span style="color: red;"><b>PERONAL NOTE:</b></span> I <span style="color: red;"><b>deleted </b></span>my <b><span style="color: red;">facebook </span></b>account today 10.01.2021 ! Never used the site and found it provided me no real life benefit. The people I want to connect to I do and the ones who want to connect with me can. The great part is all this can happen in real life, face to face. A beer with friends, a poker night with the boys, a web call with the parents, that is fun. Endless scrolling through content is just not my thing.</p><p><u>MTB's stats from 2020</u> to compare to at the end of 2021:<br /></p><ul><li>Activities<span style="white-space: pre;"> </span> 77</li><li>Total Distance<span style="white-space: pre;"> </span> 1177 km</li><li>Total Activity Time 109:33:22 h:m:s</li><li>Total Elev Gain<span style="white-space: pre;"> </span> 33 061 m</li><li>Average Speed<span style="white-space: pre;"> </span> 10.7 kph</li><li>Average Heart Rate<span style="white-space: pre;"> </span> 121 bpm</li><li>Average Bike Cadence 53 rpm</li></ul>spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-16658468038827086922021-01-03T16:02:00.008+01:002021-02-07T11:59:59.261+01:00A review of 2020<h1 style="text-align: left;">Looking back at 2020 (COVID)</h1><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9dXSl5UwZUIue_hVBHXk6cHzqZ18-YCRCkZWFhDPdcj8LLpOj2BEy3aMZQ1Q4383YtTheK1hTaX1KOzAIViWBT4yb7xknxiBV0McOyKQ6iYC9Rp49c_eZR2Rxhq_J6fBLaq0UwdP0q2o/s944/gitlab-commits-2020-michael.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="534" data-original-width="944" height="323" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9dXSl5UwZUIue_hVBHXk6cHzqZ18-YCRCkZWFhDPdcj8LLpOj2BEy3aMZQ1Q4383YtTheK1hTaX1KOzAIViWBT4yb7xknxiBV0McOyKQ6iYC9Rp49c_eZR2Rxhq_J6fBLaq0UwdP0q2o/w572-h323/gitlab-commits-2020-michael.jpg" width="572" /></a></div><br /><div><br /></div><h4 style="text-align: left;">What changed in 2020?</h4><div>As for my technology stack there really were no changes, other than a couple version bump ups:</div><div><ul style="text-align: left;"><li><a href="https://www.qgis.org/">QGIS </a>3.16.2</li><li><a href="https://www.postgresql.org/">Postgres </a>12.4</li><li><a href="https://postgis.net/">PostGIS </a>3.0.2</li><li><a href="https://gdal.org/">GDAL </a>3.1.4</li><li><a href="https://pgrouting.org/">PgRouting </a>3.0.0</li><li><a href="https://www.python.org/">Python </a>3.8</li><li>Django 3.1</li><li>Ubuntu 20.04 LTS</li><li>Go 1.15.6</li><li>Nuxtjs 2.14</li><li>Vuejs 3.0</li><li>Nginx 1.18</li><li>Gunicorn 20.0.4</li><li>PyCharm 2020.3</li></ul><div>This year (2021) I want to add <a href="https://doc.traefik.io/traefik/">traefik </a> to my stack (Traefik is an open-source Edge Router). Time will tell if this year Kubernetes will enter my stack ( I think yes) but that will depend on my web applications requirements.</div></div><div><br /></div><div>Trends I saw in 2020</div><p style="text-align: left;"></p><ul style="text-align: left;"><li>The rise of AI everywhere</li><li>The limits of AI are real, its also still narrow</li><li>ESRI acquires <a href="https://www.nframes.com/">nFrames </a><a href="https://www.nframes.com/">https://www.nframes.com/</a></li><li>Lidar everywhere (iPhone 12 has it now, others will follow)</li></ul><div><br /></div><div>Trends I forsee in 2021</div><div style="text-align: left;"><ul style="text-align: left;"><li>Further AI advancements in efficiency (less resources for training)</li><li>Automation for the masses (workflow engines get used)</li><ul><li>Microsoft moving Excel into the world of programmer power for Excel experts.</li></ul><li>Drone data collection companies will go through a consolidation</li></ul><div><br /></div><div>Things I see that will and are changing the world:</div><div><ol style="text-align: left;"><li>Education</li><li>AI</li><li>Hyperloop</li><li>Quantum Computing</li></ol><div><br /></div></div><div><br /></div><ol style="text-align: left;"></ol></div><p></p><div><br /></div><div><br /></div><div><br /></div><div><br /></div><p><br /></p><p><br /></p><div id="gtx-trans" style="left: 107px; position: absolute; top: 1157.97px;"><div class="gtx-trans-icon"></div></div>spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-59746514683708616032020-12-26T08:24:00.002+01:002020-12-26T08:24:08.691+01:00Docker Compose installation of Postgres 12.4, PostGIS, 3.0, PgAdmin<h1 style="text-align: left;">PostGIS Docker setup using docker-compose</h1><h3 style="text-align: left;">Postgres, PostGIS, PgAdmin</h3><div>These three P's go hand in hand in my daily coding life. I thought I would share the fastest setup that I know to get all three up in running in any environment (Windows, Linux, Mac).</div><div><br /></div><div>First lets start off with the question you might have asked yourself when you found this post.</div><div><blockquote>How to setup PostGIS, Postgres and PgAdmin docker containers with persistent volumes? </blockquote></div><div><br /></div><div>This basically means you want to have a functioning Postgres database with the PostGIS extension enabled. You also want the database to continue to exist after you shut down or stop the docker container. Then you want to visually administer the Postgres database using <a href="https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html" target="_blank">PgAdmin </a>to maybe create a database, manage users or even load data.</div><div><br /></div><p>For those of you who just want answers, here is the short answer and the prerequisites you must meet before running this single command. The requirements include installing <a href="https://docs.docker.com/get-docker/" target="_blank">Docker </a>and <a href="https://docs.docker.com/get-started/08_using_compose/" target="_blank">docker-compose</a> on your local machine. That's it, nothing else needed.</p><p>Now simply save this docker-compose.yml file (posted here below) locally and run the following command at in your local terminal:</p><p><span style="font-family: courier;">docker-compose up -d</span></p><div><br /></div><p><br /></p><script src="https://gitlab.com/-/snippets/2054266.js"></script><p><br />Now for some more details. The base image you are using comes from <a href="https://hub.docker.com/r/kartoza/postgis/" target="_blank">Kartoza/postgis </a>and it can and should be tuned for your needs. The setup above is a quick start and not tuned for production environments. The PgAdmin container is also straight out of the box so use with care.</p><p>I hope this helped you. Until next time, happy coding.</p><p>Michael</p><div id="gtx-trans" style="left: 598px; position: absolute; top: 567.156px;"><div class="gtx-trans-icon"></div></div>spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-2963117714668165182020-03-21T18:33:00.001+01:002020-03-21T18:33:32.021+01:00Looking back at 2019 Geospatial Python<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
It was a busy year in 2019, except for a short holiday in July.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjX5c4GuGegFM1M9qsoCg2WHk2WHX7nSKNxh2KRik155cco56shmB-LWC480feyytY93Xdwgz7nE3Sywo-hJ2cgKRA0F8k56R2O13GbZXFIPbILnSU_KwEHXmB50ICvpJSoUur_w13eo8Y/s1600/md-commits-2019.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="535" data-original-width="926" height="368" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjX5c4GuGegFM1M9qsoCg2WHk2WHX7nSKNxh2KRik155cco56shmB-LWC480feyytY93Xdwgz7nE3Sywo-hJ2cgKRA0F8k56R2O13GbZXFIPbILnSU_KwEHXmB50ICvpJSoUur_w13eo8Y/s640/md-commits-2019.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
2019 came and went. Lets begin with how my tech stack changed in 2019.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h3 style="clear: both; text-align: left;">
Technology Stack as of December 2019</h3>
<div>
The basic core has not changed in the last several years, including Python, PostGIS, Postgresql. What is new this year is Google Cloud. Google Cloud Storage and Compute Engine were front and center this year for my new applications and deployments. The experience was smooth and polished in comparison to the AWS world which is also getting better I may add. Azure is looking good aswell, and I am looking forward to seeing what happens in 2020 within these big 3 players. </div>
<div>
<h3 style="text-align: left;">
GDAL in 2019</h3>
</div>
<div class="separator" style="clear: both; text-align: left;">
Installation of geospatial libraries was still a pain in 2019. Docker of course makes this pain less painfull but nonetheless I do not feel comfortable in saying that getting GDAL to jive with your application stack works out of the box. I was hoping this would be a solved problem but if you scour the internet there are still more than a few individuals posting problems with GDAL. The problem is hiding not so much in the installation of GDAL but in the way in which other applications try to find the GDAL libraries. </div>
<h3 style="clear: both; text-align: left;">
Postgresql / PostGIS 2019</h3>
<div class="separator" style="clear: both; text-align: left;">
Serving vector tiles directly from a Postgresql with PostGIS extension is all the rage in 2019. I believe in 2020 this will continue and finally eliminate the need for any geoserver like server (sorry Geoserver) to render your vector tiles.</div>
<h3 style="clear: both; text-align: left;">
QGIS 2019</h3>
<div class="separator" style="clear: both; text-align: left;">
The desktop GIS world is alive as ever. QGIS has become the defacto GIS Desktop of choice for me over the last 5 years. ArcGIS I know you since 1999 the power, the feature count, the usability, the stability, the market penetration you are the king of GIS. QGIS has what I believe covers 95% of your needs. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
QGIS has a very bright future and I would like to give a big shout out to the entire QGIS team for building such a great application!</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h3 style="clear: both; text-align: left;">
Deployments in 2019</h3>
<div class="separator" style="clear: both; text-align: left;">
Gitlab, Gitlab CI /CD and Docker, Docker-Compose have taken over my deployments.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h4 style="clear: both;">
2020 Will see more cloud and more AI, looking forward to trying out some geospatial AI.</h4>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br /></div>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-90882997068997683142018-11-02T16:56:00.002+01:002018-12-04T20:34:55.180+01:00Integrate Mapillary viewer with Openlayers side by side<div dir="ltr" style="text-align: left;" trbidi="on">
Mapillary offers several <a href="https://github.com/mapillary/mapillary-js" target="_blank">examples</a> of integrating web mapping clients, but Openlayers is missing. I thought it was time to add Openlayers to that list.<br />
<br />
In this example I created a map icon using two font codes from font-awesome. The point feature is then placed on top of the OpenStreetMap basemap. Updating the position of the icon happens when you click the controls within the mapillary viewer. If you click on the image locations on the map the mapillary viewer will automatically update. The icon bearing also adjust correctly to the camera bearing values.<br />
<br />
<div class="codepen" data-default-tab="js,result" data-height="265" data-pen-title="sync mapillary with openlayers full working example" data-slug-hash="Mzagxw" data-theme-id="0" data-user="mdiener21">
See the Pen <a href="https://codepen.io/mdiener21/pen/Mzagxw/">sync mapillary with openlayers full working example</a> by Michael Diener (<a href="https://codepen.io/mdiener21">@mdiener21</a>) on <a href="https://codepen.io/">CodePen</a>.</div>
<script async="" src="https://static.codepen.io/assets/embed/ei.js"></script>
</div>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-26752283151078263802018-10-24T13:34:00.001+02:002018-10-30T10:59:52.671+01:00Find a string in a Postgresql text array of strings<div dir="ltr" style="text-align: left;" trbidi="on">
<b><u>The problem:</u></b> You want to find or match a string that is located in a Postgresql text string array.<br />
<br />
The text array of stings could look like this <span style="font-family: "courier new" , "courier" , monospace;">{Restroom, Locker, Entrance}</span>.<br />
<br />
In this example the table called "<span style="font-family: "courier new" , "courier" , monospace;">places</span>" has a column called "<span style="font-family: "courier new" , "courier" , monospace;">tags</span>" that is our Postgresql text arrray.<br />
<br />
<b><u>The query</u></b> you would want to use to find all <i>Restrooms</i> without having to have an exact match but use a like statement could look like this:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Select array_to_string(tags,';') from places where array_to_string(tags,';') like '%Rest%';</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: inherit;">This will find all entries that match only the first for characters in Restroom</span><br />
<span style="font-family: inherit;"><br /></span>
If you want to do this in <b>Django</b> as a <a href="https://docs.djangoproject.com/en/2.1/topics/db/sql/" target="_blank">raw query</a> your query statement would look like:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Places.objects.raw("""Select id, array_to_string(tags,';') from appName_places where array_to_string(tags,';') like %s',['%Rest%']"""):</span></div>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-78624442170124101372018-10-03T15:54:00.001+02:002018-10-10T10:20:39.500+02:00Stack font awesome icons with openlayersI'm using fontawesome 4.7 and openlayers 5.2 in my project and wanted to create the stacked icon effect. Basically I want to have two font icons on top of each other. My code example is using a red circle for the background and a black flag for the foreground.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGv5pGWLErLqIRkXALalnP2er_exJ_MyIH6qIICWPXL7Bcr7_wVe-8JJ9px2v8ADFqYeJ51WzlF_2t4B-2as8MdeLDZurkMvbpiT2YR-jawG2vDlPM3b2l0AgT9gcCVP3JwPUR4wAvWA4/s1600/red-circle-flag.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="45" data-original-width="736" height="19" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGv5pGWLErLqIRkXALalnP2er_exJ_MyIH6qIICWPXL7Bcr7_wVe-8JJ9px2v8ADFqYeJ51WzlF_2t4B-2as8MdeLDZurkMvbpiT2YR-jawG2vDlPM3b2l0AgT9gcCVP3JwPUR4wAvWA4/s320/red-circle-flag.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
My first codepen attempt worked out not so bad:<br />
NOTE this is broken for openlayers versions 4.4.+ to 4.6.5:<br />
OL BUG fix <a href="https://github.com/openlayers/openlayers/issues/7675">https://github.com/openlayers/openlayers/issues/7675</a><br />
<div style="text-align: center;">
<b><u><span style="color: red; font-size: large;">**CLICK RERUN**</span></u></b> bottom right inside codepen<br />
if you cannot see a red circle with a flag</div>
<div style="text-align: center;">
<br /></div>
<div class="codepen" data-default-tab="js,result" data-height="265" data-pen-title="stack font-awesome fonts openlayers" data-slug-hash="MPKPzO" data-theme-id="0" data-user="mdiener21">
See the Pen <a href="https://codepen.io/mdiener21/pen/MPKPzO/">stack font-awesome fonts openlayers</a> by Michael Diener (<a href="https://codepen.io/mdiener21">@mdiener21</a>) on <a href="https://codepen.io/">CodePen</a>.</div>
<script async="" src="https://static.codepen.io/assets/embed/ei.js"></script>
If you just want to see the javascript part I also created a github gist<br />
CODE<br />
<script src="https://gist.github.com/mdiener21/c076e5d282c6f17935e4d24108b88984.js"></script>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-39360523468529605062018-04-19T14:29:00.003+02:002018-10-12T11:21:58.911+02:00My Geo Web Application Development Tech Stack<div dir="ltr" style="text-align: left;" trbidi="on">
I thought that it would be interesting to post a list of technologies that I use in my so called "technology stack". The day to day work happens in Ubuntu, PyCharm, Visual Studio Code, Postgresql (PgAdmin 4) all from my Dell XPS 15 9560. My old Dell Precision m4500 lasted 7 years until the harddrive failed. It is still alive with a new 512 GB SSD and running Ubuntu, sorry Windows.<br />
<br />
<br />
<br />
<a data-layers="1,2,3,4" data-stack-embed="true" data-theme="dark" frameborder="0" href="https://embed.stackshare.io/stacks/embed/04a3b55dcd89aa2cb18d05498886cb"></a> <script async="" charset="utf-8" src="https://cdn1.stackshare.io/javascripts/client-code.js"></script></div>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-83304373531928921652018-04-10T11:05:00.002+02:002018-04-10T11:05:24.452+02:00How to backup Postgresql DB to an FTP site using PythonUsing the standard tools of Postgresql pg_dump and Python's subprocess module we can call the command line tool via Python and have the dump file uploaded to an FTP site. This is of course a very simple way to backup.<br />
<br />
An alternative would be to use <b>Pgbarman</b> https://www.pgbarman.org/ which is a higly effective way to minimize data loss.
<script src="https://gist.github.com/mdiener21/8e7345d8a1efbf0355a17b383c9ea156.js"></script><br />
<br />
Here you go:<br />
<br />
<br />spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com2tag:blogger.com,1999:blog-364033301580477460.post-12767768685647794712018-02-11T10:28:00.000+01:002018-02-11T10:38:32.096+01:00How to create a regular survey grid with PostGISA fishnet grid is also commonly called a: survey grid, raster sample, sample grid, grid, landscape grid, grid reference and of course fishnet.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://i.stack.imgur.com/vQY0Z.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="186" data-original-width="272" src="https://i.stack.imgur.com/vQY0Z.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
source: <a href="https://trac.osgeo.org/postgis/wiki/UsersWikiCreateFishnet">https://trac.osgeo.org/postgis/wiki/UsersWikiCreateFishnet</a></div>
<br />
<br />
It all depends on your field of expertise as to what you call it, I know some times in biology they use the term "landscape grid".<br />
<br />
If you are the data analyst, gis analyst or even coop student who is assigned the job of creating such a sample grid as a set of polygons using Postgresql with PostGIS here is the function you could create in the database.<br />
<br />
<script src="https://gist.github.com/mdiener21/65012934208314c7308dada31b47e170.js"></script>
As you see in the GIST here there is also sample sql select query that would generate the data for you using the default start location of x= 0.0 and y=0.0.<br />
<br />
The input parameters are as follows:
<br />
<br />
<ol>
<li>number of rows of the grid</li>
<li>number of columns of the grid</li>
<li>start x coordinate (optional, default is 0.0)</li>
<li>start y coordinate (optional, default is 0.0)</li>
<li>row width in meters (if coordinates are a meter based system)</li>
<li>column width in meters (if coordinates are in a meter based system)</li>
</ol>
<div>
You could run this query in in QGIS and visualize the result immediately and save as a Shapefile using the QGIS "save as" functionality.</div>
<div>
<br /></div>
<div>
have fun generating your fishnet :)<br />
<br />
<span style="text-align: center;">source: </span><a href="https://trac.osgeo.org/postgis/wiki/UsersWikiCreateFishnet" style="text-align: center;">https://trac.osgeo.org/postgis/wiki/UsersWikiCreateFishnet</a></div>
<div>
<br /></div>
<div>
Michael</div>
<div>
<br /></div>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-49802418171336061092018-01-30T13:09:00.004+01:002018-03-07T12:53:17.145+01:00AGEO 2018 PresentationI am invited to present indrz at the annual AGEO 2018 <a href="http://www.ageo.at/">http://www.ageo.at</a> Österreichischer Dachverband für Geographische Information (Austrian Umbrella Organization for Geographic Information). Presentation 28.02.2018 is now available for download and viewing: <span style="color: #444444; font-family: Roboto, Helvetica, Arial, sans-serif; font-size: 13px;">https://goo.gl/4mchWX</span><br />
<span style="color: #444444; font-family: Roboto, Helvetica, Arial, sans-serif; font-size: 13px;"><br /></span>
<span style="color: #444444; font-family: Roboto, Helvetica, Arial, sans-serif; font-size: 13px;"><br /></span>
<span style="color: #444444; font-family: Roboto, Helvetica, Arial, sans-serif; font-size: 13px;"><br /></span>spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com1tag:blogger.com,1999:blog-364033301580477460.post-32990747254787592292016-12-21T12:38:00.000+01:002018-03-07T12:54:21.893+01:00How to create Django translations for django-rosetta from a model field<h2>
How to create Django translations from a model field for django-rosetta?</h2>
<br />
<br />
I am using Django-Rosetta to handle all of my project translations. Unfortunately I have only one model and one field of data that needs translation, the name of the POI. To get around this I have created a little script to query my Django Database directly to deliver the list of names to be translated. The output is a new html file with "trans" tags. This html file is then placed in my templates folder so that "makemessages" can find the file and mark them for translation.<br />
<br />
Anytime I want to update this I can run this script and bingo, new template file and new translations.<br />
<br />
<span style="color: red;"><i><u>Note to self:</u></i></span> When adding msgid and msgstr by hand the command "makemessages" will remove them in the .po file every time the command is called.<br />
<br />
<br />
<script src="https://gist.github.com/mdiener21/5da03f2d2473eb24bf95bb86c6f5e291.js"></script>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com1tag:blogger.com,1999:blog-364033301580477460.post-5404577629675914612016-09-13T14:57:00.000+02:002018-11-24T16:11:42.853+01:00CORS with Geoserver 2.9.0 and Tomcat<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
How to enable CORS on your Geoserver 2.9.0 running on Tomcat.<br />
<br />
<br />
This is taken directly from the tomcat homepage <a href="https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CORS_Filter">https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CORS_Filter</a><br />
<br />
Update to tomcat 8 <a href="https://tomcat.apache.org/tomcat-8.0-doc/config/filter.html#CORS_Filter">https://tomcat.apache.org/tomcat-8.0-doc/config/filter.html#CORS_Filter</a><br />
<br />
add the following code to your web.xml file then stop/start the tomcat process<br />
<br />
service tomcat stop<br />
service tomcat start<br />
<div>
<pre><filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With,accept,Origin,
Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
</init-param>
<init-param>
<param-name>cors.exposed.headers</param-name>
<param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
</init-param>
<init-param>
<param-name>cors.support.credentials</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.preflight.maxage</param-name>
<param-value>10</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping></pre>
</div>
<br />
<br /></div>
<div>
GIST</div>
<script src="https://gist.github.com/mdiener21/301b984fb6cb3e2260051f52589a9178.js"></script>
</div>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-61025233948278852542016-09-01T12:30:00.001+02:002018-04-16T09:37:14.547+02:00Using Django to create a point GeoJSON feature from the centroid of a polygonA practical example showing how to use geoDjango geospatial functions to create the centroid of a polygon, returning a GeoJSON dataset that includes all the attributes of the original polygon feature excluding the original geometry.<br />
<br />
Why exclude the original geometry you are probably asking yourself? Simple, the response already will include each individual geometry representing the original so we do not want it to be duplicated in the resonse.<br />
<br />
<b><u>Libraries used:</u></b><br />
<br />
<ol>
<li>Django Rest Framework to server up the response but you could of course use simple the Django response as well.</li>
<li>Python GeoJSON to create the features. </li>
</ol>
<div>
<b><u>How to use it:</u></b></div>
<br />
<br />
You will need to hook up your Django URLs to actually use this new view function. You will only need to pass in a unique_id value to return a single point centroid from your input polygon feature.<br />
<br />
<pre style="background-color: #272822; color: #f8f8f2; font-family: 'Courier New'; font-size: 9,0pt;"><span style="background-color: #3c3c57;">url</span>(<span style="color: #e6db74;">r'^getcenter/(?P<unique_id></span>[0-9]+<span style="color: #e6db74;">/$'</span>, get_room_center, name='centroid'),</pre>
<br />
<br />
<script src="https://gist.github.com/mdiener21/284ff4b0677e5d6a28b57a0afe15a6bf.js"></script>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-39496263105779297132016-08-24T12:51:00.001+02:002016-08-24T12:52:39.538+02:00Geoserver slice string values using SLD for label manipulation<br />
I have an attribute column in my <a href="http://www.postgis.net/" target="_blank">PostGIS </a>polygon table and want to only show the first 2 characters of this text field on my label using SLD in <a href="http://www.geoserver.org/" target="_blank">Geoserver</a>. My goal is to place the label at the center of the polygon so here it goes in SLD xml syntax as usual very verbose and ugly.<br />
<br />
<TextSymbolizer><br />
<Geometry><br />
<ogc:Function name="centroid"><br />
<ogc:PropertyName>geom</ogc:PropertyName><br />
</ogc:Function><br />
</Geometry><br />
<br />
<Label><br />
<ogc:Function name="strSubstring"><br />
<ogc:PropertyName>short_name</ogc:PropertyName><br />
<ogc:Function name="parseInt"><br />
<ogc:Literal>0</ogc:Literal><br />
</ogc:Function><br />
<ogc:Function name="parseInt"> <br />
<ogc:Literal>2</ogc:Literal><br />
</ogc:Function><br />
</ogc:Function><br />
</Label><br />
<br />
</TextSymbolizer><br />
<br />
My table column name is "short_name" and the geometry column name is "geom". This works and creates my label in the center of the polygon only drawing the first 2 characters from the field "short_name".<br />
<br />
I hope this helps :)<br />
cheers<br />
Michael<br />
<br />spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-80088319238719536072016-01-08T10:01:00.000+01:002016-01-08T10:01:30.278+01:00Goals for 2016This year I want to start out with a bang and what better way to start the year off right than setting up some goals for 2016. I think 5 goals should be reasonalble to achieve.<br />
<br />
<h2>
Goals 2016</h2>
<br />
<ol>
<li>Do more Django coding</li>
<li>Learn better Javascript best practises</li>
<li>Write more blog posts</li>
<li>Complete two spare time projects for fun</li>
</ol>
lets check this out again in January 2016 and see what gets done.<br />
<br />
cheers<br />
<h2>
</h2>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-34953538915202948492016-01-05T10:00:00.001+01:002016-01-05T10:01:29.521+01:00Python Geospatial Analysis Cookbook now available<h2>
Python Geospatial Analysis Cookbook</h2>
<div>
Well almost 1 year has past and my book is finally available for purchase. For those of you visiting this blog you habe 2 awesome choices to get the book at a great discount.</div>
<div>
<br /></div>
<div>
Exclusive deal 50% off with this code:</div>
<div>
<br /></div>
<div>
<a class="moz-txt-link-freetext" href="http://bit.ly/1R4S7pb" target="_blank">http://bit.ly/1R4S7pb<img border="0" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj90Oqig2ijW-Defg6NgnlIGEbhAYK7nFp-1u5_PCQ57bm0ZfZY5w3HJOdnqA3Rg4X-FaW2PlswiZ_trg3J6cU60RkSteObIALSCSRDHkPiJlsmRKRXmK3VhxMYpVZiLODpnqhHaqwKR5o/s320/PGAC50.jpg" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Packt is also offering a great deal to get my book and many more at only 5$ !! click below</div>
<a href="https://www.packtpub.com/big-data-and-business-intelligence/python-geospatial-analysis-cookbook/?utm_source=RPMichaelDiener&utm_medium=referral&utm_campaign=OME5D2015" target="_blank"><img border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmMAOYT_7qLDpvD_Dq9r7a9n5-VCQSV9ANlwujq8wu-mQACqj1s35qNzE8kLGxHNKb8lkCOroyu69RAkpbFrJum-q6Mkjr7vrfQJglOIw2D383c9k7KPWXnvqNo1XW3HXH1obf-8Y0iQ8/s320/%25245.png" width="320" /></a><br />
<br />
<br />
<br />
<br />spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-85473229329169908152015-11-11T12:57:00.000+01:002016-09-13T15:00:34.222+02:00How to import Spatialite into PostGIS using ogr2ogrGOAL: Import a Spatialite table into an existing PostGIS table appending (inserting) new rows using ogr2ogr. The trick is we want to map the fields to import to the correct corresponding PostGIS columns.<br />
<br />
First get the list of Spatialite fields using ogrinfo<br />
<br />
ogrinfo somedb.sqlite sqliteTableName<br />
<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">INFO: Open of `..\sqlite\socgen-db-final.sqlite'</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> using driver `SQLite' successful.</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">Layer name: e00_poly_join</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">Geometry: Polygon</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">Feature Count: 60</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">Extent: (-168613.719162, 5983831.402051) - (-168508.270008, 5983961.187764)</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">Layer SRS WKT:</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">PROJCS["WGS 84 / Pseudo-Mercator",</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> GEOGCS["WGS 84",</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> DATUM["WGS_1984",</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> SPHEROID["WGS 84",6378137,298.257223563,</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AUTHORITY["EPSG","7030"]],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AUTHORITY["EPSG","6326"]],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> PRIMEM["Greenwich",0,</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AUTHORITY["EPSG","8901"]],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> UNIT["degree",0.0174532925199433,</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AUTHORITY["EPSG","9122"]],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AXIS["Latitude",NORTH],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AXIS["Longitude",EAST],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AUTHORITY["EPSG","4326"]],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> PROJECTION["Mercator_1SP"],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> PARAMETER["central_meridian",0],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> PARAMETER["scale_factor",1],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> PARAMETER["false_easting",0],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> PARAMETER["false_northing",0],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> UNIT["metre",1,</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AUTHORITY["EPSG","9001"]],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AXIS["X",EAST],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AXIS["Y",NORTH],</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> AUTHORITY["EPSG","3857"]]</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">FID Column = PK_UID</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">Geometry Column = geom</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">Text: String (0.0)</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">spacetype: String (0.0)</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">building: Integer (0.0)</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">floor: Integer (0.0)</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">type_id: Integer (0.0)</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">tag: String (0.0)</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">name: String (0.0)</span><br />
<br />
Now you see we have a total of 9 columns<br />
using the -fieldmap option of ogr2ogr we can only input 7 of those fields.. The FID column and geometry column do NOT count towards the -fieldmap list<br />
<br />
-fieldmap 7,4,6,9,10,3,2<br />
<br />
This means 7 = field Text, 4 = field spacetype, 6 = building, 9=floor, 10=type_id, 3=tag, 2=name<br />
<br />
the value 7 for example represents the column position in your PostgreSQL DB where you want to import INTO using the Spatialite column called "Text" in this example.<br />
<br />
Counting the column number in Postgresql is also hard. You start at 0 NOT including the primary key and excluding the geometry column where ever it is the the column order.<br />
<br />
<br />
<br />spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-86359231159154166512015-08-06T15:16:00.002+02:002016-01-08T08:24:09.447+01:00Python Geospatial Analysis Cookbook coming soon...Hi,<br />
<br />
My book titled: <b><span style="font-family: Verdana, sans-serif;">Python Geospatial Analysis Cookbook</span></b> is coming soon<br />
Author: Michael Diener<br />
<br />
<a href="https://www.packtpub.com/big-data-and-business-intelligence/python-geospatial-analysis-cookbook">https://www.packtpub.com/big-data-and-business-intelligence/python-geospatial-analysis-cookbook</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://d1ldz4te4covpm.cloudfront.net/sites/default/files/imagecache/ppv4_main_book_cover/B03543_MockupCover_Cookbook_0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://d1ldz4te4covpm.cloudfront.net/sites/default/files/imagecache/ppv4_main_book_cover/B03543_MockupCover_Cookbook_0.jpg" width="259" /></a></div>
<br />
<br />
I am proud of my work and now the last stretch is ahead getting the last corrections, updates, reviews, comments all worked through to make it awesome.<br />
<br />
Stay tuned for any updates.<br />
<br />
cheers<br />
Michaelspatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-67255765478151226332015-06-30T11:56:00.002+02:002015-06-30T11:56:30.712+02:00Geoserver create a new layer using REST API<br />
I'am using Geoserver since, well a long time now. This post is going to be a collection of THINGS that you might want to do with Geoserver. Sometime errors occur when trying to do something with Geoserver with the REST API and those I have posted aswell.<br />
<br />
<br />
Goal adding a PostGIS table using the Geoserver REST API<br />
<br />
COMMAND:<br />
<span style="background-color: #cccccc;">curl -v -u yourUserName:PWD -XPOST -H "Content-type: text/xml" -d "<featureType><name>TABLENAME</name><nativeCRS>EPSG:3857</nativeCRS><srs>EPSG:3857</srs><enabled>true</enabled></featureType>" http://localhost:8080/geoserver/rest/workspaces/YOURWORKSPACENAME/datastores/DATASTORENAME/featuretypes</span><br />
<br />
Errors :java.io.IOException: Error occured calculating bounds for someTableName<br />
<br />
<ul>
<li>SOLUTION_ permissions on PostGIS tables were incorrect same user as registered in the DB connection must be used when creating a new layer</li>
</ul>
<div>
<br /></div>
<div>
<br /></div>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com1tag:blogger.com,1999:blog-364033301580477460.post-38123808692867483702015-06-06T14:53:00.001+02:002015-06-06T14:53:31.888+02:00How to fix pyshp error reading shapefileI had a Shapefile I was trying to read using the great pyshp library but it kept shooting out and Invalid Argument Error.<br />
<br />
After some web searching it came down to pyshp being very picky about the Shapefile format. The true cause I still do not know what was wrong. My Shapefile was created using QGIS, has valid geometries and no problems identifiable in ArcGIS or QGIS. Due to other experiences using pyshp sometimes if a field value is NULL or empty it causes some error.<br />
<br />
The solution:<br />
<br />
<b style="background-color: #cccccc;">ogr2ogr new_shapefile.shp original.shp</b><br />
<br />
<br />
the new_shapefile.shp will work using the pyshp ShapeRecords() function.<br />
<br />
Possible other problems that pyshp sometimes encounters:<br />
<br />
<ol>
<li>NULL value in field</li>
<li>'' empty in field</li>
<li>.dbf encoding (Latin1, UTF-8)</li>
</ol>
<div>
Anyway if you know of a cause please let me know.</div>
<div>
<br /></div>
<div>
cheers</div>
<div>
michael</div>
<div>
<br /></div>
<div>
<br /></div>
<br />
<br />
<br />spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0tag:blogger.com,1999:blog-364033301580477460.post-84366385460546561902015-05-30T23:46:00.001+02:002015-05-30T23:49:03.939+02:00GeoDjango < 1.7 return GeoJSON passing model name in requestI thought this might be hard but it really was not. Django 1.8 introduced GeoJSON serializer so use that if you are starting a new project with Django version 1.8 up. For those stuck with Django version <=1.7 this is the solution for you.<br />
<br />
The problem:<br />
You want to pass a model name to a request and return the GeoJSON for some map application.<br />
<br />
<br />
<ol>
<li>pip install django-geojson</li>
<li>add 'djgeojson' to your INSTALLED_APPS in the settings.py</li>
<li>urls.py add the URL for example: here we limit the model name to an alpha numeric characture including underscore or dash that is between 5 and 50 characters long</li>
<ul>
<li>url(r'^geojs/(?P<geomodel_name>[-\w]{5,50})/$',geoview.get_geojson, name="get_geojs"),</li>
</ul>
<li>views.py should look something like this:</li>
</ol>
<span style="background-color: #cccccc;">def get_geojson(request, geomodel_name):</span><br />
<span style="background-color: #cccccc;"> '''</span><br />
<span style="background-color: #cccccc;"> Pas model name as string</span><br />
<span style="background-color: #cccccc;"> :param geomodel_name: model name as string</span><br />
<span style="background-color: #cccccc;"> :return: instance of model</span><br />
<span style="background-color: #cccccc;"><br /></span>
<span style="background-color: #cccccc;"> '''</span><br />
<span style="background-color: #cccccc;"><br /></span>
<span style="background-color: #cccccc;"> mymodel = apps.get_model('geo_importer', geomodel_name)</span><br />
<span style="background-color: #cccccc;"> mygeoj = GeoJSONSerializer().serialize(mymodel.objects.all(), use_natural_keys=True, properties=('name', 'id'), srid=3857)</span><br />
<span style="background-color: #cccccc;"><br /></span>
<span style="background-color: #cccccc;"> return HttpResponse(mygeoj, content_type="application/json")</span><br />
<pre style="background-color: #272822; color: #f8f8f2; font-family: 'Courier New'; font-size: 9,0pt;"><pre style="font-family: 'Courier New';"></pre>
<pre style="font-family: 'Courier New';"></pre>
</pre>
spatialmountyhttp://www.blogger.com/profile/08543463902774792149noreply@blogger.com0