[Geojs-users] Programatically creating annotations

David Manthey david.manthey at kitware.com
Mon Dec 12 11:08:23 EST 2016


The annotation internally stores coordinates in the map gcs (not the
interface gcs). We probably should modify this for creation, since my
example should have been:

layer.addAnnotation(geo.annotation.pointAnnotation({position:
geo.transform.transformCoordinates(map.ingcs(), map.gcs(), {x: -125,
y: 37.3})}))

​

On Fri, Dec 9, 2016 at 3:38 PM, David Manthey <david.manthey at kitware.com>
wrote:

> If layer is an annotationLayer, then you can create a point like so:
>
> layer.addAnnotation(geo.annotation.pointAnnotation({position: {x: -118, y: 37}}))
>
> Each annotation takes separate options. They all take an optional style
> specification. Points get a single position. Polygons take a list of
> vertices (alternately called coordinates). Rectangles take a list of
> corners (alternately called coordinates).
>>
> On Fri, Dec 9, 2016 at 3:27 PM, Dan LaManna <dan.lamanna at kitware.com>
> wrote:
>
>> Hi all -
>>
>> For background, in geonotebook we're "replaying" server side state to the
>> client (in the event of a refresh, for example). We have our own
>> definitions of annotations (in Python) which contain the necessary data
>> (coordinates, style information, etc) to create annotations within GeoJS.
>>
>> After taking a brief look at the GeoJS annotation code, it seems closely
>> tied to the user interaction aspect of creating annotations. What we're
>> looking for is a simple way to create an annotation (point, rectangle,
>> polygon) from Javascript without any user interaction. Is there a
>> straightforward API for this that I'm missing?
>>
>> Thanks GeoJSers!
>>
>> --
>> Dan LaManna
>> Kitware, Inc.
>>
>> _______________________________________________
>> Geojs-users mailing list
>> Geojs-users at public.kitware.com
>> http://public.kitware.com/mailman/listinfo/geojs-users
>>
>>
>
>
> --
> David Manthey
> R&D Engineer
> Kitware Inc.
> (518) 881-4439
>



-- 
David Manthey
R&D Engineer
Kitware Inc.
(518) 881-4439
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/geojs-users/attachments/20161212/ba697a8f/attachment.html>


More information about the Geojs-users mailing list