{"id":17789267,"url":"https://github.com/filosganga/geogson","last_synced_at":"2025-05-08T20:57:37.772Z","repository":{"id":11267488,"uuid":"13671850","full_name":"filosganga/geogson","owner":"filosganga","description":"GeoJSON support for Google gson library","archived":false,"fork":false,"pushed_at":"2021-10-31T20:46:55.000Z","size":514,"stargazers_count":68,"open_issues_count":10,"forks_count":28,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-02-02T02:43:08.685Z","etag":null,"topics":["geojson","gson","java","json","jts"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/filosganga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-18T07:37:16.000Z","updated_at":"2025-01-01T22:34:55.000Z","dependencies_parsed_at":"2022-09-11T17:00:15.682Z","dependency_job_id":null,"html_url":"https://github.com/filosganga/geogson","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filosganga%2Fgeogson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filosganga%2Fgeogson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filosganga%2Fgeogson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filosganga%2Fgeogson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filosganga","download_url":"https://codeload.github.com/filosganga/geogson/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238044093,"owners_count":19407128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geojson","gson","java","json","jts"],"created_at":"2024-10-27T10:29:53.510Z","updated_at":"2025-02-10T02:03:56.791Z","avatar_url":"https://github.com/filosganga.png","language":"Java","funding_links":[],"categories":["地理空间"],"sub_categories":["文件同步"],"readme":"GeoJSON support for Gson\n====================================\n[![CircleCI](https://circleci.com/gh/filosganga/geogson.svg?style=svg)](https://circleci.com/gh/filosganga/geogson)\n[![Codacy Badge](https://api.codacy.com/project/badge/grade/adc1d942b0c84f7893fd2fa5afdf0dfd)](https://www.codacy.com/app/me_62/geogson)\n[![Download](https://api.bintray.com/packages/filosganga/maven/geogson/images/download.svg)](https://bintray.com/filosganga/maven/geogson/_latestVersion)\n\nThis library provide a minimal support to parse and write geo spatial entities\nusing the well known GeoJSON standard. I started write it because seems that\nthere are no extension to Gson available to support GeoJSON format, and it is\npretty common now across the new social application API.\n\nIf you are not familiar with the Gson library take a look at the [Gson project page](https://code.google.com/p/google-gson/).\n\nIf you are not familiar with the GeoJSON format, please take a look at the [The GeoJSON specification](http://geojson.org/geojson-spec.html).\n\n\n## Quick Start\nHow to use the GeoGson in few easy steps.\n\n### Add the Maven dependency to your pom.xml\nAdd the following statement to your pom.xml.\n\n```xml\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.github.filosganga\u003c/groupId\u003e\n   \u003cartifactId\u003egeogson-core\u003c/artifactId\u003e\n   \u003cversion\u003e1.2.21\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Register the TypeAdapterFactory with Gson\nUse the GsonBuilder to register the ``GeometryAdapterFactory`` supplied.\n\n```java\nGson gson = new GsonBuilder()\n   .registerTypeAdapterFactory(new GeometryAdapterFactory())\n   .create();\n```\n\n### Serialize and de-serialize with Gson\nNow your Gson instance is able to parse and write any Geometry instance using\nthe GeoJSON format.\n\n```java\nString json = \"{\\\"type\\\":\\\"Point\\\",\\\"coordinates\\\": [23.5,20.125]}\";\n\nPoint point = gson.fromJson(json, Point.class);\n\nString json = gson.toJson(point);\n\nGeometry geometry = gson.fromJson(json); // It will be an instance of Point.\n```\n\n## Additional modules:\nThere are currently only one additional module for GeoGSON, the Java Topology\nSuite (JTS) support.\n\nIf you are not familiar with the JTS library take a look at the [JTS Home Page](http://www.tsusiatsoftware.net/jts/main.html)\n\n### JTS support\nTo enable the JTS support, you need declare the geogson-jts dependency and\nregister the ``JtsAdapterFactory`` as well.\n\nIn ``pom.xml``:\n\n```xml\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.github.filosganga\u003c/groupId\u003e\n   \u003cartifactId\u003egeogson-jts\u003c/artifactId\u003e\n   \u003cversion\u003e1.2.21\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nThe Gson building code:\n\n```java\nGson gson = new GsonBuilder()\n   .registerTypeAdapterFactory(new JtsAdapterFactory())\n   .registerTypeAdapterFactory(new GeometryAdapterFactory())\n   .create();\n```\n\nPlease note that you need the ``GeometryAdapterFactory`` anyway. The JTS\nsupport is a thin layer on top of the native geometry domain.\n\nYou can optionally configure ``GeometryFactory`` as well. In this example all \nGeoJSON geometries are parsed as JTS geometries in WGS84 in centimeter precision:\n\n```java\nGson gson = new GsonBuilder()\n   .registerTypeAdapterFactory(new JtsAdapterFactory(\n       new GeometryFactory(new PrecisionModel(100), 4326)))\n   .registerTypeAdapterFactory(new GeometryAdapterFactory())\n   .create();\n```\n\n**Enjoy beer with your friends, and buy me one!**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilosganga%2Fgeogson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilosganga%2Fgeogson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilosganga%2Fgeogson/lists"}