-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support GeoPoint type #1981
Comments
The support for GeoPoint is not finished yet. I suggest turn this issue to be a feature. We can either leverage the Or implement a |
Added "feature" label. @raymondfeng what's your take on the direction we should take here? I see two options:
Either way, we need to improve Personally, I'd prefer the second option, as it provides a great opportunity to build infrastructure that will allow LB4 community to contribute further types in the future. |
@JorisPalings your model is storing GeoPoint types as |
@bajtos I created it through the |
Here is the code generating TypeScript types in AFAICT, it falls back to |
Shall we do a spike story for adding types like |
IIRC, @hacksparrow is already looking into this issue. |
@hacksparrow, since you're looking into this issue already, could you please add the acceptance criteria, so that the team can estimate? Thanks! |
@dhmlau the acceptance criteria for this issue would be simply, "App should start with GeoPoint support". We will miss the implementation and feature details of the as-yet-non-supported We also need to decide on the approaches suggested by @bajtos - #1981 (comment). |
This issue is labelled as a feature, the goal is to add support for GeoPoint to LB4. See my comments above for more details about the problems we need to fix and places to modify.
IMO, the app should not only start, but also correctly handle GeoPoint properties in incoming requests and outgoing responses. In the acceptance criteria, I'd like to see a description of the approach we decided to take and a (high-level) list of places in our code that need to be modified. |
@strongloop/loopback-maintainers, before we can get to the acceptance criteria, I think we probably need to discuss how we should enable the support of GeoPoint. There are 2 options proposed by @bajtos in #1981 (comment). PTAL. |
I have always found the LB3 GeoPoint type limiting, and have often desired support for other geospatial types (e.g. lines, polygons. etc.) and other geospatial relationship comparison operators (e.g. other than just near). I suggest LB4 (insead of / in addtion to) support GeoJSON types (i.e. GeoJsonObject, GeometryObject, or Geometry) as there are many support packages which simplify the implementation (e.g. for the Memory Connector). See:
P.S. Several weeks ago I tried implementing this as a value object and had difficulties because of how arrays of types are not well supported in LB4 (i.e. an array of numbers). |
Could you please open a new issue and provide more details? @b-admike is improving handling of nested properties (including arrays) at the moment, some of the issues may be already fixed by now. |
There is also an issue with type any
|
@hadasiddhant please open a new issue to discuss the type |
@JorisPalings @riyastir @malek0512 @ewrayjohnson can you give some details on the usecases you need this feature for ? Is this necessary for a specific backend or db querying ? we need some more details on this issue , to scope it and estimate, |
Hi,
than in side your class in property decorator
Now to insert from rest 'post' endpoint, in our model repository, we will be using 2 hooks
Both hook should be called inside the constructor.Example code
|
Problem Definitation :
Here we are focusing on inserting the data in 'Point' type data type.
Also I have not tried other queries like st_distance to find the distance from PointA to Point B Another approach can be we can store GeoJson data in data source, and can implement GeoJson schema. Please let me know if this helps. Also please let me know how to approach this. |
It says that GeoPoint is support here https://apidocs.strongloop.com/loopback-datasource-juggler/#geopoint Is it not actually supported? |
I will try to implement this in the next few days. I think it is necessary to have this functionality |
Hi guys, any news on the support for geopoint? |
Nothing advanced yet. Sorry for the inconvenience |
@frbuceta Is now the loopback 4 support geopoint? |
LB4 docs mention the geopoint as one of the available data types. At least we should update the doc to state that geopoint is not completed, till we have the feature. |
Makes sense. Would you @kursattokpinar like to open a pull request to update our docs? See https://loopback.io/doc/en/lb4/code-contrib-lb4.html#documentation and https://loopback.io/doc/en/lb4/submitting_a_pr.html to get started. |
Yes sure, happy to contribute. I have already gone over the contrib guides and set up my environment (it took while to configure Jekyll stuff and WSL). I am going to update Loopback Types page to include that development on Geopoint type is not completed yet. Do you have anything else to add @bajtos ? |
When someone will take care about this issue? I am building a new piece of software and the "GeoPoint" is critical, so from my POV loopback is on "question" if this is not going to come soon. |
Same here, I would like to use Loopback but without geopoints it is no option for the application I wanna code... It’s a basic feature in my opinion. |
I think we can simply use {lat:number,lng:number} instead of Geopoints and filter using where near clause |
The problem is not only one of querying, but the database connector needs to be aware of the correct datatype for proper mapping to the underlying database datatype. |
Still missing. is missing in "repository-json-schema" in "stringTypeToWrapper" |
I would like this feature too. Use case: JSON location data stored & retrieved from MySQL database. |
Hello, Kind Regards |
bump this feature, its been already a couple years in the making. Is the blocker really about being aware of the datatype? couldnt it just be a matter of configuration requirement? |
Hello here, any feedback about Geopoint support on loopback 4 ? |
This is too bad... I hacked my way into the SQLConnector and now it works flawlessly. The hardest part was to circumvent the error thrown by the json-schema thing. Instead of using geopoint type, I used object. Defining the mysql.dataType to point made the mysql column of the correct type. All that was left was to convert the GeoPoint object from the stringified object (because object types are stored as JSON) back to a correct value. Happens that the Connector is all ready to accept geopoint:
But since we cannot use the GoePoint type, I changed it to use the dataType value, while also converting the string back to object.
That way I can do without using GeoPoint type. That's very cumbersome and hackish. I think, since the issue is stale, that the loopback team should at least remove the blocker and just let it work as is, which is way better than telling your users to use another framework... |
Description/Steps to reproduce
I'm attempting to start my project by using
npm start
and get the following output:In one of my models, I have a property of type 'geopoint':
Upon closer inspection, no
case
is defined for the'geopoint'
type in the switch statement in@loopback/repository-json-schema/dist/src/build-schema.js
.Expected result
For the Loopback 4 project to start.
Additional information
node -e 'console.log(process.platform, process.arch, process.versions.node)'
showsdarwin x64 10.12.0
npm ls --prod --depth 0 | grep loopback
shows no outputThe text was updated successfully, but these errors were encountered: