[postgis-users] Help with Geography's Coordinates

Chris Hermansen chris.hermansen at timberline.ca
Thu Nov 15 17:49:13 PST 2007


Hola Marco;

Podrías utilizar PostGIS para este tipo de transformación - es fácil si
tienes una instalación de PostGIS :-).  Por ejemplo para realizar una
relación "mispuntos" podriás hacer:

CREATE TABLE mispuntos (numero serial);
SELECT
addGeometryColumn('public','mispuntos','la_geometria',4326,'POINT',2);

INSERT INTO mispuntos (la_geometria)
VALUES (st_geomFromText('POINT(-75.2 33.4)',4326));

-- En este caso, -75.2 33.4 son longitud y latitud (longitud < 0 porque
está al oeste de Greenwich)
-- 4326 es la SRID (spatial reference system ID) para WGS84 latitud/longitud

CREATE TABLE mispuntos_utm AS
SELECT numero,st_transform(la_geometria,26914) AS la_geometria
FROM mispuntos;

-- st_transform(la_geometria,26914) transforma latitud/longitud en UTM
NAD83 zona 14

SELECT numero,st_asText(la_geometria) FROM mispuntos_utm;
 numero |                st_astext               
--------+-----------------------------------------
      1 | POINT(2737687.9943978 3960731.40880767)

Evidamente -75.2 33.4 no está en la zona 14 :-)

Hay más información sobre este tema a http://postgis.refractions.net/docs/

Necesitas la SRID de tu proyección final.  Podrías buscarla por nombre
en la relación "spatial_ref_sys" como p.e.

SELECT * FROM spatial_ref_sys WHERE srtext LIKE '%WGS%84%';

Marco Aurelio (Skull Leader) wrote:
> Hola Chris:
>
> Mira lo que tengo son Coordenadas Geoespaciales de la Tierra, estan en
> Longitud y Latitud, el problema radica en que lo que hice para poder
> graficar fue triangular con 2 puntos mas tomando en cuenta X, Y y Z.
>
> La transformacion la hago de la siguiente manera:
>
> float D1_X=RadioTerrestre*sin(Latitud)*cos(Longitud);
> float D1_Y=RadioTerrestre*sin(Latitud)*sin(Longitud);
> float D1_Z=RadioTerrestre*cos(Latitud);
>
> El problema es que la imagen me sale volveada (te adjunto un archivo
> en svg con las coordenadas como me salen), la pregunta es la
> siguiente, postgis maneja alguna funcion, o hay alguna forma de poder
> hacer la conversion desde la consulta?
>
> Lei que lo que he conseguido es la formal normal de la proyeccion de
> Azimutal, el problema radica en que deberia de voltear 90°, pero no he
> conseguido manejar matrices de rotacion, me podrias orientar?
>
> Gracias
>  
>
> Ingeniero en Sistemas Computacionales *Marco Aurelio Sotelo Figueroa*
>
> (/The Skull Leader/)
>
>
>
> ----- Mensaje original ----
> De: Chris Hermansen <chris.hermansen at timberline.ca>
> Para: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
> Enviado: jueves, 15 de noviembre, 2007 0:11:27
> Asunto: Re: [postgis-users] Help with Geography's Coordinates
>
> Estimado Marco;
>
> You may be able to use ogr2ogr to convert from your longitude and
> latitude into some type of projected coordinate system like UTM.
>
> What exactly does your data look like?  Is it ASCII points, or...?
>
> I find the documentation for ogr2ogr to be a bit challenging.  You will
> need to read it carefully and you will also need a basic understanding
> of spatial data formats and geographic projections.
>
> Since this isn't really about PostGIS - I think :-) - if you want to
> write directly to me I can try to help you out a bit more, en inglés o
> castellano.
>
> Marco Aurelio (Skull Leader) wrote:
> > I have some Coordinates with Lenght and Latitude, but i have the
> > problem when i try to convert it in X and Y Coordinates, i want to
> > make a graph with SVG, someone know how i can do it?
> >
> > Thanks.
> >
> > Marco
> >
> > ------------------------------------------------------------------------
> >
> > ¡Capacidad ilimitada de almacenamiento en tu correo!
> > No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:
> > http://correo.yahoo.com.mx/
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> <mailto:postgis-users at postgis.refractions.net>
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> > 
>
>
> -- 
> Regards,
>
> Chris Hermansen · mailto:clh at timberline.ca <mailto:clh at timberline.ca>
> tel:+1.604.714.2878 · fax:+1.604.733.0631
> Timberline Natural Resource Group · http://www.timberline.ca
> 401 · 958 West 8th Avenue · Vancouver BC · Canada · V5Z 1E5
>
> C'est ma façon de parler.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> <mailto:postgis-users at postgis.refractions.net>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> ------------------------------------------------------------------------
>
> Comparte video en la ventana de tus mensajes (y también tus fotos de
> Flickr).
> Usa el nuevo Yahoo! Messenger versión Beta.
> Visita http://mx.beta.messenger.yahoo.com/
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 
Regards,

Chris Hermansen · mailto:clh at timberline.ca
tel:+1.604.714.2878 · fax:+1.604.733.0631
Timberline Natural Resource Group · http://www.timberline.ca
401 · 958 West 8th Avenue · Vancouver BC · Canada · V5Z 1E5

C'est ma façon de parler.




More information about the postgis-users mailing list