Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

npm package al dar una direccion se obtienen las coordenadas longitud y latitud

// Almacenamos en una constante la función que realiza la llamada y devuelve el archivo.
const getGeojson = (request, response, next) => {
    // Almacenamos la consulta SQL
    let queryLayer = 'SELECT  id,  st_x(geom ) as lng, st_y(geom ) as lat, nombre,  tipo,  cod_mun,  municipio,  provincia FROM alojamientodera;'

    pool.query(queryLayer, (err, res) => {
        if (err) {
            return console.error('Error ejecutando la consulta. ', err.stack)
        }
        let geojson = GeoJSON.parse(res.rows, { Point: ['lat', 'lng'] });

        response.json(geojson);
    })
}

// Exportamos las funciones para ser usadas dentro de la aplicación
module.exports = { getGeojson } 

Comment

PREVIOUS NEXT
Code Example
Javascript :: how to get file tree of specific folder in node js 
Javascript :: nodejs css cotent tipe 
Javascript :: custom render contenful rich text rendering 
Javascript :: sum the two first minimum numbers in an array 
Javascript :: reading data from link in javascript 
Javascript :: show dropdown upwards and downward 
Javascript :: solana solana-Web3.js change for devnet lamports to production transaction 
Javascript :: ex:h2p 
Javascript :: get form control value in angular 8 
Javascript :: khai bao bien trong javascript 
Javascript :: how to add autoserial number in react js 
Javascript :: Caret.editorconfig 
Javascript :: click to enlarge in javascript 
Javascript :: how to give id dynamically in javascript 
Javascript :: why is necessary to run react-native run 
Javascript :: how to add,delete,update property in javascript object 
Javascript :: types of directive in jsp 
Javascript :: my env.local file not working in my react app usind mac 
Javascript :: load json object from file frontend javascript 
Javascript :: Parsing an array returned from a function JS 
Javascript :: change active menu item on page scroll javascript 
Javascript :: qweb t-foreach key odoo 
Javascript :: add html symbols with javascript 
Javascript :: Text with prop value is rendered The component renders variable text based on a string prop. We test that the component renders the value of the passed prop. 
Javascript :: cellpadding and cellspacing in JSP 
Javascript :: limit frontend request 
Javascript :: loopback 4 pagination 
Javascript :: javaScript Bezier Curve After Effects expression 
Javascript :: js hk 
Javascript :: nodejs createwriteStream file image broken 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =