GEOSHIFT
geo
GEOSHIFT
functions shifts a geoshape on the earth. It is able to safely overlap the poles or the 180th meridian.
- Longitude shift keeps distances.
- Latitude shift keeps angles, not distances.
- When doing latitude shift, you can specify a meridian to shift along this meridian. It means a positive shift became a negative shift behind this meridian +/- 90°.
Set precision parameter to zero for safe shifting operation. See GEO.WKT
for precision encoding.
Use ->GEOJSON
to visualize shapes and the results. GeoJson could be visualized on the map, if you let a special object on the map. See example.
GEOSHIFT is available since version 2.5.0.
See also
Signatures
Examples
//draw a 3000km circle around new york
40.7 -74 3000e3 8 @senx/geo/earthCircle
DUP true ->GEOJSON JSON-> 'original' STORE
//shift it 180° away (longitude, keep distances)
0 180 0 GEOSHIFT
true ->GEOJSON JSON-> 'shifted' STORE
// the map web component in vscode or warp studio will parse
// this special object and draw the geoshapes
{ 'data' [
$original
$shifted
]
}
//draw a 3000km circle around new york
40.7 -74 3000e3 8 @senx/geo/earthCircle
DUP true ->GEOJSON JSON-> 'original' STORE
//shift it 20° north (it will touch the north pole)
20 0 0 GEOSHIFT
true ->GEOJSON JSON-> 'shifted' STORE
// the map web component in vscode or warp studio will parse
// this special object and draw the geoshapes
{ 'data' [
$original
$shifted
]
}
//draw a 3000km circle around new york
40.7 -74 3000e3 8 @senx/geo/earthCircle
DUP true ->GEOJSON JSON-> 'original' STORE
//shift it 20°, but following the 12th meridian.
// it means a part will shift to the north, the other one to the south.
12 20 0 0 GEOSHIFT
true ->GEOJSON JSON-> 'shifted' STORE
// the map web component in vscode or warp studio will parse
// this special object and draw the geoshapes
{ 'data' [
$original
$shifted
]
}