Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoJSON Support #49

Closed
2 of 16 tasks
chpapa opened this issue Apr 6, 2017 · 3 comments
Closed
2 of 16 tasks

GeoJSON Support #49

chpapa opened this issue Apr 6, 2017 · 3 comments
Labels
section/Core skygear server/plugins/sdk

Comments

@chpapa
Copy link
Contributor

chpapa commented Apr 6, 2017

Description

Support GeoPolygon and Location storage, search by location and search by geometry.

API Design

Scenario

Put list of Scenario how developers will use this API

Sample Code

To save polygon

const polygon = new skygear.GeoJSON({
  "type": "Polygon",
  "coordinates": [[
    [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]
  ]]
});

To search geometry by location

const query = new skygear.Query(District);
const geoLocation = new skygear.Geolocation(22.283, 114.15);
query.containsValue('area', geoLocation);

To search location by geometry

const place = new Place({
  name: 'IFC HK',
  location: geoLocation,
});
skygear.publicDB.save(place);

const query = new skygear.Query(Place)
query.contains('location', polygon); 

To search geometry by geometry

const query = new skygear.Query(District);
query.containsValue('area', polygon);

Other geometry types

http://geojson.org/geojson-spec.html#appendix-a-geometry-examples

Point

{
  "type": "Point", 
  "coordinates": [102.0, 0.5]
}

LineString

{
  "type": "LineString",
  "coordinates": [
    [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
  ]
}

Polygon with interior rings

{ "type": "Polygon",
  "coordinates": [
    [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
    [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]
  ]
}

Multipolygon

{ "type": "MultiPolygon",
  "coordinates": [
    [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
    [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
     [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
    ]
}

API Design

Put Design and Specification here with links

Open Questions

Put a list of open questions here before a complete design / specification is decided

Related Issues

Progress Tracker

Advice

  • Specification Design Approval
    • Once you get LGTM from another Skygear Core Team Member, you can check this checkbox. And apply the "workflow/design-complete" label.
  • Coding
    • Use as many PRs as you need. Write tests in the same or different PRs, as is convenient for you.
    • API doc should goes in the same PR with the code.
    • As each PR is merged, add a comment to this issue referencing the PRs.
    • When you are done with the code, apply the "workflow/code-complete" label.
  • Guides
    • Write or modify guides and get them merged in https://github.com/skygeario/guides
    • When the PR of guides is merged, check this checkbox and apply the "workflow/guides-complete" label.
@chpapa chpapa added section/Core skygear server/plugins/sdk workflow/discussion labels Apr 6, 2017
@rickmak
Copy link
Member

rickmak commented Apr 6, 2017

@chpapa Do we want a committed HTTP request sample in this issue and put up a documentation?

@chpapa
Copy link
Contributor Author

chpapa commented Apr 6, 2017

Do we want a committed HTTP request sample in this issue and put up a documentation?

@rickmak sounds like a good idea.

@rickmak
Copy link
Member

rickmak commented Apr 7, 2017

@chpapa I revive the old protocol draft here: https://github.com/SkygearIO/skygear-server/wiki/Protocol-Auth

It should be outdated. I just put up for editing.

@chpapa chpapa changed the title Geo Support GeoJSON Support Apr 20, 2017
@chpapa chpapa modified the milestone: [Fall in love w/Skygear] DB is essential Jun 29, 2017
@chpapa chpapa removed this from the [Fall in love w/Skygear] DB is essential milestone Jul 28, 2017
@chpapa chpapa closed this as completed Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
section/Core skygear server/plugins/sdk
Projects
None yet
Development

No branches or pull requests

4 participants