Navit SVN
Functions

Coordinate handling functions

Functions

struct coordcoord_get (unsigned char **p)
struct coordcoord_new (int x, int y)
struct coordcoord_new_from_attrs (struct attr *parent, struct attr **attrs)
void coord_destroy (struct coord *c)
struct coord_rectcoord_rect_new (struct coord *lu, struct coord *rl)
void coord_rect_destroy (struct coord_rect *r)
int coord_rect_overlap (struct coord_rect *r1, struct coord_rect *r2)
int coord_rect_contains (struct coord_rect *r, struct coord *c)
void coord_rect_extend (struct coord_rect *r, struct coord *c)
int coord_parse (const char *c_str, enum projection pro, struct coord *c_ret)
int pcoord_parse (const char *c_str, enum projection pro, struct pcoord *pc_ret)
void coord_print (enum projection pro, struct coord *c, FILE *out)
void coord_format (float lat, float lng, enum coord_format fmt, char *buffer, int size)
 Converts a lat/lon into a text formatted text string.
unsigned int coord_hash (const void *key)
int coord_equal (const void *a, const void *b)

Detailed Description

Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


Function Documentation

void coord_format ( float  lat,
float  lng,
enum coord_format  fmt,
char *  buffer,
int  size 
)

Converts a lat/lon into a text formatted text string.

Parameters:
latThe latitude (if lat is 360 or greater, the latitude will be omitted)
lngThe longitude (if lng is 360 or greater, the longitude will be omitted)
fmtThe format to use.

  • DEGREES_DECIMAL=>Degrees with decimal places, i.e. 20.5000°N 110.5000°E
  • DEGREES_MINUTES=>Degrees and minutes, i.e. 20°30.00'N 110°30.00'E
  • DEGREES_MINUTES_SECONDS=>Degrees, minutes and seconds, i.e. 20°30'30.00"N 110°30'30"E
bufferA buffer large enough to hold the output + a terminating NULL (up to 31 bytes)
sizeThe size of the buffer
struct coord * coord_get ( unsigned char **  p) [read]

Get a coordinate

Parameters:
pPointer to the coordinate
Returns:
the coordinate
int coord_parse ( const char *  c_str,
enum projection  pro,
struct coord c_ret 
)

Parses char *c_str and writes back the coordinates to coord *c_ret. Uses projection pro if no projection is given in char *c_str. The format for *c_str can be:

  • [Proj:]-0xX [-]0xX
    • where Proj can be mg/garmin, defaults to mg
  • [Proj:][D][D]Dmm.ss[S][S] N/S [D][D]DMM.ss[S][S]... E/W
  • [Proj:][-][D]D.d[d]... [-][D][D]D.d[d]
    • where Proj can be geo
Parameters:
*c_strString to be parsed
proProjection of the string
*pc_retWhere the pcoord should get stored
Returns:
The lenght of the parsed string

References coord_geo::lat, coord_geo::lng, x, and y.

Referenced by pcoord_parse().

int pcoord_parse ( const char *  c_str,
enum projection  pro,
struct pcoord pc_ret 
)

A wrapper for pcoord_parse that also return the projection

Parameters:
*c_strString to be parsed
proProjection of the string
*pc_retWhere the pcoord should get stored
Returns:
The lenght of the parsed string

References coord_parse(), x, pcoord::x, y, and pcoord::y.