The api is loaded using a simple <script>
tag inserted in your page. The api code should
always be loaded from Eniro’s servers (attempts to download and host the files locally are likely to break with
future updates). The simplest loading looks like this:
<script type="text/javascript" src="http://kartor.eniro.se/rs/eniro.js?partnerId=[your id]"></script>
This would load the swedish localised version of the api. There are a couple of request parameters that affect
loading.
se
(default) for sweden, no
for norway, dk
for denmark or pl
for poland.
<script>
tag is in the <head>
section
of the page, in which case the onload
event of the page is enough to know the api has loaded.
However if the script is loaded in the <body>
section, the callback is required. See
the callback example.
To help us keep track of who is using the javascript map api we want you to provide an identifier when loading the code*. Each example loads the api code from our servers using a URL like:
http://kartor.eniro.se/rs/eniro.js?partnerId=[your id]
The partnerId
will be provided by the maps team at Eniro. For example, if your company name
is Nuts 4 Squirrels, your assigned id could be something like nuts4squirrels
and the
the whole script tag from the api code examples should be changed to:
<script type="text/javascript" src="http://kartor.eniro.se/rs/eniro.js?partnerId=nuts4squirrels" target="enirojsmapapi"></script>
* Use of the api without a proper partnerId
is not allowed, and we may, without
prior notice, block such access.
A user of the API will interact using WGS84. (EPSG:4326). The API does internally use other Spatial Reference Systems (SRS), notably Spherical Mercator (EPSG:900913 or EPSG:3857), however as an API user these are rarely of any concern.
In WGS84 parlance one often talk about "lat-long", i.e. a latitude/longitude. In this API, the class
eniro.maps.LatLng, is always a WGS84 type coordinate.
Notice that LatLng inherits eniro.maps.Coordinate, and
in many cases the following two ways of constructing a coordinate are roughly equivalent:
var coord1 = new eniro.maps.LatLng(10.0, 20.0); // convention for lat/lng is y, x.
var coord2 = new eniro.maps.Coordinate(20.0, 10.0, eniro.maps.Srs.WGS84);
We think of a Coordinate as being an SRS typed Point and LatLng as a coordinate with the specific WGS84 SRS type.