Working with maps – Creating boundaries.

CODAP Forums CODAP Help Forum Working with maps – Creating boundaries.

Viewing 15 posts - 1 through 15 (of 27 total)
  • Author
    Posts
  • #679 Score: 0
    Andrew Scott
    Participant

    I have been playing with the Map Data example and love how you defined the boundaries for the different states. How was that achieved and how can I develop my own custom boundaries say for example counties in my region or countries of the world?

    There does not appear to be any documentation on this, only a previous forum post  (link below) which hinted at how to plot locations as points on a map. There also does not appear to be an insinuative way in Codap to view and edit the underlying boundary data.

    Uploading data with coordinates and geographic boundaries

    I’m not a GIS expert, though I do understand WGS84 regards to longitude and latitude pairs. I also have an SHP file that defines the boundaries of all countries. I am able to export this to a CSV using QGIS and the MMQGIS plug in.

    What do I need to do to make this data usable within Codap’s maps to form boundaries.?

    • This topic was modified 5 years, 8 months ago by Andrew Scott.
    #681
    Andrew Scott
    Participant

    A nice little plug in would be a tool/feature  to allow users to define a boundary on the map by making a polyline that snaps to the edges of geographical boundaries.

    .

    #682
    Bill Finzer
    Keymaster

    Hello Andrew,

    Your post relates to a powerful and interesting capability of CODAP, one that has been used by a number of projects.

    The Map Data example pulls in state boundaries with a formula:

    lookupBoundary(US_state_boundaries, state)

    There are four other sets of boundaries available by these means: US_congressional_districts, US_county_boundaries, US_puma_boundaries, and country_boundaries. You can see documentation for how to do this in the formula editor under lookupBoundary as shown in the screenshot I’ve enclosed.

    If an attribute is named one of ‘boundary’, ‘boundaries’, ‘polygon’, ‘polygons’ (case independent), CODAP will attempt to use it to plot boundaries in a map. If the type of an attribute is boundary as specified using attribute properties, it won’t matter what the name is.

    The boundaries themselves are expressed in geojson which you can read about on the web. You can actually paste geojson into a value and have it display a boundary on a map.

    There are online utilities for converting SHP files to geojson. Then you can export these to ‘csv’ and import them into CODAP.

    I hope this helps you get started!

    Bill

    Attachments:
    #684
    Andrew Scott
    Participant

    Ok, so I get that I need to enter the formula in the attribute heading’s ‘Edit Formula’ feature, I’ve done that.  However, please explain what then goes in the cells to reference the state?. I’ve tried entering the names of states for example Utah or Wyoming, but the cell then says “X : ‘state’ is unrecognized”.

    Are you telling me that to display the boundary for say Utah, I now have to locate and enter geoJSON  representing Utah in to the cell?

     

    • This reply was modified 5 years, 8 months ago by Andrew Scott.
    • This reply was modified 5 years, 8 months ago by Andrew Scott.
    #687
    Bill Finzer
    Keymaster

    Hi Andrew,

    In addition to the boundary attribute that contains the formula, you’ll need another attribute for the names of the states. Let’s say you called that attribute state_name. Then your formula for the boundary would be:

    LookupBoundary(US_state_boundaries, state_name)

    Then enter the names (or abbreviations) of states in the cells in the state_name attribute column of the table.

    If you already have a map open, you may need to close it and open another one after you’ve got your attributes defined. (I’m working on a fix for this right now!)

    Bill

    #688
    Andrew Scott
    Participant

    Ok, I think I get it now. I did not realize that the second parameter of the formula was the name of another attribute, I thought the data went in the same attribute, that’s actually quite easy and very nicely done.

    Maybe, the documentation should be updated to prevent similar questions in the future.

    Many thanks for your help.

    • This reply was modified 5 years, 8 months ago by Andrew Scott.
    • This reply was modified 5 years, 8 months ago by Andrew Scott.
    #691
    Bill Finzer
    Keymaster

    I agree we need much better documentation on how to get boundaries in maps. We’re very close to having maps able to display multiple layers of points and boundaries together in the same map. That will definitely require new (and better) documentation.

    Thanks for your feedback.

    Bill

    #760
    Dany Maknouz
    Participant

    Are there a similar function for Italian boundaries?

     

    #761
    Bill Finzer
    Keymaster

    Hello Dany,

    We do not have the Italian boundaries in our database. It would not be very difficult to create. If you or someone you work with were willing to do part of the work, we could add them.

    BTW, I notice from Google Analytics that there is a lot of CODAP activity in Italy recently. Do you happen to know anything about that?

    Bill

    #762
    Dany Maknouz
    Participant

    Hi Bill thank you very much
    I’ll be part of the work with pleasure, let me know how.

    We are running an online math course for Italian HIgh School math teachers and we are showing codap as a good enviroment to work with…That’s why 🙂
    Best regards

     

    #763
    Jonathan Sandoe
    Keymaster

    Hi Dany,

    We are very pleased by your interest in this (and we are very pleased to learn that you are using CODAP in your online course.) The steps for creating new boundary documents are, at least in theory, not difficult. They are:

    1. Find a suitable GeoJSON file with boundary data for the Italian provinces or districts. GeoJSON is a standard format for the representation of geographic data. There are many openly licensed datasets on the web. For example, this one may suit: https://github.com/deldersveld/topojson/blob/master/countries/italy/italy-regions.json. Save the one you like as a file on your computer.
    2. Open CODAP with this URL: https://codap.concord.org/releases/staging/static/dg/en/cert/index.html?di=https://concord-consortium.github.io/codap-data-interactives//GeoJSONImporter/GeoJSONImporter.html . This will create a CODAP instance with a GeoJSON Importer plugin in it.
    3. Click on the “Choose File” button, then select your GeoJSON file.
    4. Click on “Import”.
    If all goes well the plugin will upload and convert the file to a dataset named “Boundaries”. You should be able to open it by clicking on the “Tables” menu or by opening a map.
    5. Close the plugin, map and any other components, then create a share URL for the document (in the file menu in the upper left of CODAP, select “Share…”, then “Get link to shared view”, then follow the instructions to copy the shared URL.
    6. Send us the link. There are a couple of steps on our side to get it on the server that we have not automated, which we will happily do. We will let you know how to access.

    By the way, as you may have noticed, CODAP has been translated into a number of languages. This has been done by volunteers, since it is not something in our capacity to do, but it is not difficult. We use a very nice cloud based translation service called Po Editor (https://poeditor.com). If you would be interested in taking on an Italian translation or know someone who might be interested, we can set you up.

    Thanks,

    Jonathan Sandoe

    #764
    Filippo Spirito
    Participant

    HI Jonathan,

    I’m a colleague of Dany.

    I imported the GeoJSON file of the boundaries of the Italian regions. I think everything went well because I saw the regions by opening a map or a table in the CODAP document. The only doubt is that you do not see the small icons of the regions in the Boundary column of the table. (See screenshots that I attach to understand better). Can it depend on whether the GeoJson file has not yet been uploaded to your server or is it a lack in the file itself?

    Here is the shared link to the Codap document:

    https://codap.concord.org/releases/staging/static/dg/en/cert/index.html#shared=74140

    I await further communications to find out if the procedure was successful.

    Thank You very much.

     

    #767
    Jonathan Sandoe
    Keymaster

    Hello Prof. Spririto,

    The file looks like exactly what we need. Generating the small thumbnails is a part of the process we do. I’ll let you know when the boundary file is accessible.

    Thanks,

    Jonathan

    #768
    Filippo Spirito
    Participant

    Thank You so much, Jonathan!

    I’m really happy about that!

    Best Regards

    Filippo Spirito

     

    #769
    Dany Maknouz
    Participant

    Thank you Filippo!!

Viewing 15 posts - 1 through 15 (of 27 total)
  • You must be logged in to reply to this topic.