0
SELECT LATITUDE,
       LONGITUDE, 
       AsText(concat(LATITUDE,',' ,LONGITUDE)) AS point 
FROM incident_google

query is not working for AsText

it showing result as NULL.

how to get the astext values.

if the problem is on concat or AStext.

i need result for this query.

now result as,

38.8994816000000014 -76.9785097000000036    NULL
38.9445079999999990 -77.0045459999999906    NULL

i need result as

38.8994816000000014 -76.9785097000000036    38.899481600000001476.9785097000000036

3 Answers 3

2

AsText() is a special function for working with columns of the geometry type.

It doesn't appear that latitude and longitude are geometry type to me; they are just floats. It should work fine if you omit AsText():

SELECT LATITUDE,LONGITUDE, concat(LATITUDE,',' ,LONGITUDE) AS point 
    FROM incident_google

SQLFiddle example.

Note: On the other hand, if you are using the geospacial extensions, you need to specify what types you are working with and what you are trying to do. This is a rather specialized area.

Sign up to request clarification or add additional context in comments.

4 Comments

i need to use this result value in a geometry class in java.if any other way for geometry functions.
another one try to use Text() rather than AsText
@AravinthaBashyam.c, in that case just use a normal SQL query to get the values, and use the appropriate Java function to convert those values to a geometry class. How to do that would be a Java question.
@Kaii, the query above works--see the example. It is just not what the OP wants to do.
1

Try to use Text instead of Astext first before concatinating or using CONCAT?

SELECT LATITUDE,LONGITUDE,concat(Text(LATITUDE),',' ,Text(LONGITUDE)) AS point FROM incident_google

2 Comments

if any possible to convert this as geomentry.
yes using GeomFromText() - converts string into geometry format and returns the result. GeomFromWKB -
0

as mentioned here some of these functions has been deprecated. check here for new version names.

In newer version of MySQL (8.0+), old spatial functions like GeomFromText, AsText has been deprecated and not longer works. Make sure to follow this list from here onwords if you are facing issues with undefined function names.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.