<div dir="ltr">No sé si ha sonado muy borde mi respuesta pero no era la intención. Era un recordatorio para evitar malas costumbres. Pensaba que mi " ;) " final suavizaba el tono pero me han dicho por aquí atrás que había sonado como un gruñón.</div><div class="gmail_extra"><br><div class="gmail_quote">El 24 de febrero de 2015, 18:01, Luis Franco Vázquez <span dir="ltr"><<a href="mailto:luis.frvz@gmail.com" target="_blank">luis.frvz@gmail.com</a>></span> escribió:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">No sé qué estás empleando para insertar desde QGIS pero lo que te está diciendo es que en la geometría no tienes un punto. ¿Qué proceso estás siguiendo?. <div>Y de paso te voy a dar un ligero tirón de orejas: en las listas no debes escribir correos como este último. No los dirijas a mi ni a nadie salvo para seguir un hilo. Si te surge una duda o problema exponlo a todos. En mi caso colaboro siempre que puedo pero el asesoramiento personalizado lo cobro porque profesionalmente me dedico a esto. Y cuando se trate de un problema, por cortesía asegúrate de haber buscado en internet o donde sea la respuesta antes de preguntar. ;) </div></div><div class="gmail_extra"><br><div class="gmail_quote">El 24 de febrero de 2015, 16:58, Mikel <span dir="ltr"><<a href="mailto:m.ayesta@gislan.com" target="_blank">m.ayesta@gislan.com</a>></span> escribió:<div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Hola Luis,<br>
      <br>
      Tengo otro problema con otra tabla. En este caso, lo que quiero
      hacer es que al introducir manualmente el punto desde QGIS, me
      rellene las coordenadas x, y, longitud y latitud. La tabla está en
      srid 25830 y al introducir el punto en QGIS, me da el siguinete
      error: Argument to X() must be a point.<br>
      <br>
      Gracias de antemano.<br>
      <br>
      El código es el siguiente:<br>
      <br>
      CREATE OR REPLACE FUNCTION public.errepide_intz_koord()<span><br>
        RETURNS trigger AS<br>
      $BODY$<br>
          DECLARE<br>
          <br>
          BEGIN<br>
          <br></span>
          NEW.x:=ST_X(NEW.geom);<br>
          NEW.y:=ST_Y(NEW.geom);<br>
          NEW.lon:=ST_X(ST_Transform(NEW.geom, 4326));<br>
          NEW.lat:=ST_Y(ST_Transform(NEW.geom, 4326));<span><br>
         <br>
          RETURN NEW;<br>
          END;<br>
      $BODY$<br>
        LANGUAGE plpgsql VOLATILE<br>
        COST 100;<br></span>
      ALTER FUNCTION public.errepide_intz_koord()<br>
        OWNER TO postgres;<br>
      <br>
      <br>
      <div><br>
        <p>
        </p>
        <br>
      </div>
      2015/02/24 15:19(e)an, Mikel igorleak idatzi zuen:<br>
    </div><div><div>
    <blockquote type="cite">
      
      <div>Hola Luis,<br>
        <br>
        Gracias! Funciona perfectamente.<br>
        <br>
        Mikel<br>
        <br>
        2015/02/24 14:01(e)an, Luis Franco Vázquez igorleak idatzi zuen:<br>
      </div>
      <blockquote type="cite">
        <div dir="ltr">Pues es muy simple. Suponiendo que tus nuevos
          campos x e y se llaman x_25830 e y_25830 (adáptalos a tu
          gusto), solo tienes que añadir dos líneas y reemplazar la
          función ejecutando lo que sigue:
          <div><span style="color:rgb(0,0,0);font-size:12.8000001907349px">CREATE

              OR REPLACE FUNCTION errepide_intz()</span><br style="color:rgb(0,0,0);font-size:12.8000001907349px">
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px"> 
              RETURNS trigger AS</span><br style="color:rgb(0,0,0);font-size:12.8000001907349px">
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px">$BODY$</span><br style="color:rgb(0,0,0);font-size:12.8000001907349px">
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px">   

              DECLARE</span><br style="color:rgb(0,0,0);font-size:12.8000001907349px">
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px">   

              BEGIN</span><br style="color:rgb(0,0,0);font-size:12.8000001907349px">
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px">NEW.geom:=ST_transform(ST_</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">SetSRID(ST_MakePoint(NEW.lon,</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">NEW.lat),4326),25830);</span></div>
          <div>NEW.x_25830 := ST_X(NEW.geom);</div>
          <div>NEW.y_25830 := ST_Y(NEW.geom);<br>
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px">   

              RETURN NEW;</span><br style="color:rgb(0,0,0);font-size:12.8000001907349px">
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px">   

              END;</span><br style="color:rgb(0,0,0);font-size:12.8000001907349px">
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px">$BODY$</span><br style="color:rgb(0,0,0);font-size:12.8000001907349px">
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px"> 
              LANGUAGE plpgsql VOLATILE</span><br style="color:rgb(0,0,0);font-size:12.8000001907349px">
            <span style="color:rgb(0,0,0);font-size:12.8000001907349px"> 
              COST 100;</span><br>
          </div>
          <div><br>
          </div>
          <div>Prueba y cuentas. Deberías echarle un vistazo al manual
            de postgresql.</div>
          <div>Si quieres actualizar los registros que ya tienes haces:</div>
          <div>UPDATE tu_tabla SET x_25830 = ST_X(geom), y_25830 =
            ST_Y(geom);</div>
          <div><br>
          </div>
          <div>Muy simple, la verdad.</div>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">El 24 de febrero de 2015, 13:47,
            Mikel <span dir="ltr"><<a href="mailto:m.ayesta@gislan.com" target="_blank">m.ayesta@gislan.com</a>></span>
            escribió:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000">
                <div>Hola Luis,<br>
                  <br>
                  Aquí te pego la función.<br>
                  <br>
                  CREATE OR REPLACE FUNCTION errepide_intz()<br>
                    RETURNS trigger AS<br>
                  $BODY$<br>
                      DECLARE<br>
                      BEGIN<br>
NEW.geom:=ST_transform(ST_SetSRID(ST_MakePoint(NEW.lon,NEW.lat),4326),25830);<br>
                      RETURN NEW;<br>
                      END;<br>
                  $BODY$<br>
                    LANGUAGE plpgsql VOLATILE<br>
                    COST 100;<br>
                  ALTER FUNCTION errepide_intz()<br>
                    OWNER TO postgres;<br>
                  <br>
                  Gracias de antemano,<br>
                  <br>
                  Mikel<br>
                  <div><br>
                    <p> </p>
                    <br>
                  </div>
                  2015/02/24 13:44(e)an, Luis Franco Vázquez igorleak
                  idatzi zuen:<br>
                </div>
                <div>
                  <div>
                    <blockquote type="cite">
                      <div dir="ltr">Vale. Ahora lo he entendido.
                        <div>Si me pegas aquí la función disparadora que
                          ya tienes te digo como hacerlo. </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                      </div>
                      <div class="gmail_extra"><br>
                        <div class="gmail_quote">El 24 de febrero de
                          2015, 13:19, Mikel <span dir="ltr"><<a href="mailto:m.ayesta@gislan.com" target="_blank">m.ayesta@gislan.com</a>></span>
                          escribió:<br>
                          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                            <div bgcolor="#FFFFFF" text="#000000">
                              <div><br>
                                <div>Hola Luis,<br>
                                  El disparador lo que hace es crear el
                                  punto en el sistema de referencia
                                  25830 partiendo de las coordenadas
                                  geográficas que introduzco en el
                                  sistema 4326. Lo que necesito es que
                                  me rellene los campos X e Y en el
                                  sistema 25830 de manera automática.<br>
                                  <br>
                                  He intentando poner por defecto en el
                                  campo X el valor ST_X (geom) pero me
                                  da error...<br>
                                  <br>
                                  Gracias.<br>
                                  <p> </p>
                                  <br>
                                </div>
                                2015/02/24 12:29(e)an, Luis Franco
                                Vázquez igorleak idatzi zuen:<br>
                              </div>
                              <div>
                                <div>
                                  <blockquote type="cite">
                                    <div dir="ltr">Disculpa, no te he
                                      entendido. ¿Ya tienes un
                                      disparador que crea el punto y
                                      quieres obtener las coordenadas
                                      que tú mismo estás introduciendo?.
                                      Tengo que haberlo entendido muy
                                      mal. ¿O es que estás introduciendo
                                      coordenadas en un sistema de
                                      referencia distinto al 25830 (por
                                      ejemplo epsg 4326) y lo que hace
                                      tu disparador es rellenar un
                                      atributo de tipo punto con srid
                                      25830 a partir de un par x, y en
                                      otro sistema de referencias?. Si
                                      me das más datos puedo concretar
                                      algo.
                                      <div>En general: postgis no tiene
                                        disparadores. Quien los tiene es
                                        postgresql. Postgis es una
                                        extensión espacial de
                                        postgresql, por lo tanto debes
                                        consultar la documentación de
                                        postgresql.</div>
                                      <div>Y sobre como obtener
                                        coordenadas x e y, mira <a href="http://postgis.net/docs/manual-2.1/ST_X.html" target="_blank">http://postgis.net/docs/manual-2.1/ST_X.html</a>
                                        y  <a href="http://postgis.net/docs/manual-2.1/ST_Y.html" target="_blank">http://postgis.net/docs/manual-2.1/ST_Y.html</a></div>
                                    </div>
                                    <div class="gmail_extra"><br>
                                      <div class="gmail_quote">El 24 de
                                        febrero de 2015, 11:56, Mikel <span dir="ltr"><<a href="mailto:m.ayesta@gislan.com" target="_blank">m.ayesta@gislan.com</a>></span>
                                        escribió:<br>
                                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                          <div bgcolor="#FFFFFF" text="#000000">
                                            <div>Hola a tod@s,<br>
                                              <br>
                                              Tengo una duda con
                                              PostGIS. ¿Hay alguna
                                              manera de que se rellenen
                                              automáticamente dos campos
                                              de la tabla con las
                                              coordenadas del elemento
                                              introducido?<br>
                                              <br>
                                              Me explico. Tengo una
                                              tabla en la que introduzco
                                              los puntos con coordenadas
                                              geográficas y mediante un
                                              disparador, me situa el
                                              punto en las coordenadas
                                              introducidas. El sistema
                                              de referencia es EPSG:
                                              25830, por lo que en el
                                              disparador realizo la
                                              transformación de
                                              coordenadas. La cuestión
                                              es que necesito que se me
                                              rellenen los campos X e Y
                                              de forma automática. ¿Hay
                                              algún valor por defecto
                                              que se puede introducir
                                              (como en el caso de la
                                              fecha, now()), o por el
                                              contrario hay que
                                              programar algún
                                              disparador? y si es la
                                              segunda opción, ¿cómo?<br>
                                              <br>
                                              Gracias de antemano.<br>
                                              <br>
                                              Un cordial saludo, <br>
                                              <div>
                                                <table>
                                                  <tbody>
                                                    <tr>
                                                      <td><a href="http://www.gislan.com" target="_blank"><img src="cid:part6.07020201.06020109@gislan.com"></a></td>
                                                      <td><a href="http://www.gislan.com/node/107" target="_blank"><img src="cid:part8.06000004.07020703@gislan.com"></a></td>
                                                    </tr>
                                                    <tr>
                                                      <td colspan="2"><b><font color="blue">Mikel

                                                          Ayestaran
                                                          Olano</font></b><br>
                                                        GISLAN
                                                        GEOGRAPHIC
                                                        APPLICATIONS S.L<br>
                                                        <font color="blue"><a href="mailto:m.ayesta@gislan.com" target="_blank">m.ayesta@gislan.com</a></font><br>
                                                        Tel.: 0034 943
                                                        304 255<br>
                                                        <a href="http://www.gislan.com" target="_blank">www.gislan.com</a><br>
                                                      </td>
                                                    </tr>
                                                  </tbody>
                                                </table>
                                                <p> </p>
                                                <table border="1">
                                                  <tbody>
                                                    <tr>
                                                      <td><font size="1"><strong>Lege


                                                          oharra:</strong>
                                                          Mezu
                                                          elektroniko
                                                          honetan, eta,
                                                          hala
                                                          badagokio,
                                                          bere fitxategi
                                                          erantsietan,
                                                          hartzaileari
                                                          soilik
                                                          zuzendutako
                                                          isilpeko
                                                          informazioa
                                                          dago.
                                                          Debekatuta
                                                          dago
                                                          informazio
                                                          hori zabaldu,
                                                          kopiatu eta
                                                          beste
                                                          pertsonen
                                                          artean
                                                          banatzea,
                                                          Gaindegiaren
                                                          baimen
                                                          idatzirik
                                                          gabe. Akatsen
                                                          batengatik
                                                          mezu hau jaso
                                                          baduzu,
                                                          jakinarazi
                                                          mesedez, mezua
                                                          igorlearen
                                                          helbidera
                                                          birbidaliz.
                                                          DBLOn
                                                          ezarritakoaren
                                                          arabera,
                                                          Gaindegiak
                                                          datu
                                                          pertsonalen
                                                          isilpeko
                                                          tratamendua
                                                          bermatzeko
                                                          beharrezko
                                                          neurriak
                                                          hartzen ditu.
                                                          Halaber, zure
                                                          datuak
                                                          fitxategi
                                                          batean daudela
                                                          jakinarazi
                                                          nahi dizugu,
                                                          zure harremana
                                                          mantentzeko.
                                                          Eskubidea
                                                          daukazu datuok
                                                          begiratu,
                                                          zuzendu,
                                                          ezabatu eta
                                                          aurka egiteko,
                                                          helbide
                                                          honetan:
                                                          Martin Ugalde
                                                          Kultur Parkea,
                                                          20140 Andoain.</font>
                                                      </td>
                                                    </tr>
                                                    <tr>
                                                      <td><font size="1"><strong>Nota:</strong>
                                                          "Este correo
                                                          electrónico y,
                                                          en su caso,
                                                          cualquier
                                                          fichero anexo
                                                          al mismo,
                                                          contiene
                                                          información de
                                                          carácter
                                                          confidencial
                                                          exclusivamente
                                                          dirigida a su
                                                          destinatario.
                                                          Queda
                                                          prohibida su
                                                          divulgación,
                                                          copia o
                                                          distribución a
                                                          terceros sin
                                                          la previa
                                                          autorización
                                                          escrita de
                                                          Gaindegia. En
                                                          el caso de
                                                          haber recibido
                                                          este correo
                                                          electrónico
                                                          por error, se
                                                          ruega
                                                          notifíquese
                                                          inmediatamente
                                                          esta
                                                          circunstancia
                                                          mediante
                                                          reenvío a la
                                                          dirección
                                                          electrónica
                                                          del remitente.
                                                          De conformidad
                                                          con lo
                                                          establecido en
                                                          la LOPD
                                                          Gaindegia
                                                          garantiza la
                                                          adopción de
                                                          las medidas
                                                          necesarias
                                                          para asegurar
                                                          el tratamiento
                                                          confidencial
                                                          de los datos
                                                          de carácter
                                                          personal. Así
                                                          mismo le
                                                          informamos de
                                                          inclusión de
                                                          sus datos en
                                                          un fichero con
                                                          la finalidad
                                                          de mantener su
                                                          relación con
                                                          Gaindegia y de
                                                          la posibilidad
                                                          de ejercer los
                                                          derechos de
                                                          acceso,
                                                          rectificación,
                                                          cancelación y
                                                          oposición en
                                                          la siguiente
                                                          dirección:
                                                          Martin Ugalde
                                                          Kultur Parkea,
                                                          20140
                                                          Andoain.”</font>
                                                      </td>
                                                    </tr>
                                                  </tbody>
                                                </table>
                                              </div>
                                              <br>
                                            </div>
                                          </div>
                                          <br>
_______________________________________________<br>
                                          Spanish mailing list<br>
                                          <a href="http://lists.osgeo.org/mailman/listinfo/spanish" target="_blank">http://lists.osgeo.org/mailman/listinfo/spanish</a><br>
                                          <a href="http://es.osgeo.org" target="_blank">http://es.osgeo.org</a><br>
                                          <a href="http://twitter.com/osgeoes" target="_blank">http://twitter.com/osgeoes</a><br>
                                        </blockquote>
                                      </div>
                                      <br>
                                    </div>
                                    <br>
                                    <fieldset></fieldset>
                                    <br>
                                    <pre>_______________________________________________
Spanish mailing list
<a href="http://lists.osgeo.org/mailman/listinfo/spanish" target="_blank">http://lists.osgeo.org/mailman/listinfo/spanish</a>
<a href="http://es.osgeo.org" target="_blank">http://es.osgeo.org</a>
<a href="http://twitter.com/osgeoes" target="_blank">http://twitter.com/osgeoes</a></pre>
                                  </blockquote>
                                  <br>
                                </div>
                              </div>
                            </div>
                            <br>
_______________________________________________<br>
                            Spanish mailing list<br>
                            <a href="http://lists.osgeo.org/mailman/listinfo/spanish" target="_blank">http://lists.osgeo.org/mailman/listinfo/spanish</a><br>
                            <a href="http://es.osgeo.org" target="_blank">http://es.osgeo.org</a><br>
                            <a href="http://twitter.com/osgeoes" target="_blank">http://twitter.com/osgeoes</a><br>
                          </blockquote>
                        </div>
                        <br>
                      </div>
                      <br>
                      <fieldset></fieldset>
                      <br>
                      <pre>_______________________________________________
Spanish mailing list
<a href="http://lists.osgeo.org/mailman/listinfo/spanish" target="_blank">http://lists.osgeo.org/mailman/listinfo/spanish</a>
<a href="http://es.osgeo.org" target="_blank">http://es.osgeo.org</a>
<a href="http://twitter.com/osgeoes" target="_blank">http://twitter.com/osgeoes</a></pre>
                    </blockquote>
                    <br>
                  </div>
                </div>
              </div>
              <br>
              _______________________________________________<br>
              Spanish mailing list<br>
              <a href="http://lists.osgeo.org/mailman/listinfo/spanish" target="_blank">http://lists.osgeo.org/mailman/listinfo/spanish</a><br>
              <a href="http://es.osgeo.org" target="_blank">http://es.osgeo.org</a><br>
              <a href="http://twitter.com/osgeoes" target="_blank">http://twitter.com/osgeoes</a><br>
            </blockquote>
          </div>
          <br>
        </div>
        <br>
        <fieldset></fieldset>
        <br>
        <pre>_______________________________________________
Spanish mailing list
<a href="http://lists.osgeo.org/mailman/listinfo/spanish" target="_blank">http://lists.osgeo.org/mailman/listinfo/spanish</a>
<a href="http://es.osgeo.org" target="_blank">http://es.osgeo.org</a>
<a href="http://twitter.com/osgeoes" target="_blank">http://twitter.com/osgeoes</a></pre>
      </blockquote>
      <br>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Spanish mailing list
<a href="http://lists.osgeo.org/mailman/listinfo/spanish" target="_blank">http://lists.osgeo.org/mailman/listinfo/spanish</a>
<a href="http://es.osgeo.org" target="_blank">http://es.osgeo.org</a>
<a href="http://twitter.com/osgeoes" target="_blank">http://twitter.com/osgeoes</a></pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
Spanish mailing list<br>
<a href="http://lists.osgeo.org/mailman/listinfo/spanish" target="_blank">http://lists.osgeo.org/mailman/listinfo/spanish</a><br>
<a href="http://es.osgeo.org" target="_blank">http://es.osgeo.org</a><br>
<a href="http://twitter.com/osgeoes" target="_blank">http://twitter.com/osgeoes</a><br></blockquote></div></div></div><br></div>
</blockquote></div><br></div>