0

I have a spatialite database with longitutade and latitude colums as text:

SELECT latitude, longitude FROM mytable1 LIMIT 3;
54.475|9.0422222222222
52.398055555556|13.733888888889
49.940277777778|11.576388888889

When I try to create a geometry from them with them MakePoint it results in emtpy values:

spatialite> SELECT MakePoint(longitude, latitude, 4326) FROM mytable1 LIMIT 3;



spatialite> 

On another table with lat/lon columns as text it's working. Any idea why?

Solution: cast lon/lat text columns to real like

UPDATE mytable2 SET geom = MakePoint(cast(longitude as real), cast(latitude as real), 4326)
Marten Bauer
  • 3,099
  • 5
  • 22
  • 18
  • I can't reproduce the case where it's working with columns as TEXT (I only get NULLs). Could you post an example? – antonio Jun 12 '16 at 14:46
  • damn my mistake. On mytable1 I already cast the latitude, longitude columns from text to real. On mytable2 they are as text. – Marten Bauer Jun 13 '16 at 07:36
  • Could you post your solution as an answer and accept it so it can help others? – antonio Jun 13 '16 at 07:52

0 Answers0