- ) Suppose the map is to be 1000x800 pixels. We want to do a map of just Japan.
- Where is the southernmost point of japan plotted?
- Find the point
- select * from edges where Polygon in (select polygon from polygons where code = "ja") order by latitude limit 1;
- +---------+------+-----------+------------+
- | Polygon | Edge | Latitude | Longitude |
- +---------+------+-----------+------------+
- | 560 | 278 | 28.022601 | 116.984001 |
- +---------+------+-----------+------------+
- Find the edges of the map
- select min(latitude), min(longitude), max(latitude), max(longitude) from edges where Polygon in (select polygon from polygons where code = "ja") ;
- +---------------+----------------+---------------+----------------+
- | min(latitude) | min(longitude) | max(latitude) | max(longitude) |
- +---------------+----------------+---------------+----------------+
- | 28.022601 | 116.172001 | 48.574901 | 125.048001 |
- +---------------+----------------+---------------+----------------+
- Use the formula
- x = width * (lon - min_lon) / (max_lon - min_lon)
- x = 1000 * (116.984001 - 116.172001) / (125.048001 - 116.172001)
- x = 91.48
- y = height - height * (lat - min_lat) / (max_lat - min_lat)
- y = 800 - 800 * ( 28.022601 - 28.022601) / (28.022601 - 48.574901)
- y = 0;
Raw Paste