GithubHelp home page GithubHelp logo

mapseed / platform Goto Github PK

View Code? Open in Web Editor NEW
87.0 28.0 36.0 470.21 MB

Mapseed is a simple, beautiful way to collect information and tell geographic stories.

Home Page: http://mapseed.org

License: GNU General Public License v3.0

JavaScript 49.92% Shell 0.12% HTML 6.92% CSS 15.04% TypeScript 25.22% SCSS 2.77%
python javascript community gis opensource sustainability activism

platform's Introduction

Mapseed (platform)

Build Status

A simple, beautiful way to collect information and tell geographic stories.

Mapseed is a platform that allows anyone to create community-driven maps on the web. These maps allow users to report issues or submit ideas and respond to the issues & ideas of others. Combine user-generated content with external data overlaid on the same map to allow anyone to see what's going on in the area at a glance.

This module, platform, is the tool for creating the maps themselves, while the api module collects the user reports on the backend.

Table of Contents

Background

Mapseed was originally developed to empower community members to stay informed and track the cleanup of toxic waste along Seattle's Duwamish River. HeyDuwamish.org runs on Mapseed. It's now used for several other community maps

The Mapseed platform is a fork of Shareabouts, which was developed by OpenPlans before they closed in 2015. It is a "spiritual successor" to Qué Pasa Riachuelo?.

Install

Mapseed requires Node LTS. We recommend managing node/npm versions using nvm or asdf.

Currently we run

nvm use 10.16

NOTE: we're maintaining this project as volunteers, and could use some help updating the dependancies.

Please reply to this Issue if you can lend a hand


To install npm dependencies:

# In project folder
npm install

Usage

If you want to create a map for your community, don't hesitate to get in touch. We can help you with the setup process!

Connecting to an API

In order to collect and store user reports, the map must be configured to connect to a Mapseed API backend. By default, map flavors are configured to connect to a hosted development API for testing purposes.

Configuring

To customize your map with everything from the input form you want users to complete to the extra data you want to display, you'll edit your flavor's config.yml file. For more information on the configuration process and what options are available, see the config documentation.

Running your map in a browser

If you want to see your map in action, simply run:

FLAVOR=<flavor> npm start

where <flavor> should be replaced with the name of a map flavor. If you're building your own flavor you can use that name, otherwise you can try a pre-made flavor, such as duwamish_flavor.

By default, this will serve your map at http://localhost:8000, but will not perform localization (should your map have multiple languages). To build a production bundle with localizations suitable for deployment, run:

FLAVOR=<flavor> npm run build

Alternatively, to build a production bundle and also start the development server at http://localhost:8000, run:

NODE_ENV=production FLAVOR=<flavor> npm start

By default, this will output all production files to a folder called www in the root of the project. This folder will contain all the assets required to deliver your map to users. Furthermore, the assets output to www will be entirely static, meaning they won't require a server to host, and can be made available via a static site hosting service such as AWS's S3.

Deployment

To deploy to a website, run the following script:

npm run build-deploy

The appropriate env vars for FLAVOR, MAPBOX_TOKEN , MAPQUEST_KEY, MAP_PROVIDER_TOKEN, API_ROOT, <flavor>_SITE_URL, <flavor>_GOOGLE_ANALYTICS_ID, and DEPLOY_DOMAIN must be set in the /src/.env file.

NOTE: If you are getting this error:

Error: getaddrinfo ENOTFOUND cloudfront.amazonaws.com cloudfront.amazonaws.com:443

then you may need to turn off your VPN.

NOTE: If the new bundle is not being served, then you may need to run a cache invalidation on your CDN.

Using the Dev API

By default, map flavors that you run locally will coneect to a hosted development API. However, if you want to host your own Mapseed API backend, either for testing or production purposes, it will be necessary to build your map flavors against a .env file with the necessary configuration information.

To do so, create a file at src/.env (note the . character in the filename), and add information in the following format:

API_ROOT=http://localhost:8001/api/v2/ # note trailing slash

TREES_SITE_URL=http://localhost:8001/api/v2/username/datasets/trees
RESTORATION_SITE_URL=http://localhost:8001/api/v2/username/datasets/restoration

The value of API_ROOT should match the server on which your map datasets are running, and should contain a trailing / character. If you're hosting your API on a server called api.mymap.com, for example, the value of API_ROOT would be:

API_ROOT=http://api.mymap.com/api/v2/ # note trailing slash

For each dataset that your map connects to, you'll need a line that tells the map where to find this dataset. Dataset key names should take the format <DATASET>_SITE_URL, where <DATASET> is the UPPERCASE name of the dataset referenced in the config.yml file for your flavor.

Note that you can also set the FLAVOR variable in your .env file:

FLAVOR=duwamish_flavor

