Brent, <br><br>Thank you - We are using the Sql code you gave us and it is working good. We've managed to automate the Lat/long coordinates from an entering gprmc format email right to our Web-GIS service.<br><br><br>Our problem now, that we are dealing with, is the creation of a line from the inserted points. Do we really have to go back and use the linestring from text function? converting again the lat/long coordinates? Or do can we just use a Postgis function that "Connects the dots" from the postgis format (have a geom column) points that are already in the DB?
<br><br>Thanks again for th help guys!<br><br>Giuseppe<br><br><br> <br><br><div><span class="gmail_quote">On 4/12/07, <b class="gmail_sendername">Brent Wood</b> <<a href="mailto:pcreso@pcreso.com">pcreso@pcreso.com</a>
> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>--- Giuseppe Molinario <<a href="mailto:g.molinario@gmail.com">g.molinario@gmail.com
</a>> wrote:<br><br>You can use (I think) the proj binary to convert the dddmm.mmm to dd.dddd, but<br>it may be easier to use an SQL with the data in Postgis tables as numeric data.<br><br>The reformatting of ddmm.mmmm
to dd.ddddd is not technically reprojecting.<br><br>The following is one way to do this, by inserting your ddmmm.mmmm values, then<br>generating a point geometry from these with an update SQL.<br><br><br>ie, along the lines of:
<br><br># create your table...<br>create table coords<br> (id serial primary key,<br> x decimal(10,5),<br> y decinal(10,5))<br><br>load your XY data...<br>insert into coords values (default, 16778.8888, 4234.6667
);<br><br># add a geometry column to the table<br>select addgeometrycolumn('','coords','the_geom',4326,'POINT',2);<br><br>#populate the geometry column<br>update coords<br>set the_geom=geomfromtext('POINT('||floor(x/100)+((x/100-floor(x/100))/0.60)||'
<br>'||floor(y/100)+((y/100-floor(y/100))/0.60)||')',4326);<br><br>select id, x, y, astext(the_geom) from coords;<br> id | x | y | astext<br>----+-------------+------------+------------------------------------------
<br> 3 | 16778.88880 | 4234.66670 | POINT(168.314813333333 42.5777783333333)<br>(1 row)<br><br><br>note that floor as used above will not work with negative coords, but you can<br>still use a similar approach using strings, or ceil/int & a where clause for
<br>negative coords....<br><br>If you are comfortable writing a postgres function to do this conversion, that<br>is also possible.<br><br><br>Cheers,<br><br> Brent Wood<br><br>> Hi Mark,<br>><br>> Yes, that helps. I'll see if i missed the proj4 installation along the way,
<br>> or if, more probably i am simply feeding PostGIS lat/long data that is not<br>> in decimal degrees.<br>><br>> I'll let you know if it doesn't work.<br>><br>> Thanks,<br>><br>> Giuseppe
<br>><br>><br>><br>> On 4/11/07, Mark Cave-Ayland <<a href="mailto:mark.cave-ayland@ilande.co.uk">mark.cave-ayland@ilande.co.uk</a>> wrote:<br>> ><br>> > On Wed, 2007-04-11 at 13:58 +0200, Giuseppe Molinario wrote:
<br>> > > Hi everyone,<br>> ><br>> > Hi Guiseppe,<br>> ><br>> > > I have a question regarding the creation in PostGIS of a table that<br>> > > contains information coming from a NMEA GPRMC text string. I get
<br>> > > Lat/long coordinates which are then put into their respective columns.<br>> > > A geometry field is then created using the SRID # 4326 (WGS84 Datum -<br>> > > Geographic).<br>> > >
<br>> > > 1. What format of Lat/long coordinates does PostGIS accept? GPRMC has<br>> > > the coordinate in this format: ddmm.mmmmm.<br>> ><br>> > PostGIS accepts coordinates in decimal degrees.
<br>> ><br>> > > 2. How do I project the points into WGS84UTM33N? My final goal is to<br>> > > overlay these points as a PostGIS layer on a webmap (Mapserver based)<br>> > > over other data I have which is in that projection.
<br>> ><br>> > The transform() function should be able to do what you need here if you<br>> > use a version of PostGIS that has been compiled with the PROJ.4<br>> > reprojection library.<br>> >
<br>> > > 3. Do you know if Mapserver will re-project on the fly in my case?<br>> > > ever? or do I have to take care of this in PostGIS?<br>> ><br>> > Yes. Mapserver can also reproject layers on-the-fly using
PROJ.4. There<br>> > are plenty of examples on the Mapserver website at<br>> > <a href="http://mapserver.gis.umn.edu">http://mapserver.gis.umn.edu</a>.<br>> ><br>> ><br>> > HTH,<br>> ><br>
> > Mark.<br>> ><br>> ><br>> > _______________________________________________<br>> > postgis-users mailing list<br>> > <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net
</a><br>> > <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>> ><br>> > _______________________________________________
<br>> postgis-users mailing list<br>> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">
http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>><br><br></blockquote></div><br>