Algoritmos base de plataforma.

by luis

parseLocation

BEGIN
  
  DECLARE result varchar(255);
  

  select location into result FROM relLatLngLocation 
  WHERE lat = Y(position_in) AND lng =X(position_in);
  
  
  IF result is null THEN
  INSERT IGNORE INTO relLatLngLocation
  select  Y(position_in) as lat,X(position_in) as lng, position_in as position, 
  CONCAT(parseStreet(position_in),', ',IF(ISNULL(l.`name`),'',l.`name`),', ',m.NOM_MUN,', ',m.NOM_ENT,', ',s.admin) as location
  from municipios m
  LEFT JOIN states s ON ( CONTAINS(s.shape,m.shape) AND realPointInPolygon(s.shape,position_in) )
  LEFT JOIN landuse l ON CONTAINS(l.shape,position_in)
  WHERE CONTAINS(m.shape,position_in)
  AND realPointInPolygon(m.shape,position_in)
  limit 1;
  
  select location into result FROM relLatLngLocation 
  WHERE position = position_in;

  END IF;
  
  return result;
  
END

 

Deja un comentario

Your email address will not be published.
*
*