Code Monkey home page Code Monkey logo

Comments (2)

VanitySoft avatar VanitySoft commented on August 24, 2024

When creating a Model with FeatureCollection, the final output does not contain a "FeatureCollection" type.

JSONObject statusJSONObject = new JSONObject();
FeatureCollection featureCollection = new FeatureCollection();

for (final Event event :events) {
Feature feature = new Feature();
Point point = new Point( event.getLatitude(),event.getLongitude());
feature.setGeometry(point);
JSONObject jsonObject = new JSONObject();
final Map<String, Object> metadataItems = event.getMetaData();
if (metadataItems != null) {
for (final Entry<String, Object> entry : metadataItems
.entrySet()) {
jsonObject.put(entry.getKey(),
entry.getValue());
}
}
//Add event to properties.
jsonObject.put("email", event.getEmail());
feature.setProperties(jsonObject);
featureCollection.addFeature(feature);
}
JSONObject topNode = featureCollection.toJSON();

it topNode produces:
{
"features": [
{
"type": "Feature",
"properties": {....} }.

why is that? it SHOULD BE:
{
"type": "FeatureCollection",
"features": [
{ ....

is this a bug?? or am i implementing the code incorrectly? Please advise. - Jeryl Cook

from android-geojson.

cocoahero avatar cocoahero commented on August 24, 2024

While I can see the usefulness of such a feature, I believe such conversion is out of scope of this library, and would introduce an unwanted dependency on the Google Maps SDK.

@VanitySoft please file a separate issue if you are still having a problem.

from android-geojson.

Related Issues (11)

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.