Doing so will remove the need to pass this value in when your run npm start or npm run build.

Localizing your map

It is possible to render the text of your map flavor in multiple languages. Mapseed uses the Gettext system to localize content. Gettext works by producing a catalog of all the strings in your map flavor. Such catalogs usually have the file extension .po, and are designed to be distributed to translators. Translators translate content in the .po file and return the finished file when they're done. The translated .po file is saved in a designated place in your project's folder structure, and is used during the build process to produce localized versions of your map.

You'll generally encounter two scenarios when localizing your map: then need to produce a .po file for a brand new language which you've never translated before, and the need to update the .po files for all existing languages with new content.

To generate a .po file for a brand new language for a given flavor, run the following in the root of the project:

FLAVOR=<flavor> node scripts/make-flavor-messages.js --set-new-locale=<language_tag>

where <flavor> is the name of the flavor you'd like to localize, and <language_tag> is the standard language and country code for the target language. (See here for more information about language tags.)

To update all existing locales with new content for a given flavor, run the following in the root of the project:

FLAVOR=<flavor> node scripts/make-flavor-messages.js

where <flavor> is the name of the flavor whose locales you'd like to update:

.po files for a given flavor locale can be found in the src/flavors/<flavor>/locale/<language_tag>/LC_MESSAGES/messages.po file, where <flavor> is the name of the flavor and <language_tag> is the name of the language tag. Using the make-flavor-messages.js tool will create a new folder in the locale matching the new language. Translated .po files should be returned to the correct language folder in the locale directory to work correctly.

You may also wish to do the same for the base project itself:

node scripts/make-base-messages.js --set-new-locale=<language_tag>

For a new language locale

node scripts/make-base-messages.js

To update an existing locale

Marking content as localizable

Gettext will look for localizable content in two places: your flavor's config.yml file, and any jstemplates files defined by your flavor. When Gettext produces a .po file, it will ignore content unless that content is explicitly marked as localizable.

To mark content in your config.yml file as localizable, wrap it in the following way:

_(This string will be localized.)

This string will not.

To mark content in your jstemplates files as localizable, wrap it in the following way:

