'43.005895','-71.013202'
Trying to use:
INSERT INTO table(fanDetLocZip, fanDetLocCity, fanDetLocState, fanDetLocLat, fanDetLocLong, fanDetLocTZ, fanDetLocDST)
VALUES(00210, 'Portsmouth', 'NH', '43.005895', '-71.013202', -5, 1);
I'm currently using the datatype SPATIAL
, GEOMETRY
.
Its giving me errors like:
Cannot get geometry object from data you send to the GEOMETRY field
All the values have 2 digits, and 6 decimal places after decimal. How do I store this in mysql?
Error I get when I use:INSERT INTO Table(fanDetLocZip, fanDetLocCity, fanDetLocState, fanDetLocLatLong, fanDetLocTZ, fanDetLocDST)
VALUES(00210, 'Portsmouth', 'NH', point(43.005895,-71.013202), -5,1)
Error Image:
Latitude and Longitude should use DECIMAL datatype instead of FLOAT #4923.
The latitude/longitude coordinates generated by the GPS are considered the standard for location data. Your device receives signals from the satellites and it can calculate where it is by measuring the time it takes for the signal to arrive.
latitude : 4-Byte Floating Point Number Specifies the geographic latitude of the location. longitude : 4-Byte Floating Point Number Specifies the geographic longitude of the location.
The prime meridian defines 0° longitude; by convention the International Reference Meridian for the Earth passes near the Royal Observatory in Greenwich, England on the island of Great Britain. Positive longitudes are east of the prime meridian, and negative ones are west.
You can use POINT()
to store into a column of type GEOMETRY
or POINT
:
POINT(43.005895, -71.013202)
If the Geometry column is named geom
, you can use this:
INSERT INTO table
( ..., geom, ...)
VALUES
( ..., POINT(43.005895, -71.013202), ...)
If you want to show data stored, you can use the X()
and Y()
functions:
SELECT X(geom) AS x, Y(geom) AS y
FROM table
Why dont you use instead a Float type for your lat/long?
Float (10,6)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With