[Geojs-users] Programatically creating annotations

David Manthey david.manthey at kitware.com
Mon Dec 12 14:24:30 EST 2016


I’ve got a PR that adds an option to addAnnotation.

Fundamentally, when you create a new annotation (via
geo.annotation.pointAnnotation, for instance), that annotation isn’t
attached to a map yet, so has no concept of which gcs should be used. Once
attached to an annotation layer, it does. By adding an option to
addAnnotation, this becomes something that can be controlled. In the PR, it
now defaults to using the map’s interface gcs if you don’t specify
otherwise (not the display gcs).
​

On Mon, Dec 12, 2016 at 2:17 PM, Aashish Chaudhary <
aashish.chaudhary at kitware.com> wrote:

> We probably should modify this for creation
> +1 if you meant providing an option in the API.
>
> - Aashish
>
> On Mon, Dec 12, 2016 at 11:08 AM David Manthey <david.manthey at kitware.com>
> wrote:
>
>> 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
>> _______________________________________________
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/geojs-users/attachments/20161212/d4e26809/attachment-0001.html>


More information about the Geojs-users mailing list