Create a map with my loaction in codap

CODAP Forums CODAP Help Forum Create a map with my loaction in codap

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6889 Score: 0
    Meet Sanghvi
    Participant

    Hello I am working on a plugin for Purple Air API that will be used in classroom setting.

    Background –
    The idea here is to show the location of the sensors (i already have the lat long) on the map.

    The image attached shows my current working status of the code. I have a table which displays a set of attributes for the sensors. I want to show where these sensors are on the map (for which) i already have the lat/long.

    Issue / Problem –
    I am not able to understand how to call the create map element in my javascript code, i tried reading through the gettings starts and few other docs here – https://github.com/concord-consortium/codap/wiki/CODAP-Data-Interactive-Plugin-API#the-data-interactive-plugin-api
    but i still couldn’t understand how to create the map element and then how to update the map with new values on each search.

    Attachments:
    #6892
    Jonathan Sandoe
    Keymaster

    Hello Meet,

    Creating any CODAP component is pretty easy. The plugin sends a message that looks something like this:

    { “action”: “create”, “resource”: “component”, “values”: {“type”: “map”}}

    You can specify more properties for the component, but, if you don’t, CODAP will supply default values. These may be good enough.

    The Map Component displays points and shapes as layers on the basic map background based on the data in datasets in the current document. It looks among the datasets for attributes named like “latitude” and “longitude” and creates a dot for each case with values set for those attributes. Similarly, it looks for attributes with names like “boundary” or typed “Boundary” and creates a shape for each case with those attributes set.

    So, if you want the map to display a point for the location the user set, then you should create a dataset with “latitude” and “longitude” attributes. This is described here, but I think you already have figured that out. Then you would create a case within that dataset. You can modify that case or add new ones, if the user changes location.

    I hope this answers your question.

    Jonathan

     

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CODAP Help Forum’ is closed to new topics and replies.