{{#_}}<p>This string will be localized.</p>{{/_}}

<p>This string will not.</p>

Using the in-app editor

Mapseed includes an in-app editor that you can use to update and hide places and comments on a per-dataset basis. Only authenticated administrators are allowed to make edits. Authentication is performed via third-party social media services (Twitter, Facebook, and Google+ are currently supported), so administrators will need an account on one of these services to use the editor.

Follow these instructions to grant administrator privileges to one or more users:

  1. If the user to whom you'd like to grant administrator privileges has previously logged into your app via a social media service, skip to the next step. Otherwise, you'll need to manually add the user before granting privileges. Follow these steps:

    • In the admin panel, click Users, then Add user +, then create a new User. The username you enter here is arbitrary, although for convenience it may match the social media username of the person to whom you'd like to grant administrator privileges. Note that you may add several user social auths under a single User.

    • Next, in the User social auths panel, click Add user social auth +, select the User you just created under User (or choose an existing User), enter the name of the social service provider (twitter, facebook, or google-oauth2), then enter the social user's Uid. The Uid can be looked up online: here for Twitter, and here for Facebook. For Google, the Uid is the user's email address.

  2. In the Django admin panel, click on Data sets and then the name of the dataset you'd like to grant administrator privileges for.

  3. Under the Groups section, create a new group called administrators if it doesn't already exist. Note that this group must be called administrators.

  4. Add users to whom you'd like to grant privileges by selecting the user in the Available submitters panel and clicking the right arrow to move them to the Chosen submitters panel.

  5. Click Edit permissions below the submitters panels, and grant retrieve, create, update, and destroy privileges. Also make sure that a * character is entered in the text box at left. The help text in the admin panel suggests that this box can be left blank, but this is in fact not true.

  6. Click Save.

  7. Now when any of the Chosen submitters are logged into your app via a social media service, an edit button will appear on place detail views that belong to datasets where they have administrator privileges. Administrators can edit the title and content of places, edit and delete individual comments, and hide entire places.

Maintainers

Contribute

Questions and issues should be filed right here on GitHub.

If you'd like to contribute code, we'd love to have it! Fork and submit a PR (base your branch off master). No change is too small!

Credits

Many features are powered by Shareabouts, an open-source project of OpenPlans.

License

GNU GPL

platform's People

Contributors

aplannersguide avatar atogle avatar bilal-io avatar brian393 avatar byollin avatar dependabot-preview[bot] avatar dependabot[bot] avatar dvalp avatar fkh avatar futuresoup avatar geli-gel avatar goldpbear avatar jalmogo avatar jogit82 avatar juliamae avatar julianmydlil avatar justbanks avatar maxburto avatar mechajauregui avatar mjumbewu avatar modulitos avatar ndkv avatar nlissar avatar pskeeper avatar slinkp avatar suisea avatar tlake avatar tmeasday avatar webpushers avatar zmbc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

platform's Issues

Figure out better UX for layer toggling

The layers icon that @Lukeswart put in is useful and minimalistic, but I think many users will miss it and not notice that they can toggle all kinds of interesting layers on our map.

If there were a clean way to keep the icon but still label the fact that you can toggle layers, using text in a non intrusive manner, that seems ideal

Remove "find an address" bar

It works, but it requires exact syntax and takes up a huge amount of real estate on small screens.

We should remove it for now, and consider a slim UI for it at a future date. Perhaps a little magnifying glass icon that expands for the address search.

Create tiled view of reports

We can currently see reports either as items in the Activity Stream on the sidebar, or in the "See all reports" list view here: http://heyduwamish.org/list

The information can be better displayed as tiles. Two layout are options are to have the tiles be the same size or have them be a variable size based on the length and size of the report.

(see attachments)

tiled-reports-samesize
tiled-reports-varioussize

Layer toggle view pushes out the target icon

Steps to reproduce:

  1. Hover the mouse over the layers icon to activate the layer toggle view
  2. Target icon (used to toggle location sharing) gets pushed out to the right and downward

Fix the marker shadows

The marker shadows don't properly line up with our markers, and the sizing is a bit funny

Change input options on form submission

When you submit a report, it is on the default Shareabouts config to ask for the "Type of Location" and lists

  • Landmark
  • School
  • Park

I'm thinking we want to change the title from "Type of Location" to "Report Type" and offer these three options

  • Observation [icon of an eye]
  • Idea [icon of a light bulb]
  • Question [icon of a question mark]

Add sidebar options to the config

Flavor configs need to have granular control over sidebar options like filters, layers, and activity stream. Right now they are hard coded.

Change language button from "I speak English" => "Hablo Español"

Right now the language menu says "I Speak English" then "Hablo Español"

I makes more sense imho to reverse the order because the site's already in English to begin with, so a Spanish speaking person wanting to switch should see Spanish as the first option, not English again.

disable html5 geolocation for desktop devices

let's say i'm in the university district and allowed html5 geolocation to detect my location.

the map zooms/pans to my location. now i have to zoom out and pan around to get back to the duwamish area.

it would be cool if some combination of these things could happen:

  • the js detects that i'm not on a mobile device and so doesn't automatically use html5 geolocation
  • there's a nearby or show my location button or something like that which triggers the geolocation
  • the map doesn't pan outside of the duwamish area when the geolocation happens

Write page descriptions

We have three pages

  1. About
  2. Background
  3. Contribute

I have content in mind for all of these, just need to draft and merge

Create and implement layer for cleanup sites

Right now we have junk data on our "freehand drawings" layer. It needs to be have real polygons, labels, media, etc. that properly showcase the cleanup sites over the next few years. We are deciding if this is best done through Mapbox or GeoServer

We want to prioritize the upcoming cleanup sites, but it would also would be good to show completed sites from the past like t117 if we can in this round.

Optimize UX when submitting a report on mobile devices

Preliminary tests on an iPhone 5c and some small screen Android device (forget which one) have shown that after hitting the "submit a report" button, the form is a bit hidden at the very bottom and requires scrolling to access.

Most users will probably miss this

Change the icons for submitted reports

The default icons for submitted reports are blue/green buttons and are not indicative of the content.

Issue #2 suggests three report types on the report form

  • Observation [icon of an eye]
  • Idea [icon of a light bulb]
  • Question [icon of a question mark]

Important note: when testing on a touch screen device, icons which are placed over a polygon are difficult to select. What happens is it selects the polygon label instead. So we'll want to test a wider area of transparency around the icon to widen the selection area and hopefully fix this...

Scale 'question' icons appropriately

The 'question' icons are not changing size, thus they remain significantly smaller than the 'idea' and 'observation' icons. Let's make all three icons scale appropriately

Move 'see all reports' next to 'submit a report'

The 'see all reports' button is a useful feature, and might be better served out of the already crowded top menu area, and over next to the 'submit a report' button.

Perhaps the two buttons can be the same size together, just different color.

Import freehand shapes from Mapbox project

Some additional items to be completed for importing freehand shapes:

Include marker icons on the points
Verify that the lines are produced correctly (haven't been tested)
Include the description under the title in the clickable popup
other???

Display filter state in the legend

When each filter is toggled, the option in the legend will display the current state.

Instead of the 'hide all' and 'show all' options, it'll just be one option to toggle the 'hide all show all' filter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.