<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Miguel Narvaez on Medium]]></title>
        <description><![CDATA[Stories by Miguel Narvaez on Medium]]></description>
        <link>https://medium.com/@man9r3?source=rss-91b8a2fe4597------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SKobRvmGBgWvaAPAJDMSdA@2x.jpeg</url>
            <title>Stories by Miguel Narvaez on Medium</title>
            <link>https://medium.com/@man9r3?source=rss-91b8a2fe4597------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 20:46:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@man9r3/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[UV Python : Add local dependencies to .TOML file]]></title>
            <link>https://medium.com/@man9r3/uv-python-add-local-dependencies-to-toml-file-b61f3b1a3036?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/b61f3b1a3036</guid>
            <category><![CDATA[pyproject]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[uv-python]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Mon, 17 Feb 2025 16:24:14 GMT</pubDate>
            <atom:updated>2025-02-18T10:30:27.530Z</atom:updated>
            <content:encoded><![CDATA[<h3>UV Python : Add local dependencies to .TOML file</h3><p>I was working in a project which requires a local python package, at the beginning this package was not being recognized by UV, specifically by the pyproject.toml file.</p><p>So, the configuration to access local packages can be done by adding the below lines to the pyproject.toml file:</p><pre>[tool.hatch.metadata]<br>allow-direct-references = true</pre><p>Then you can run the command:</p><pre>uv add /path/to/my/local/package</pre><p>Immediately, the pyproject.toml file is updated with the below lines:</p><pre>[tool.uv.sources]<br>my_local_package = { path = &quot;my_local_package&quot; }</pre><p>after this, you must add your_local_package to the dependencies section, example of the final pyproject.toml file:</p><pre>[project]<br>name = &quot;py_project&quot;<br>version = &quot;0.1.0&quot;<br>description = &quot;Add your description here&quot;<br>readme = &quot;README.md&quot;<br>requires-python = &quot;&gt;=3.13&quot;<br><br>[tool.hatch.metadata]<br>allow-direct-references = true<br><br>dependencies = [<br>    &quot;my_local_package&quot;,<br>    &quot;geopandas&gt;=1.0.1&quot;,<br>    &quot;importlib-metadata&gt;=8.6.1&quot;,<br>    &quot;xarray&gt;=2025.1.2&quot;,<br>]<br><br>[tool.uv.sources]<br>my_local_package= { path = &quot;my_local_package&quot; }</pre><p>Hope this helps, as it did it to me ^^</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b61f3b1a3036" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ArcGIS REST API: Load CSV files to content]]></title>
            <link>https://medium.com/@man9r3/arcgis-rest-api-load-csv-files-to-content-9b941f5ba746?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b941f5ba746</guid>
            <category><![CDATA[arcgis]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[esri]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Thu, 06 Feb 2025 15:11:54 GMT</pubDate>
            <atom:updated>2025-02-06T15:11:54.620Z</atom:updated>
            <content:encoded><![CDATA[<p>I spent a couple of days writing a script to load CSV files as items into our data portal. The process wasn’t as straightforward as I initially expected, but I eventually managed to achieve the goal. Below, I demonstrate how I did it for this particular case.</p><p>I used the ArcGIS REST API since the script runs on a Linux Virtual Machine without Python or ArcGIS installed.</p><p>The first step is to obtain a token that will authorize all the necessary requests.</p><p>Get a Token :</p><pre>import requests<br><br>url = &quot;https://your_server_domain.maps.arcgis.com/sharing/rest/generateToken&quot;<br><br>querystring = {&quot;client&quot;:&quot;requestip&quot;,<br>               &quot;ip&quot;:&quot;&quot;,<br>               &quot;referer&quot;:&quot;&quot;,<br>               &quot;expiration&quot;:&quot;120&quot;,<br>               &quot;f&quot;:&quot;json&quot;}<br><br>payload = &quot;username=your_user_name&amp;password=your_password&quot;<br>headers = {<br>    &quot;Cache-Control&quot;: &quot;no-cache&quot;,<br>    &quot;Accept&quot;: &quot;*/*&quot;,<br>    &quot;User-Agent&quot;: &quot;Fetch Client&quot;,<br>    &quot;Accept-Encoding&quot;: &quot;gzip, deflate&quot;,<br>    &quot;Connection&quot;: &quot;keep-alive&quot;,<br>    &quot;Content-Type&quot;: &quot;application/x-www-form-urlencoded&quot;<br>}<br><br>response = requests.request(&quot;post&quot;,<br>                             url,<br>                             data=payload,<br>                             headers=headers,<br>                             params=querystring)<br><br>print(response.text)<br><br>--------------<br>{&quot;token&quot;:&quot;mzFcMRqhxzPvp2MJnNiN7nAuy7BvhQcl57tIFqRqpcefRh0iAjK6RLKHT-FcmX4hed1kjVZO14dh_no_bfI6fI61mWu5sK4KqGNfo5apVfq0yzEFQ2McwjZNgLUCFy-_Unv3u0cTLbaKYHIYXkT-paze4IFlUPD5Un_Ud0.&quot;,&quot;expires&quot;:1738669345436,&quot;ssl&quot;:true}</pre><p>Once the Token is obtained is possible to use the <a href="https://developers.arcgis.com/rest/users-groups-and-items/add-item/#request-parameters">/addItem</a> endpoint.</p><p>Full list parameters are <a href="https://developers.arcgis.com/rest/users-groups-and-items/add-item/#request-parameters">here</a>:</p><pre>import requests<br><br>url = &quot;https://your_server_domain.maps.arcgis.com/sharing/rest/content/users/{user_name}/addItem&quot;<br><br>querystring = {&quot;multipart&quot;:&quot;false&quot;,<br>               &quot;filename&quot;:&quot;true&quot;,<br>               &quot;title&quot;:&quot;test_autorest&quot;,<br>               &quot;type&quot;:&quot;CSV&quot;,<br>               &quot;description&quot;:&quot;lorem ipsum&quot;,<br>               &quot;f&quot;:&quot;json&quot;,<br>               &quot;token&quot;:&quot;{your_token}&quot;}<br><br>headers = {<br>    &quot;Cache-Control&quot;: &quot;no-cache&quot;,<br>    &quot;Accept&quot;: &quot;*/*&quot;,<br>    &quot;User-Agent&quot;: &quot;Fetch Client&quot;,<br>    &quot;Accept-Encoding&quot;: &quot;gzip, deflate&quot;,<br>    &quot;Connection&quot;: &quot;keep-alive&quot;,<br>    &quot;Content-Type&quot;: &quot;application/x-www-form-urlencoded&quot;<br>}<br><br># Then open the csv file<br>with open(file_csv, &quot;rb&quot;) as file:<br>    files = {&quot;file&quot;: (file_csv.split(&quot;/&quot;)[-1], file, &quot;text/csv&quot;)}<br><br>    # execute query<br>    response = requests.post(url=req_url, files=files, params=querystring)<br><br>    print(response.json())<br><br>------------------------<br><br>{&quot;id&quot;:&quot;b904bbf39b1b41778b613df231e47df2&quot;,&quot;success&quot;:true,&quot;folder&quot;:&quot;&quot;}</pre><p>After have added the file to your content, is possible to share it with determined groups or everyone, see the doc for share items <a href="https://developers.arcgis.com/rest/users-groups-and-items/share-item-as-group-admin/">here</a>, in below example I use the /share (as group admin) endpoint.</p><pre>groups = &quot;123456789,987456321&quot; # set your id groups<br><br># build url rest api<br>contentItems = config.get(&quot;esri_api&quot;, &quot;contentItems&quot;)<br><br>req_url = https://[root]/content/items/[itemID]/share<br><br>querystring = {&quot;token&quot;:token,<br>               &quot;f&quot;:&quot;json&quot;,<br>               &quot;everyone&quot;:True, # This will share the item with everyone<br>               &quot;groups&quot;:groups}<br><br>headers = {<br>    &quot;Cache-Control&quot;: &quot;no-cache&quot;,<br>    &quot;Accept&quot;: &quot;*/*&quot;,<br>    &quot;User-Agent&quot;: &quot;Fetch Client&quot;,<br>    &quot;Accept-Encoding&quot;: &quot;gzip, deflate&quot;,<br>    &quot;Connection&quot;: &quot;keep-alive&quot;<br>}<br><br>response = requests.request(&quot;post&quot;, req_url, headers=headers, params=querystring)</pre><p>Hope this helps !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b941f5ba746" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PyQGIS with Conda on Linux VM]]></title>
            <link>https://medium.com/@man9r3/pyqgis-on-linux-vm-and-visual-studio-code-ca55a8aafc4d?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca55a8aafc4d</guid>
            <category><![CDATA[pyqgis]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[qgis]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Tue, 28 Jan 2025 09:59:15 GMT</pubDate>
            <atom:updated>2025-02-19T16:39:51.293Z</atom:updated>
            <content:encoded><![CDATA[<p>When working with raster data, Python geo-libraries like geopandas or rasterio can sometimes be slow for certain geoprocessing tasks. Using the PyQGIS processing module within the QGIS Python console offers a much faster alternative. However, the QGIS interface is not ideal for development.</p><p>To solve this, I decided to install QGIS on a Linux Virtual Machine (VM) and set up my development environment in Visual Studio Code (VSC). This tutorial walks you through the process of installing QGIS and using its processing tools within VSC.</p><p>To determine the Linux distribution running on your VM, use the following command in the terminal:</p><pre>hostnamectl</pre><h3><strong>Installation QGIS on Linux</strong></h3><p>After determine your Linux Distribution refer to the <a href="https://qgis.org/resources/installation-guide/#linux">Qgis installation guide</a>, for my setup I followed the Fedora instructions:</p><pre>dnf install qgis python3-qgis qgis-grass qgis-server</pre><p>After the installation check the QGIS version installed:</p><pre>[miguel@vm ~]$ qgis --version<br>QGIS 3.38.1-Grenoble &#39;Grenoble&#39; (exported)</pre><h3>Set Up Visual Studio Code for Development</h3><p>After having installed QGIS in your linux virtual machine (vm), you can start coding in Visual Studio Code by connecting to your VM via SSH. Follow the <a href="https://code.visualstudio.com/docs/remote/ssh-tutorial">VSC </a>tutorial if needed.</p><p>Activate or create a Python environment on the way you prefer (conda, venv, uv, poetry…), afterwards <a href="https://qgis.org/resources/installation-guide/#linux">install QGIS</a> as another python package, example: using <a href="https://anaconda.org/conda-forge/qgis">conda-forge</a> :</p><pre>conda install conda-forge::qgis</pre><p>At the start of your python script you must add the below lines to say where the python QGIS is installed:</p><pre># Adjust the following path to your QGIS installation or environment<br>QGIS_PREFIX_PATH = &quot;/home/miguel/.conda/envs/{your_name_env}/share/qgis/python/qgis&quot;<br><br># Initialize the QGIS Application<br>QgsApplication.setPrefixPath(QGIS_PREFIX_PATH, True)<br>qgs = QgsApplication([], False)<br>qgs.initQgis()</pre><p>For use the processing module, initialize it as follows :</p><pre># Now import the CRS and processing modules, init the algorithms<br>import processing<br>from processing.core.Processing import Processing<br>Processing.initialize()</pre><p><strong>Example PyQGIS function:</strong></p><p>Here is an example function that creates a grid (“fishnet”) based on the extent of a given vector layer:</p><pre>def qgis_create_fishnet(self, vlayer, cell_size:int):<br><br>        &quot;&quot;&quot;Create a fishnet from a qgis virtual layer extent &quot;&quot;&quot;<br><br>        # get the extent of the vlayer<br>        ext = vlayer.extent()<br><br>        # get the xmin, xmax, ymin, ymax<br>        xmin = ext.xMinimum()<br>        xmax = ext.xMaximum()<br>        ymin = ext.yMinimum()<br>        ymax = ext.yMaximum()<br><br>        print(f&#39;xmin: {xmin}, xmax: {xmax}, ymin: {ymin}, ymax: {ymax}&#39;)<br><br>        grid = Processing.runAlgorithm(<br>        &quot;native:creategrid&quot;,<br>            {&#39;TYPE&#39;:2,<br>            &#39;EXTENT&#39;: f&#39;{xmin}, {xmax}, {ymin}, {ymax} [EPSG:XXXX]&#39;,<br>            &#39;HSPACING&#39;:cell_size,<br>            &#39;VSPACING&#39;:cell_size,<br>            &#39;HOVERLAY&#39;:0,<br>            &#39;VOVERLAY&#39;:0,<br>            &#39;CRS&#39;:QgsCoordinateReferenceSystem(&#39;EPSG:XXXXX&#39;),<br>            &#39;OUTPUT&#39;: &quot;TEMPORARY_OUTPUT&quot;<br>                })<br>        <br>        return grid[&#39;OUTPUT&#39;]</pre><p>Notice the return grid[&#39;OUTPUT&#39;] allows to capture the output grid as a variable for further processing.</p><p>This setup enables you to combine the powerful geoprocessing capabilities of PyQGIS with the flexibility and productivity of Python development in Visual Studio Code. I’ve used this workflow for several geoprocessing tasks, and it has significantly improved my efficiency.</p><p>I’m still exploring ways to optimize this process further, so any feedback or suggestions are welcome. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca55a8aafc4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ArcGIS Rest API with Python]]></title>
            <link>https://medium.com/@man9r3/arcgis-rest-api-et-python-6fd3c05df81a?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fd3c05df81a</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[arcgis]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Tue, 15 Oct 2024 13:54:01 GMT</pubDate>
            <atom:updated>2024-10-15T13:54:25.087Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*x6wl2OvY5N5uNayk-OyB6g.png" /><figcaption>ArcGIS and Python logo within a office context, generated by ChatGPT</figcaption></figure><p>Lets access the content of an enterprise Open Data Portal through the Rest API, see the official documentation here: <a href="https://developers.arcgis.com/rest/">https://developers.arcgis.com/rest/</a></p><p><strong>Obtain a Token: </strong>Before accessing many if the ArcGIS REST API services, it is necessary to first obtain a token:</p><pre>def base_url(https://medium.com/self):<br>  return &quot;https://machine.domain.com/webadaptor/sharing/rest&quot;<br><br>def get_token(self):<br><br>      # get config info<br>      &quot;&quot;&quot;<br>      Get the token to access the ArcGIS REST API<br><br>      The token is needed to call other methods of the ArcGIS REST API<br><br>      Returns<br>      -------<br>      token : str<br>          The token to access the ArcGIS REST API<br>      &quot;&quot;&quot;<br><br>      headers = {<br>          &quot;Accept&quot;: &quot;*/*&quot;,<br>          &quot;Content-Type&quot;: &quot;application/x-www-form-urlencoded&quot;<br>      }<br><br>      # create URL<br>      req_url = self.base_url() + &quot;/generateToken&quot;<br><br>      payload = {<br>          &quot;username&quot;: &quot;username&quot;,<br>          &quot;password&quot;: &quot;password&quot;,<br>          &quot;client&quot;: &quot;requestip&quot;,<br>          &quot;ip&quot;: &quot;&quot;,<br>          &quot;referer&quot;: &quot;&quot;,<br>          &quot;expiration&quot;: &quot;120&quot;,<br>          &quot;f&quot;: &quot;pjson&quot;<br>      }<br><br>      response = requests.post(req_url, data=payload, headers=headers)<br><br>      return response.json()[&quot;token&quot;]</pre><p>Now, I’ll get the list of users that own content in the data Hub:</p><pre>def get_users(self):<br><br>      # get config info<br>      &quot;&quot;&quot;<br>      Get the list of users in the ArcGIS data Hub<br><br>      The list of users and their informations are returned<br><br>      Returns<br>      -------<br>      users_list : list<br>          The list of users and their informations<br>      &quot;&quot;&quot;     <br><br>      # get token<br>      token = self.get_token()<br>      f = &#39;pjson&#39;<br><br>      params = {&quot;token&quot;: token, &quot;f&quot;: f}<br><br>      # create URL<br>      req_url = self.base_url() + &quot;/portals/{id_portal}/users&quot;<br><br>      response = requests.get(req_url, params=params)<br><br>      # get list of users and information related to them<br>      users_list = [{&quot;username&quot;: user[&quot;username&quot;], &quot;id&quot;: user[&quot;id&quot;], &quot;availableCredits&quot;: user[&quot;availableCredits&quot;]} for user in response.json()[&quot;users&quot;]]<br><br>      return users_list</pre><p>What, if we load the content by user into a pandas dataframe:</p><pre>def load_content_to_db(self):<br><br>    # config info<br>    &quot;&quot;&quot;<br>    Load content of each user in pandas dataframe<br><br>    The method iterates over the list of users and sends a request to the ArcGIS REST API<br>    to get the list of content for each user. The list of content is then converted to a pandas<br>    DataFrame<br><br>    Returns<br>    -------<br>    None<br>    &quot;&quot;&quot;<br><br>    # get the list of users<br>    users_list = self.get_users()<br><br>    # get token<br>    token = self.get_token()<br>    f = &#39;pjson&#39;<br><br>    params = {&quot;token&quot;: token, &quot;f&quot;: f}<br><br>    # for each user<br>    for user_info in users_list:<br><br>        # create url<br>        req_url = self.base_url() + &quot;/content/users/&quot; + user_info[&quot;username&quot;]<br><br>        response = requests.get(req_url, params=params)<br><br>        # get list of content<br>        user_content = response.json()[&#39;items&#39;]<br><br>        # columns to load in df<br>        cols = [<br>            &quot;id&quot;,<br>            &quot;owner&quot;,<br>            &quot;created&quot;,<br>            &quot;modified&quot;,<br>            &quot;title&quot;,<br>            &quot;type&quot;,<br>            &quot;description&quot;,<br>            &quot;tags&quot;,<br>            &quot;licenseInfo&quot;,<br>            &quot;numViews&quot;,<br>            &quot;lastViewed&quot;<br>            ]<br><br>        # create df from list<br>        df = pd.DataFrame.from_records(user_content, columns=cols)<br><br>        # convert epoch to date<br>        df[&quot;created&quot;] = pd.to_datetime(df[&quot;created&quot;], unit=&#39;ms&#39;)<br>        df[&quot;modified&quot;] = pd.to_datetime(df[&quot;modified&quot;], unit=&#39;ms&#39;)<br>        df[&quot;lastViewed&quot;] = pd.to_datetime(df[&quot;lastViewed&quot;], unit=&#39;ms&#39;)<br><br>        print(df)<br><br>  return None</pre><p>The key advantage of using the ArcGIS REST API is that it allows you to interact with ArcGIS services on machines where ArcGIS is not installed, including Linux environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fd3c05df81a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Geoserver: Get data from Postgis database]]></title>
            <link>https://medium.com/@man9r3/geoserver-get-data-from-postgis-database-6fba26e7819d?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fba26e7819d</guid>
            <category><![CDATA[postgis]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[sig]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[geoserver]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Mon, 16 Sep 2024 13:58:54 GMT</pubDate>
            <atom:updated>2024-09-16T13:58:54.238Z</atom:updated>
            <content:encoded><![CDATA[<p>Accessing a PostGIS database through a <strong>GeoServer workflow</strong> offers several advantages, especially when working with geospatial data.</p><p>Here, I related how I have deployed a geoserver WMS using data from a Postgis table (SQL table view).</p><p><strong>Creating the Workspace:</strong><br> Set up the workspace where your data will be managed by specifying a <strong>Name</strong>, a <strong>Namespace URI</strong>, and selecting the services you want to enable (such as WMS, WFS, etc.). In this example, I’ve named the workspace <strong>‘siteweb’ </strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*gQVwzHMdHE6GiMY9kSOPPQ.png" /></figure><p><strong>Creating the Store :</strong></p><p>Create the data store and select <strong>PostGIS</strong> as the data source type. Provide a name for your data source (such as the database name), and enter the necessary database connection parameters.</p><p>You can leave the remaining fields with their default values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*ko_jHe2IExy7bHlFmHj-cA.png" /></figure><p>The data I want to share will be retrieved from a <strong>SQL view</strong>, which is the result of a query executed on one of the tables in the database called <strong>‘indicateurs’</strong>.</p><p>Click on <strong>Configure New SQL View</strong>, set a name, and input the SQL query for the view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*9k94Nps_cBWxgAybYoqoiQ.png" /></figure><p>The % character allows you to set parameter values within the SQL query, which can be adjusted dynamically via the query URL. We will later explore how to build the URL query.</p><p>You can also define default parameter values using the <strong>‘Guess parameters from SQL’</strong> option, which lets GeoServer automatically detect the parameters, or you can add them manually.<br> Additionally, you can apply regular expressions to pre-filter parameter values, ensuring they meet specific conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*Juw7rhluZQk1hXIieWRETg.png" /></figure><p>Then you can see the attributes of the returned table, and set the configuration of the “geom” value (Type and SRID).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*QCl-F3u8a_7nIzgtgpV8EQ.png" /></figure><p><strong>Preview Layer:</strong></p><p>In the <em>layer preview section</em> look for the created layer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*FKYQPpC--5ZEl6_YKwuwsA.png" /></figure><p><strong>URL Query:</strong></p><p>The default URL query will be:</p><pre>https://path_to_my/geoserver/siteweb/ows?service=WFS&amp;version=1.1.0&amp;request=GetFeature&amp;typeName=siteweb:indicateurs&amp;outputFormat=application/json&amp;SrsName=EPSG:4326&amp;viewparams=polluant:{pol};annee:{annee}</pre><p>Notice how the parameters defined during store creation (pollutant, annee) are included in the query. In this example, the response is requested in JSON format. However, you can also specify other formats, such as PNG, depending on the service and requirements.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fba26e7819d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ArcGIS API: Install python library in Linux and manage content]]></title>
            <link>https://medium.com/@man9r3/arcgis-api-install-python-library-in-linux-and-manage-content-bb7c4ad26ff5?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb7c4ad26ff5</guid>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[arcgis]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[geomatics]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Wed, 28 Aug 2024 15:38:26 GMT</pubDate>
            <atom:updated>2024-08-28T15:38:26.068Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*w0Q-2XbCfdfmou2f9-cqzQ.png" /></figure><p>The target of this note is to Install the Arcgis API for Python, access and create content. You can find the official documentation <a href="https://developers.arcgis.com/python/">here</a>.</p><p>Several ways are proposed to install the Arcgis Python Module, I’ve tried several of them, but I always got the same error:</p><figure><img alt="Error: Failed building wheel for krb5" src="https://cdn-images-1.medium.com/max/807/1*rsmRHXOz1ftwKnQ4y9LzcQ.png" /></figure><p>So, the workaround was to install the krb5 library :</p><pre>conda install conda-forge::krb5</pre><p>And then install ArcGIS using the command from <a href="https://anaconda.org/esri/arcgis">Anaconda</a>:</p><pre>conda install esri::arcgis</pre><p>This take several minutes, but finally the library and needed dependences were well installed.</p><figure><img alt="Output of the command conda list shows arcgis module is well installed within the python environment" src="https://cdn-images-1.medium.com/max/788/1*Gub9t4sFaY3mTYFxrjtw8A.png" /></figure><p>All is set it up, now I want to load a geojson file to the data portal of my structure, and create a Feature Layer from this geojson. for that I’ll use the method add() within a ContentManager instance.</p><pre>from arcgis.gis import GIS<br>from arcgis.gis._impl._content_manager import SharingLevel<br>import geopandas as gpd<br><br># Function to import geodata to the Content of ArcGIS Online<br>def load_data_to_content(self):<br>    # Create geodataframe from a SQL query on a PostGIS Database<br>    raw_data = gpd.GeoDataFrame.from_postgis(self.spatial_query, self.conn)<br><br>    # reproject CRS<br>    gdf = raw_data.to_crs(27572)    # Lammbert II - Paris<br>    <br>    # Dispose connection database<br>    self.conn.dispose()<br><br>    # create geojson from geodataframe<br>    f_geojson = gdf.to_json()<br><br>    # Authenticate into Arcgis Online, interactive login experience<br>    # you&#39;ll be prompt to submit the password of your Arcgis Online<br>    gis = GIS(&quot;https://www.arcgis.com&quot;, username=&#39;your_user_name&#39;)<br><br>    # check if there is already content on the Open Data with same name of the<br>    # feature I aim to load<br><br>    for item_type in [&quot;GeoJSON&quot;, &quot;Feature *&quot;]:<br>        content_search = gis.content.search(query=f&quot;title:geojson_name&quot;, item_type=item_type)<br>        <br>        # if there is some content with the same name I&#39;ll delete<br>        if len(content_search) != 0:<br>            for item in content_search:<br>                if item.title == name_item:<br>                    item.delete()<br><br>    # Then create the properties of the feature to load<br>    prop_geojson = {<br>        &#39;type&#39;: &#39;GeoJson&#39;,<br>        &#39;title&#39;: &#39;geojson_name&#39;,<br>        &#39;description&#39;: &quot;Geodata in geojson format.&quot;,<br>        &#39;tags&#39;: &quot;geodata4all, Public&quot;,<br>        &#39;text&#39;: f_geojson,<br>        &#39;accessInformation&#39;: &#39;MyOrganization&#39;,<br>        &#39;groups&#39;: [&#39;list_of_your_groups_ids&#39;],<br>        &#39;licenseInfo&#39;: &#39;ODbL&#39;}<br><br>    # Add the geojson to the content for then create a service from it<br>    item_geojson = gis.content.add(prop_geojson, f_geojson)<br><br>    # set the share level and share groups<br>    org_item = gis.content.get(item_geojson.itemid)<br><br>    # create sharing instance<br>    item_sharing_mgr = org_item.sharing<br><br>    # set sharing level<br>    item_sharing_mgr.sharing_level = SharingLevel.EVERYONE<br><br>    # create item group manager<br>    item_grp_sharing_mgr = item_sharing_mgr.groups<br>    <br>    # Add item to organization group, you can pass the ID group directly<br>    item_grp_sharing_mgr.add(group=&#39;your_IDGROUP&#39;)<br><br>    # Publish the geojson file<br>    item_geojson.publish(file_type=&#39;geojson&#39;, overwrite=True)<br><br>    return item_geojson.created</pre><p>I choose to deploy an interactive login experience, as I’ll be executing this script manually, and above all for security reasons. Perhaps the <a href="https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/">ArcGIS API offers several ways to store login information in more or less level security.</a></p><p>I have to add()the content first and then get() its itemid for being able to set the <a href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#sharinglevel">sharing level</a> and <a href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#sharinggroupmanager">groups manager</a>.</p><p>Well, the data is added to my ArcGIS online portal, the above code is just one extract from a whole python module, don’t hesitate to make questions or even better to propose corrections, all we look for the GIS-pythonic way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb7c4ad26ff5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Initialize a pre-existing Python Project with Poetry and execute it from a CRONTAB job.]]></title>
            <link>https://medium.com/@man9r3/initialize-a-pre-existing-python-project-with-poetry-and-execute-it-from-a-crontab-job-029011e5715d?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/029011e5715d</guid>
            <category><![CDATA[shell]]></category>
            <category><![CDATA[crontab]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-poetry]]></category>
            <category><![CDATA[poetry]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Sun, 19 May 2024 15:22:32 GMT</pubDate>
            <atom:updated>2024-05-19T15:22:32.720Z</atom:updated>
            <content:encoded><![CDATA[<p>I have a python project who was not born with Python Poetry, so let’s add Poetry as the Package Manager for this project.</p><figure><img alt="Folder tree structure" src="https://cdn-images-1.medium.com/max/916/1*fwIzZM88iaNx5H9n5J5I0A.png" /></figure><p>Within the folder that contains the project, I’ll create a new python environment named <strong>‘horair’ </strong>which will host the poetry project. just next I’ll initialize the existing project with Poetry.</p><pre>mamba create --name horair python=3.*</pre><pre>poetry init</pre><p>Answer the questions, and then lets create a Poetry virtual environment</p><pre>poetry env use ~/.conda/envs/horair/bin/python</pre><p>Then, my main.py script is executed from a shell file located at horair_poetry\trans_to_carioca.sh important to add the option -l to the shebang, this will allow to execute the shell script from a cron job without having issues with the environment variables, such as “Poetry command not found…” :</p><pre>#!/bin/bash -l<br><br># Define location for log file<br>log_file=&quot;horair_poetry/main.log&quot;<br><br># Initialize the time compter<br><br>echo `date`<br>start_time=$(date +%s)<br><br># go to the working directory<br>cd horair_poetry<br>poetry run python horair_poetry/main.py<br><br># Obtener el tiempo de ejecución total<br>end_time=$(date +%s)<br>total_time=$((end_time - start_time))<br><br># Notificar que el proceso ha terminado<br>echo &quot;Treatment has ended: $total_time seconds.&quot;<br><br>echo &quot;end&quot;</pre><p>Then, the crontab line looks like:</p><pre>1 * * * * /horair_poetry/horair_poetry/trans_to_carioca.sh &gt;&gt; /horair_poetry/log.log 2&gt;&amp;1</pre><p>Hope this helps, and any comment is so welcoming, let’s grow together !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=029011e5715d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configurar una clave SSH para GitLab en una máquina virtual Linux con un usuario específico.]]></title>
            <link>https://medium.com/@man9r3/configurar-una-clave-ssh-para-gitlab-en-una-m%C3%A1quina-virtual-linux-con-un-usuario-espec%C3%ADfico-40cde9c185f3?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/40cde9c185f3</guid>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 20:13:06 GMT</pubDate>
            <atom:updated>2024-01-29T20:13:06.658Z</atom:updated>
            <content:encoded><![CDATA[<p>Nuestra intención es enviar nuestros desarrollos que se encuentran en una máquina virtual Linux a un repositorio GitLab llamado MyPUF, dentro del grupo METROLOGIE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*r4PA2G4qau9k9mZI.png" /></figure><p>Una vez conectado con su usuario en la máquina virtual Linux, localice el directorio que contiene sus desarrollos, por ejemplo:</p><p><strong>[miguel@mv MyPuf_Dev]</strong></p><p>Dado que el repositorio de GitLab está vacío, seguiremos las instrucciones de GitLab para subir nuestros desarrollos. Ingrese cada uno de los siguientes comandos y veamos los posibles errores:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/0*qfYImblS_gw1iYv_.png" /></figure><p>⚠️<strong>Primer error posible: Al intentar inicializar el repositorio git en la máquina virtual:</strong></p><pre>[migueln@mv MyPuf_Dev]$ git init - initial-branch=main<br>/home/migueln/MyPuf_Dev/.git: Permiso denegado</pre><p>Asegúrese de estar en su usuario y de que sea el propietario de esta carpeta:</p><p>Para verificar, ingrese el comando <strong>ls -l</strong>, su nombre de usuario debe figurar como propietario de la carpeta:</p><p><strong>[migueln@mv MyPuf_Dev]$ ls -l</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/0*dA7REz-OAOV544ad.png" /></figure><p>En caso contrario, por ejemplo, si el propietario de la carpeta es root, puede recrear la carpeta como su usuario o darle los derechos de la carpeta a su usuario utilizando el comando <strong>chmod</strong>.</p><p>Después de realizar las modificaciones necesarias, vuelva a ejecutar el comando:</p><pre>[migueln@mv MyPuf_Dev]$ git init - initial-branch=main<br>Dépôt Git vide initialisé dans /home/migueln/MyPuf_Dev/.git/</pre><p>La siguiente instrucción nos permitirá agregar la dirección del repositorio remoto de GitLab:</p><pre>[migueln@mv MyPuf_Dev]$ git remote add origin git@gitlab.xxx.xxx:metrologie/mypuf.git</pre><p>A continuación, vamos a indexar los cambios utilizando el comando <strong>git add</strong>.</p><pre>[migueln@mv MyPuf_Dev]$ git add .</pre><p>⚠️Segundo error posible :</p><pre>[migueln@mv MyPuf_Dev]$ git commit -m &quot;Initial commit&quot;<br>author identity unknown<br>*** Please tell me who you are.<br>run<br>  git config --global user.email &quot;Vous@exemple.com&quot;<br>  git config --global user.name &quot;Votre Nom&quot;<br>&#39;fatal: empty ident name not allowed&#39;</pre><p>Para superar este obstáculo, vamos a definir los parámetros <strong>user.name</strong> y <strong>user.email</strong>, estos parámetros permiten a Git saber quién es la persona que realiza cambios en un proyecto.</p><pre>[migueln@mv MyPuf_Dev]$ git config --global user.email miguel.narvaez@xxx.xxx<br>[migueln@mv MyPuf_Dev]$ git config --global user.name Miguel<br>[migueln@mv MyPuf_Dev]$ git commit -m &quot;Initial commit&quot;</pre><p>Ahora, vamos a enviar los cambios a nuestro repositorio remoto de GitLab:</p><pre>[migueln@mv MyPuf_Dev]$ git push --set-upstream origin main<br>The authenticity of host &#39;gitlab.xxx.xxx (99.999.999.999)&#39; can&#39;t be established.<br>ED99999 key fingerprint is XXX123:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.</pre><p>Esta advertencia es normal. Responda <strong>“yes”</strong> a la pregunta y presione Enter dos veces.</p><p>Como es la primera vez que nos conectamos a este repositorio GitLab desde esta máquina virtual, debemos generar una llave SSH. Para hacerlo, utilice el comando <strong>ssh-keygen</strong>.</p><pre>[migueln@falx MyPuf_Dev]$ ssh-keygen<br>Generating public/private rsa key pair.<br>Enter file in which to save the key (/home/migueln/.ssh/id_rsa):</pre><p>Voilà, la llave SSH ha sido generada :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*I6tEkbYHuSi9fWcY.png" /></figure><p>Una carpeta .ssh ha sido añadida a nuestro repertorio de trabajo :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/0*DX1gDhvXlL7L-ISQ.png" /></figure><p><strong>id_rsa.pub:</strong> Se trata de la llave pública asociada a su llave privada <strong>id_rsa</strong>. La llave pública se comparte y se utiliza para verificar firmas o para cifrar mensajes que solo podrán descifrarse con la llave privada correspondiente.</p><p><strong>id_rsa:</strong> Esta es su llave privada. Es una llave secreta que nunca debe compartir. Se utiliza para descifrar mensajes cifrados con la llave pública correspondiente. Mantenga esta llave segura y compártala solo con personas de confianza.</p><p>Luego, vamos a agregar la llave SSH directamente en GitLab, pero antes, abra el contenido del archivo <strong>id_rsa.pub</strong> y modifique la dirección de correo electrónico por la que utiliza para iniciar sesión en su cuenta de GitLab.</p><p>Luego, copie el contenido del archivo <strong>rsa.pub</strong> (llave SSH) y regrese a GitLab, haga clic en <strong>Preferences -&gt; SSH Keys</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*iqPcM5orBcsXVuag.png" /></figure><p>Luego, vamos a guardar la clave SSH, haz clic en <strong>Add new key</strong>, pega la clave SSH, establece un título significativo para ti y presiona <strong>Add Key</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/0*kt9_DgTLMbvFPg83.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*qxQWRQmJPc2jql5e.png" /></figure><p>Una vez que la clave SSH se haya añadido en GitLab, vuelve a intentar el comando:</p><pre>git push --set-upstream origin main</pre><p>Recarga el contenido de tu repositorio en GitLab y verifica tu primer <strong>commit</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*7LrXXdbYapqSbw_F.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40cde9c185f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configurer une clé SSH pour GitLab sur une machine virtuelle Linux avec un utilisateur dédié.]]></title>
            <link>https://medium.com/@man9r3/configurer-une-cl%C3%A9-ssh-pour-gitlab-sur-une-machine-virtuelle-linux-avec-un-utilisateur-d%C3%A9di%C3%A9-c9c7383feea1?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9c7383feea1</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Mon, 22 Jan 2024 12:23:18 GMT</pubDate>
            <atom:updated>2024-01-22T12:23:18.106Z</atom:updated>
            <content:encoded><![CDATA[<p>Notre souhait est de pousser nos développements qui se trouvent dans une machine virtuelle Linux, vers un dépôt GitLab nommé MyPUF, lui-même dedans le groupe METROLOGIE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*VuF22mvOXTv0tyY1bpsxhg.png" /></figure><p>Une fois connecté avec votre utilisateur sur la machine virtuelle linux, localisez le dossier qui contient vos développements, exemple :</p><p><strong>[miguel@mv MyPuf_Dev]</strong></p><p>Du fait que le dépôt GitLab est vide, nous allons suivre les instructions de GitLab pour pousser nos développements. Entrez chacun des commandes suivantes et voyons les possibles erreurs :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*7YC4lmmcTnvfr0hacR50kQ.png" /></figure><p><strong>Premier erreur possible : Au moment d’initialiser le dépôt git sur la MV.</strong></p><pre>[migueln@mv MyPuf_Dev]$ git init - initial-branch=main<br>/home/migueln/MyPuf_Dev/.git: Permission non accordée</pre><p>Assurez-vous de bien être sur votre utilisateur et que vous êtes bien le propriétaire de ce dossier :</p><p>Pour vérifier entrez la commande <strong>ls -l,</strong> votre nom d’utilisateur doit figurer en tant que propriétaire du dossier :</p><p><strong>[migueln@mv MyPuf_Dev]$ ls -l</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*FU3dz0R5g-KDUrwTdWDXbA.png" /></figure><p>Dans le cas contraire, par exemple si c’est <strong>root</strong> le propriétaire du dossier, vous pouvez soit recréer le dossier en tant que votre utilisateur, soit donner les droits du dossier à votre utilisateur en utilisant la commande <strong>chmod </strong>.</p><p>Ayant fait les modifications nécessaires, réessayez la commande :</p><pre>[migueln@mv MyPuf_Dev]$ git init - initial-branch=main<br>Dépôt Git vide initialisé dans /home/migueln/MyPuf_Dev/.git/</pre><p>La commande suivante nous permettre d’ajouter l’adresse du dépôt GitLab distant:</p><pre>[migueln@mv MyPuf_Dev]$ git remote add origin git@gitlab.xxx.xxx:metrologie/mypuf.git</pre><p>Ensuite, nous allons indexer les changements grâce à la commande <strong>git add .</strong></p><pre>[migueln@mv MyPuf_Dev]$ git add .</pre><p><strong>Deuxième erreur possible :</strong></p><pre>[migueln@mv MyPuf_Dev]$ git commit -m &quot;Initial commit&quot;<br>Identité d&#39;auteur inconnue<br>*** Veuillez me dire qui vous êtes.<br>Lancez<br>  git config --global user.email &quot;Vous@exemple.com&quot;<br>  git config --global user.name &quot;Votre Nom&quot;<br>fatal : nom d&#39;identifiant vide (pour &lt;migueln@mv.xxx.xxx.xxx&gt;) non permis</pre><p>Pour surmonter cet obstacle, nous allons définir les paramètres <strong>user.name</strong> et <strong>user.email, c</strong>es paramètres permettent à Git de savoir qui est la personne qui fait des changements sur une projet.</p><pre>[migueln@mv MyPuf_Dev]$ git config --global user.email miguel.narvaez@xxx.xxx<br>[migueln@mv MyPuf_Dev]$ git config --global user.name Miguel<br>[migueln@mv MyPuf_Dev]$ git commit -m &quot;Initial commit&quot;</pre><p>Maintenant, nous allons pousser les changements sur notre dépôt GitLab distante :</p><pre>[migueln@mv MyPuf_Dev]$ git push --set-upstream origin main<br>The authenticity of host &#39;gitlab.xxx.xxx (99.999.999.999)&#39; can&#39;t be established.<br>ED99999 key fingerprint is XXX123:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.</pre><p>Cette erreur est normal, répondez oui à la question posée et tapez Entré deux fois.</p><p>Comme est la première fois que nous nous connectons à ce dépôt GitLab depuis cette machine virtuel, nous devons <strong>générer une clé SSH</strong>, pour cela la commande <strong>ssh-keygen</strong>.</p><pre>[migueln@falx MyPuf_Dev]$ ssh-keygen<br>Generating public/private rsa key pair.<br>Enter file in which to save the key (/home/migueln/.ssh/id_rsa):</pre><p>Voilà, la clé SSH est générée :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*-zexNyWG025lxF3dzhNBtQ.png" /></figure><p>Une dossier <strong>.ssh </strong>a été créé :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*Tm87sKcurMD836j8IUDa7Q.png" /></figure><p><strong>id_rsa.pub</strong> : Il s’agit de la clé publique associée à votre clé privée id_rsa. La clé publique est partagée et utilisée pour vérifier les signatures ou pour chiffrer des messages qui ne pourront être déchiffrés qu’avec la clé privée correspondante.</p><p><strong>id_rsa</strong> : C’est votre clé privée. C’est une clé secrète que vous ne devez jamais partager. Elle est utilisée pour déchiffrer les messages chiffrés avec la clé publique correspondante. Gardez cette clé en sécurité et ne la partagez qu’avec des personnes de confiance.</p><p>Ensuite nous allons ajouter la clé SSH directement dedans GitLab, mais avant ouvrez le contenu du fichier <strong>id_rsa.pub, </strong>et modifiez l’adresse email pour celle que vous utilisez pour se connecter à votre compte GitLab.</p><p>Ensuite copiez le contenu du ficher <strong>rsa.pub</strong> (clé SSH) et revenons sur <strong>GitLab</strong>, click en <strong>Preferences -&gt; SSH Keys</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*T1a0SClQlJ8kDWpa0Gw12Q.png" /></figure><p>Ensuite nous allons enregistrer la clé SSH, click sur <strong>Add new key, </strong>collez la clé SSH, définissez une Titre parlant pour vous et appuyez sur <strong>Add Key.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*CZOrQhXbL1pTgMh_UjXBrw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*oIqIxsoweKODAsbG9oSOnQ.png" /></figure><p>Une fois la clé SSH ajoutée dans GitLab, ressayez la commande :</p><pre>git push --set-upstream origin main</pre><p>Rechargez le contenu de votre dépôt GitLab et voyez votre première commit :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*vr0N3690oPsr3r0tJxZGWQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9c7383feea1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Load Spatial Data into PostgreSQL Database with QGIS]]></title>
            <link>https://medium.com/@man9r3/load-spatial-data-into-postgresql-database-with-qgis-8927eb362ca5?source=rss-91b8a2fe4597------2</link>
            <guid isPermaLink="false">https://medium.com/p/8927eb362ca5</guid>
            <category><![CDATA[postgis]]></category>
            <category><![CDATA[geomatics]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[qgis]]></category>
            <dc:creator><![CDATA[Miguel Narvaez]]></dc:creator>
            <pubDate>Sun, 14 Jan 2024 20:21:00 GMT</pubDate>
            <atom:updated>2025-03-05T17:50:10.667Z</atom:updated>
            <content:encoded><![CDATA[<h3>Load Spatial Data to PostgreSQL Database with QGIS</h3><p><em>Before proceeding ensure you have the necessary permissions to load the table into the PostgreSQL Database.</em></p><p>Opting for QGIS to load spatial layers into PostgreSQL provides a user-friendly interface, offering a seamless and intuitive experience compared to the command-line tool <a href="http://www.bostongis.com/pgsql2shp_shp2pgsql_quickguide_20.bqg"><em>shp2pgsql</em></a>.</p><ol><li>Start by connecting QGIS to the PostgreSQL database:<br><strong>Layer -&gt; Add Layer -&gt; Add PostGIS Layers</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*IyGuGygUUUFrRKHkyrOq4Q.png" /></figure><p>2. Enter the connection details for the existing PostgreSQL database. Test the connections to ensure it’s working and then connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*13ygCL2cI4jkSZ3Lg8aYrg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/323/1*KMxUV-eez2jsDeycV5yeXw.png" /></figure><p>3. Now, load the shapefile or any other geospatial data into the QGIS canvas.</p><p>4. In the menu toolbar click on <em>Database</em> -&gt; <em>DB Manager.</em></p><p>Within the <em>Database Manager </em>window<em> </em>select the database and schema where you intend to load the table, For example, I’ll load the table to the <em>IGN_ADMIN_EXPRESS_2023</em> schema:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*TfwHE7Hjzi_IZgzO-R82fQ.png" /></figure><p>Next, in the toolbar menu, click on “Import layer/File”. The parameter input interface will appear, allowing you to select the table you want to load, the schema, the table name, and define table properties such as setting a primary key. You can also specify the approach if the table already exists in the database.</p><p>If the loading was successful, the table appears within the schema, and don’t forget to check in <a href="https://www.pgadmin.org/"><em>pgAdmin</em></a> also.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UVOG9PeCPnZUQWqa9BJe4A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8927eb362ca5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>