Skip to content

Commit 7adcf3e

Browse files
Change function name setResolution to setSize (#11)
* Change function name `setResolution` to `setSize` * Updated README.md
1 parent 56e5133 commit 7adcf3e

File tree

3 files changed

+29
-34
lines changed

3 files changed

+29
-34
lines changed

README.md

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,43 @@
22

33
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/0961fc2320cd495a9411eb391d5791ca)](https://app.codacy.com/gh/CelliesProjects/OpenStreetMap-esp32/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
44

5-
### What is this
6-
7-
This library provides a [OpenStreetMap](https://www.openstreetmap.org/) (OSM) map fetching and tile caching system for ESP32-based devices.
5+
This library provides a [OpenStreetMap](https://www.openstreetmap.org/) (OSM) map fetching and tile caching system for ESP32-based devices.
86
Under the hood it uses [LovyanGFX](https://github.com/lovyan03/LovyanGFX) and [PNGdec](https://github.com/bitbank2/PNGdec) to do the heavy lifting.
97

108
[![map](https://github.com/user-attachments/assets/39a7f287-c59d-4365-888a-d4c3f77a1dd1 "Click to visit OpenStreetMap.org")](https://www.openstreetmap.org/)
119

1210
A map is composed from downloaded OSM tiles and returned as a LGFX sprite.
13-
The sprite can be pushed to the screen or used for further composing.
11+
The sprite can be pushed to the screen, saved to SD or used for further composing.
1412
Downloaded tiles are cached in psram for reuse.
1513

16-
This library should work on any ESP32 type with psram and a LovyanGFX compatible display.
14+
This library should work on any ESP32 type with psram and a LovyanGFX compatible display.
1715
The downloaded tile cache gets large very quickly -128kB per tile- so psram is required.
1816

1917
This project is not endorsed by or affiliated with the OpenStreetMap Foundation.
2018

21-
### Functions
19+
## License differences between this library and the map data
20+
21+
### This library has a MIT license
2222

23-
#### Set map resolution
23+
The `OpenstreetMap-esp32` library -this library- is licensed under the [MIT license](/LICENSE).
24+
25+
### The downloaded tile data has a Open Data Commons Open Database License (ODbL)
26+
27+
OpenStreetMap® is open data, licensed under the [Open Data Commons Open Database License (ODbL)](https://opendatacommons.org/licenses/odbl/) by the OpenStreetMap Foundation (OSMF).
28+
29+
Use of any OSMF provided service is governed by the [OSMF Terms of Use](https://osmfoundation.org/wiki/Terms_of_Use).
30+
31+
## Functions
32+
33+
### Set map resolution
2434

2535
```c++
26-
void setResolution(uint16_t w, uint16_t h);
36+
void setSize(uint16_t w, uint16_t h);
2737
```
2838
29-
- If no resolution is set, a 320 by 240 map will be returned by `fetchMap`.
39+
- If no size is set a 320px by 240px map will be returned by `fetchMap`.
3040
31-
#### Resize cache
41+
### Resize cache
3242
3343
```c++
3444
bool resizeTilesCache(uint8_t numberOfTiles);
@@ -37,48 +47,37 @@ bool resizeTilesCache(uint8_t numberOfTiles);
3747
- The cache is cleared before resizing.
3848
- Each tile is 128 kB.
3949

40-
#### Free the memory used by the tile cache
50+
### Free the memory used by the tile cache
4151

4252
```c++
4353
void freeTilesCache();
4454
```
4555

46-
#### Fetch a map
56+
### Fetch a map
4757

4858
```c++
4959
bool fetchMap(LGFX_Sprite &map, double longitude, double latitude, uint8_t zoom);
5060
```
5161
52-
- `longitude` and `latitude` are normalized to valid coordinates.
62+
- Overflowing `longitude` are wrapped and normalized to +-180°.
63+
- Overflowing `latitude` are clamped to +-90°.
5364
- Valid range for the `zoom` level is 1-18.
5465
55-
#### Save a map to SD card
66+
### Save a map to SD card
5667
5768
```c++
5869
bool saveMap(const char *filename, LGFX_Sprite &map, String &result,
5970
uint8_t sdPin = SS, uint32_t frequency = 4000000)
6071
```
6172

62-
- `filename` must start with `/` for example `/map.bmp` or `/images/map.bmp`
73+
- `filename` must start with `/` for example `/map.bmp` or `/images/map.bmp`
6374
- `result` returns something like `SD Card mount failed` or `Screenshot saved`.
6475
- `sdPin` is **optional** and used to set a `SS/CS` pin for the SD slot.
6576
- `frequency` is **optional** and used to set the SD speed.
6677

67-
**Note**: The SD card is managed from `begin()` to `end()` inside the `saveMap()` function.
78+
**Note**: The SD card is managed from `begin()` to `end()` inside the `saveMap()` function.
6879
Do not mount the SD card before this function but unmount if it is mounted else memory will be leaked.
6980

70-
## License differences between this library and the map data
71-
72-
### This library has a MIT license
73-
74-
The `OpenstreetMap-esp32` library -this library- is licensed under the [MIT license](/LICENSE).
75-
76-
### The downloaded tile data has a Open Data Commons Open Database License (ODbL)
77-
78-
OpenStreetMap® is open data, licensed under the [Open Data Commons Open Database License (ODbL)](https://opendatacommons.org/licenses/odbl/) by the OpenStreetMap Foundation (OSMF).
79-
80-
Use of any OSMF provided service is governed by the [OSMF Terms of Use](https://osmfoundation.org/wiki/Terms_of_Use).
81-
8281
## Example code
8382

8483
### Example returning the default 320x240 map
@@ -207,10 +206,6 @@ void loop()
207206
}
208207
```
209208

210-
### Screenshot of a 480x800 map from a esp32-8048s050
211-
212-
![map](https://github.com/user-attachments/assets/9a92bbff-e96d-444d-8b34-29801744fa80)
213-
214209
### PlatformIO setup
215210

216211
```bash

src/OpenStreetMap-esp32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ OpenStreetMap::~OpenStreetMap()
2828
freeTilesCache();
2929
}
3030

31-
void OpenStreetMap::setResolution(uint16_t w, uint16_t h)
31+
void OpenStreetMap::setSize(uint16_t w, uint16_t h)
3232
{
3333
mapWidth = w;
3434
mapHeight = h;

src/OpenStreetMap-esp32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class OpenStreetMap
5555

5656
~OpenStreetMap();
5757

58-
void setResolution(uint16_t w, uint16_t h);
58+
void setSize(uint16_t w, uint16_t h);
5959
bool resizeTilesCache(uint8_t numberOfTiles);
6060
void freeTilesCache();
6161
bool fetchMap(LGFX_Sprite &sprite, double longitude, double latitude, uint8_t zoom);

0 commit comments

Comments
 (0)