mysql data type for storing latitude and longitude

Posted on 2005-05-10
Last Modified: 2010-08-05

Please can you tell me what you think would be the most suitable data type for storing latitude and longitude coordinates for the UK in a mysql database. The coordinates are in the form 50.12345 or -2.1234. I am unsure as to whether to use a numerical data type as i do not know how the coordinates behave and if they are true numbers in the sense of the word.

Question by:andieje
    LVL 13

    Accepted Solution

    I am not sure about the datatypes of mySQL but I personally always store Latitude and Longitude as Numeric datatype....

    In my MSAcess Tables I store Lat/Long as Data Type: Number  Field Size: Single
    In SQL Server I have Lat/Long as Data Type: Float   Length:8
    In Oracle I use Float(126)....

    and yes your Lat/Long will always remain Numeric (If you donot include the hemisphere info i.e N/S or E/W)


    Assisted Solution

    I agree with imarshad, and I should add that North is positive, South negative and E Positive, West negative normally and this fist into all the equations I use for Spherical/Cartesian plots as well.


    Expert Comment

    oh, one other thing the data type would be Float(10.6) for civil applications. Generally good enough resolution for most any civilian applications.


    Author Comment

    thank you both for your help. i tried to split the points even though there weren't many anyway :)

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    I feel like more and more people want to know how to programmatically convert addresses into geospatial locations. So in this article, I will show you how you can do it with Bing Maps. I'm going to use PowerShell, which is a nice scripting language,…
    Introduction This article is designed to assist GIS (Geographic Information System) and GPS (Global Positioning System) developers using ESRI ArcGIS and other spatial information management systems.   For the uninitiated the concept of projectio…
    This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
    This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now