Home > Uncategorized > Scripting Carmenta Engine 5 – Part 2

Scripting Carmenta Engine 5 – Part 2

Projecting points between different coordinate systems is a common GIS operation. Here are script snippets for conversion between WGS84 and RT90 using Carmenta Engine.

Python:

from Carmenta.Engine.Core import *

Runtime.initialize()
rtxy = Crs.fromAuthorityAndCode(“epsg”, “3847”)
wgs84 = Crs.wgs84LongLat
p = wgs84.projectTo(rtxy, Point(12,57))
print(p.x, p.y)
Runtime.shutdown()

Powershell:

[System.Reflection.Assembly]::LoadFrom(“C:\Program Files\Carmenta\Carmenta Engine 5 SDK\bin\cecore.dotnet.dll”)
[Carmenta.Engine.Runtime]::Initialize()

$rt90 = [Carmenta.Engine.Crs]::FromAuthorityAndCode(“epsg”, “3847”)
$wgs84 = [Carmenta.Engine.Crs]::Wgs84LongLat

$lolaPoint = new-object Carmenta.Engine.Point -ArgumentList 12, 57
$rt90Point = $wgs84.ProjectTo($rt90, $lolaPoint)

[Carmenta.Engine.Runtime]::Shutdown()

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: