Comments (5)
3 hrs
from csc-308-309-project.
Inputting data into a GeoJSONLayer
is more performant than using individual pins on the map. Simple GeoJSON for our artwork could look like this:
{
"type": "FeatureCollection",
"features" : [
{
"type": "Feature",
"id": 1,
"geometry": {
"type": "Point",
"coordinates": [12, 23]
},
"properties": {
artworks: [...]
}
}
]
}
Where:
- A Feature is just an object that goes on the map
- The feature collection is a list of all the artwork radius features
- Geometry is where the location and object type is stored (stuff that will determine placement on the map)
- Properties aren't shown on the map, but can be accessed when the user interacts with the element.
Until we can grab data from the backend, you can put this data in a art-areas.json
file and import it into your React component.
from csc-308-309-project.
Before displaying this on the map, you'll need an api token from MapBox. You can sign up here (totally free)
Once you have your default map set up, you can display the geojson like this:
import artAreasJSON from "art-areas.json"
...
<Map>
<GeoJSONLayer
data={artAreasJSON}
fillLayout={{ visibility: "visible" }}
fillPaint={{
"fill-color": "blue",
"fill-opacity": 0.4,
}}
/>
...
</Map>
``
from csc-308-309-project.
To respond to click events, add this listener to the geojson layer:
circleOnClick={handleClick}
...
function handleClick(e) {
// Respond to click
}
Then you can pass the targeted latitude and longitude to the compass.
from csc-308-309-project.
Took 3 hours
from csc-308-309-project.
Related Issues (20)
- Apply pycodestyle to backend and refactor messy code HOT 1
- Center Spinners HOT 1
- Rename NewAccount to SignUp HOT 1
- Fix GroupPage Artwork Overlap
- Fix duplicate sign-up popup HOT 1
- Rename all instances of "New Account" to "Sign up"
- Add Photos to Previously Discovered Artworks HOT 1
- Allow scrollable view of art images HOT 3
- Allow Users to Leave Groups HOT 1
- Add artwork to groups
- Set Up Authentication Route Guards
- Allow users to send invitations for and join groups HOT 1
- Zooming to pin doesn't center pin on screen with iOS Safari HOT 1
- Find specific error for sign up and login error HOT 1
- Add Toasts to Project HOT 1
- Fix metrics on the frontend HOT 1
- Build the "Create Group" Page
- Get user location on ArtSubmission Page HOT 1
- Add ability to upload profile pic HOT 2
- Apply Toasts to project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csc-308-309-project.