howto OSM

This commit is contained in:
netico 2022-01-11 18:54:40 +01:00
parent ea02eff74b
commit a97c8eba8e

View file

@ -6,19 +6,19 @@ The code you find here makes use of services provided by **OpenStreetMap**. **Op
## Use OpenLayers to build the map
Take a look at the OpenLayers folder. Inside you will find a custom map built in HTML and Javascript.
Take a look at the [OpenLayers](https://git.lattuga.net/netico/code-library/src/master/OSM/OpenLayers) folder. Inside you will find a custom map built in HTML and Javascript.
![Map example](example.png)
It uses the **OpenLayers** library, which makes it easy to put a dynamic map on any web page. It is a completely free library, released under the 2-clause BSD license.
In the example found here, the address data (latitude and longitude) is read from a CSV file. A CSV (comma-separated values) file is a delimited text file that uses a comma to separate values. Each line in the file is a data record. Each record consists of one or more fields, separated by commas.
In the example found here, the address data (latitude and longitude) is read from a **CSV file**. A CSV (comma-separated values) file is a delimited text file that uses a comma to separate values. Each line in the file is a data record. Each record consists of one or more fields, separated by commas.
## Get geolocated addresses
If you want to geolocate addresses, you can use the script contained in the Locator folder.
If you want to geolocate addresses, you can use the script [locator.sh](https://git.lattuga.net/netico/code-library/src/master/OSM/Locator/locator.sh), contained in the [Locator](https://git.lattuga.net/netico/code-library/src/master/OSM/Locator) folder.
The script reads a text file with one address per line and returns a CSV file with latitude and longitude.
The [script](https://git.lattuga.net/netico/code-library/src/master/OSM/Locator/locator.sh) reads a [text file](https://git.lattuga.net/netico/code-library/src/master/OSM/Locator/input.txt) with one address per line and returns a [CSV file](https://git.lattuga.net/netico/code-library/src/master/OSM/Locator/input.csv) with latitude and longitude.
Also shows how to use PHP code in a bash script.