0

I am getting NMEA output (WGS84) from my GPS and would like to put that into Postgis table.

Format of the coordinate is 3267.56N 02575.92W.

Is there way to insert that coord in db ?

1 Answer 1

2

The cordinates are referenced by WSG84, so you dont have to reproject them, but the given coordinates are not encoded in the correct Format.

In Postgis points are defined as:

geometry ST_Point(float x_lon, float y_lat);

That means, you have to use floating-point values as lat and lon parameters.

NMEA ccordinates are defined as:

Latitude: XXYY.ZZZZ[I_Lat]

and:

Longitude: XXXYY.ZZZZ[I_Lon]

Where X, Y and Z are given as:

XX°YY'(0.ZZZZ * 60)"

You have to convert Y and Z from a degree-notation to a floating-point based notation. Furthermore I_Lon and I_Lat are indicators for the direction of the coordiates. In Postgis (with default WSG84-Projection) the directions are always given as Lat: N and Lon: W. So... if you have an 'S'-Direction as your latitude-indicator, you will have to convert this particular coordinate to a 'N'-direction coordinate (pointing Northwards). Longitudinal directions should be treated equivalently.

A quick google search revealed the following python-script: nmea_to_pgis.py. Maybe that will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.