{"id":427453,"date":"2024-07-26T09:00:46","date_gmt":"2024-07-26T09:00:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=427453"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=427453","title":{"rendered":"<span>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0435\u0439 \u0432 JPA \u0438 Spring Boot 3<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430. \u0412 \u043e\u0434\u0438\u043d \u0434\u0435\u043d\u044c \u0434\u043b\u044f \u043c\u043e\u0435\u0433\u043e pet-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u043b\u0438 \u044d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441 \u0432 \u0437\u043e\u043d\u0443 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438.\u00a0<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0440\u0430\u0437 \u0438 \u043e\u0431\u0447\u0435\u043b\u0441\u044f, \u0442\u043e \u0432\u043e\u0442 \u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 ?<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f, \u043a\u0430\u043a \u0441 \u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 sql \u0438 no-sql \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<h2>\u0413\u043b\u0430\u0432\u0430 1. \u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u0438\u0437 \u0434\u0430\u043b\u0435\u043a\u043e\u0433\u043e \u043a\u043e\u0441\u043c\u043e\u0441\u0430<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u043e\u0431\u044c\u0435\u043a\u0442 \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0443 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u043a Geometry, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 OGC (Open Geospatial Consortium). \u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.   <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/084\/221\/043\/084221043963c58dbfc0abc7831e7a9b.png\" alt=\"\u0412\u0441\u0435 \u0432\u0438\u0434\u044b \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 OGC 06-103r4 \u0437\u0430 2010 \u0433\u043e\u0434\" title=\"\u0412\u0441\u0435 \u0432\u0438\u0434\u044b \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 OGC 06-103r4 \u0437\u0430 2010 \u0433\u043e\u0434\" width=\"1902\" height=\"1203\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/084\/221\/043\/084221043963c58dbfc0abc7831e7a9b.png\"\/><\/p>\n<div><figcaption>\u0412\u0441\u0435 \u0432\u0438\u0434\u044b \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 OGC 06-103r4 \u0437\u0430 2010 \u0433\u043e\u0434<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0430\u043c \u0438\u0437 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043b\u0438\u0448\u044c Point \u0438 Polygon. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0438\u0434\u043e\u0432 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438, \u043d\u043e \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438. \u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043c\u044b \u043d\u0435 \u0441\u0442\u0440\u043e\u0438\u043c (\u044d\u0442\u043e \u043f\u043e\u043a\u0430, \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0434\u0435\u043c \u043a \u044d\u0442\u043e\u043c\u0443, \u043d\u0430\u043c \u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u043b\u044f \u043a\u0443\u0440\u044c\u0435\u0440\u0430, \u0432\u0435\u0440\u043d\u043e?).<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 Point, \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0430 &#8212; \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 0-\u043c\u0435\u0440\u043d\u044b\u0439 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0434\u043d\u043e \u043c\u0435\u0441\u0442\u043e \u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445. \u0418\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 X \u0438 Y.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 GeoJson<\/p>\n<pre><code class=\"json\">{  \"type\": \"Feature\",  \"properties\": {     \"name\": \"\u0422\u043e\u0447\u043a\u0430\"   },   \"geometry\": {     \"coordinates\": [-71.29611889288435, -14.408046706270259],      type\": \"Point\"   } }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e \u043f\u043b\u0430\u043d\u0443 Polygon. \u041f\u043e\u043b\u0438\u0433\u043e\u043d \u2014 \u044d\u0442\u043e \u043f\u043b\u043e\u0441\u043a\u0430\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c. \u0421\u043e\u0441\u0442\u043e\u0438\u0442 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438\u0437 4 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u0430\u044f, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u044c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/23b\/0da\/894\/23b0da894d01e3ec5586ecfa742d7e4c.png\" alt=\"\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c\u0438 \u0431\u044b\u0432\u0430\u044e\u0442, \u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e\" title=\"\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c\u0438 \u0431\u044b\u0432\u0430\u044e\u0442, \u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e\" width=\"1423\" height=\"481\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/23b\/0da\/894\/23b0da894d01e3ec5586ecfa742d7e4c.png\"\/><\/p>\n<div><figcaption>\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c\u0438 \u0431\u044b\u0432\u0430\u044e\u0442, \u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 GeoJson:<\/p>\n<pre><code class=\"json\">{       \"type\": \"Feature\",       \"properties\": {         \"name\": \"\u0414\u0430\u0436\u0435 \u043d\u0435 \u043f\u044b\u0442\u0430\u0439\u0442\u0435\u0441\u044c\"       },       \"geometry\": {         \"coordinates\": [           [             [               73.53858903225691,               55.0618396333995             ],             [               73.18414465774254,               55.06397418032029             ],             [               73.18785994493194,               54.891434295145984             ],             [               73.53857157115723,               54.88824517863438             ],             [               73.53858903225691,               55.0618396333995             ]           ]         ],         \"type\": \"Polygon\"       }     }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043c\u0435\u0442\u043a\u0438, \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 \u044d\u0442\u043e\u0442 GeoJson.<\/p>\n<blockquote>\n<p>The GeoJSON Specification (RFC 7946).\u00a0<\/p>\n<p>GeoJSON &#8212; \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>GeoJSON \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0438\u043f\u044b \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438: Point, LineString, Polygon, MultiPoint, MultiLineString \u0438 MultiPolygon. \u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 Feature. \u041d\u0430\u0431\u043e\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 FeatureCollection.<\/p>\n<p>\u0412 2015 \u0433\u043e\u0434\u0443 \u0420\u0430\u0431\u043e\u0447\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 (IETF) \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u0430\u0432\u0442\u043e\u0440\u0430\u043c\u0438 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0430 GeoJSON WG \u0434\u043b\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 GeoJSON. RFC 7946 \u0431\u044b\u043b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u0432 \u0430\u0432\u0433\u0443\u0441\u0442\u0435 2016 \u0433\u043e\u0434\u0430 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 GeoJSON, \u0437\u0430\u043c\u0435\u043d\u0438\u0432\u0448\u0435\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e GeoJSON 2008 \u0433\u043e\u0434\u0430.<\/p>\n<\/blockquote>\n<h3>\u0413\u043b\u0430\u0432\u0430 2. \u0420\u0430\u0437\u043b\u043e\u0436\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e \u043f\u043e\u043b\u043e\u0447\u043a\u0430\u043c<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u043a \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0430\u0431\u043e\u0442\u0435. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 Spring boot.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8f2\/18f\/a57\/8f218fa57687abe7ac9e6afc7871054e.png\" alt=\"Spring Initializr\" title=\"Spring Initializr\" width=\"2359\" height=\"998\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8f2\/18f\/a57\/8f218fa57687abe7ac9e6afc7871054e.png\"\/><\/p>\n<div><figcaption>Spring Initializr<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>Lombok\u00a0<\/p>\n<\/li>\n<li>\n<p>Spring Web<\/p>\n<\/li>\n<li>\n<p>Spring Data JPA<\/p>\n<\/li>\n<li>\n<p>PostgreSQL Driver<\/p>\n<\/li>\n<li>\n<p>Flyway Migration<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u043d\u0430\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL \u0441 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0433\u0435\u043e-\u0434\u0430\u043d\u043d\u044b\u043c\u0438.\u00a0<\/p>\n<p><strong>docker-compose.yml<\/strong><\/p>\n<pre><code class=\"yaml\">version: '3.8' name: \"geo-spring\" services:   postgres:     image: postgis\/postgis:15-3.4-alpine     container_name: postgres_geo_spring     restart: unless-stopped     environment:       PGUSER: PGCL_HABR       POSTGRES_USER: PGCL_HABR       POSTGRES_PASSWORD: PGCL_VERYSECURE       POSTGRES_DB: GEO_DB     volumes:       - pgdata:\/var\/lib\/postgresql\/data     ports:       - \"5454:5432\"     healthcheck:       test: [\"CMD-SHELL\", \"pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}\"]       interval: 5s       timeout: 5s       retries: 10     command: &gt;       postgres       -c shared_buffers=256MB       -c effective_cache_size=512MB       -c maintenance_work_mem=128MB       -c checkpoint_completion_target=0.7       -c wal_buffers=8MB       -c random_page_cost=2       -c effective_io_concurrency=1       -c work_mem=8192kB     networks:       - local  volumes:   cache:   pgdata:     driver: local  networks:   local:     driver: bridge<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 65 MB, \u0431\u0443\u0434\u044c\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b ?<\/p>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>application.yml<\/strong><\/p>\n<pre><code class=\"yaml\">spring:   application:     name: geo-spring-boot    datasource:     url: ${SPRING_DATASOURCE_URL:jdbc:postgresql:\/\/localhost:5454\/GEO_DB}     username: ${POSTGRES_USER:PGCL_HABR}     password: ${POSTGRES_PASSWORD:PGCL_VERYSECURE}     driver-class-name: org.postgresql.Driver    jpa:     hibernate:       ddl-auto: validate     show-sql: true    flyway:     user: ${POSTGRES_USER:PGCL_HABR}     password: ${POSTGRES_PASSWORD:PGCL_VERYSECURE}     default-schema: public     enabled: true<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a \u0436\u0435 \u0441\u0432\u0430\u0433\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c.<\/p>\n<pre><code class=\"xml\">&lt;dependency&gt; &lt;!-- swagger --&gt; &lt;groupId&gt;org.springdoc&lt;\/groupId&gt; &lt;artifactId&gt;springdoc-openapi-starter-webmvc-ui&lt;\/artifactId&gt; &lt;version&gt;2.3.0&lt;\/version&gt; &lt;\/dependency&gt;<\/code><\/pre>\n<p>\u0410 \u0442\u0430\u043a \u0436\u0435 \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u043a\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u044b \u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c.<\/p>\n<pre><code class=\"xml\">&lt;dependency&gt; &lt;groupId&gt;org.n52.jackson&lt;\/groupId&gt; &lt;artifactId&gt;jackson-datatype-jts&lt;\/artifactId&gt; &lt;version&gt;1.2.10&lt;\/version&gt; &lt;\/dependency&gt;<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Hibernate, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u043d\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<pre><code class=\"xml\">&lt;dependency&gt; &lt;!-- support postgis (need for jpql queries) --&gt; &lt;groupId&gt;org.hibernate.orm&lt;\/groupId&gt; &lt;artifactId&gt;hibernate-spatial&lt;\/artifactId&gt; &lt;\/dependency&gt;<\/code><\/pre>\n<p>\u041d\u0430\u0448 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b pom.xml<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt; &lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 https:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt; &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;  &lt;parent&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt; &lt;version&gt;3.3.2&lt;\/version&gt; &lt;relativePath\/&gt; &lt;\/parent&gt;  &lt;groupId&gt;com.habr.egribanov&lt;\/groupId&gt; &lt;artifactId&gt;geometry&lt;\/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt; &lt;name&gt;geometry&lt;\/name&gt;  &lt;properties&gt; &lt;java.version&gt;17&lt;\/java.version&gt; &lt;swagger.version&gt;2.3.0&lt;\/swagger.version&gt; &lt;jackson-datatype-jts.version&gt;1.2.10&lt;\/jackson-datatype-jts.version&gt; &lt;\/properties&gt;  &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;\/artifactId&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.flywaydb&lt;\/groupId&gt; &lt;artifactId&gt;flyway-core&lt;\/artifactId&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.flywaydb&lt;\/groupId&gt; &lt;artifactId&gt;flyway-database-postgresql&lt;\/artifactId&gt; &lt;\/dependency&gt;  &lt;dependency&gt; &lt;!-- support postgis (need for jpql queries) --&gt; &lt;groupId&gt;org.hibernate.orm&lt;\/groupId&gt; &lt;artifactId&gt;hibernate-spatial&lt;\/artifactId&gt; &lt;\/dependency&gt;  &lt;dependency&gt; &lt;groupId&gt;org.springdoc&lt;\/groupId&gt; &lt;artifactId&gt;springdoc-openapi-starter-webmvc-ui&lt;\/artifactId&gt; &lt;version&gt;${swagger.version}&lt;\/version&gt; &lt;\/dependency&gt;  &lt;dependency&gt; &lt;groupId&gt;org.n52.jackson&lt;\/groupId&gt; &lt;artifactId&gt;jackson-datatype-jts&lt;\/artifactId&gt; &lt;version&gt;${jackson-datatype-jts.version}&lt;\/version&gt; &lt;\/dependency&gt;  &lt;dependency&gt; &lt;groupId&gt;org.postgresql&lt;\/groupId&gt; &lt;artifactId&gt;postgresql&lt;\/artifactId&gt; &lt;scope&gt;runtime&lt;\/scope&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.projectlombok&lt;\/groupId&gt; &lt;artifactId&gt;lombok&lt;\/artifactId&gt; &lt;optional&gt;true&lt;\/optional&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt; &lt;scope&gt;test&lt;\/scope&gt; &lt;\/dependency&gt; &lt;\/dependencies&gt;  &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt; &lt;configuration&gt; &lt;excludes&gt; &lt;exclude&gt; &lt;groupId&gt;org.projectlombok&lt;\/groupId&gt; &lt;artifactId&gt;lombok&lt;\/artifactId&gt; &lt;\/exclude&gt; &lt;\/excludes&gt; &lt;\/configuration&gt; &lt;\/plugin&gt; &lt;\/plugins&gt; &lt;\/build&gt;  &lt;\/project&gt;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 \u043d\u0435\u0433\u043e GeoJson, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0442\u0440\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<p>1. \u041d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438.  <\/p>\n<pre><code class=\"java\">@Schema(description = \"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438, \u0444\u043e\u0440\u043c\u0430\u0442 GeoJson\") public record CreateZonesRequest(         @JsonProperty(\"type\")         @Schema(description = \"\u0422\u0438\u043f, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e FeatureCollection\", example = \"FeatureCollection\")         String type,          @JsonProperty(\"features\")         @Schema(description = \"\u0421\u043f\u0438\u0441\u043e\u043a \u0437\u043e\u043d\")         List&lt;GeoJsonFeatureDto&gt; features ) { }<\/code><\/pre>\n<p>2. \u0421\u0430\u043c\u0430 \u0437\u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f\u00a0GeometryDeserializer \u0438\u00a0GeometrySerializer \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 \u043d\u043e\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438.\u00a0<\/p>\n<pre><code class=\"java\">import org.locationtech.jts.geom.Geometry; import org.n52.jackson.datatype.jts.GeometryDeserializer; import org.n52.jackson.datatype.jts.GeometrySerializer;  @Schema(description = \"\u0417\u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\") public record GeoJsonFeatureDto(         @JsonProperty(\"type\")         @Schema(description = \"\u0422\u0438\u043f, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Feature\", example = \"Feature\")         String type,          @JsonProperty(\"properties\")         @Schema(description = \"\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\")         GeoJsonPropertiesDto properties,          @JsonDeserialize(using = GeometryDeserializer.class)         @JsonSerialize(using = GeometrySerializer.class)         @JsonProperty(\"geometry\")         @Schema(description = \"\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043e\u0431\u044a\u0435\u043a\u0442 GEOMETRY(Polygon, 4326)\")         Geometry geometry ) { }<\/code><\/pre>\n<p>3. \u041d\u0430\u0448\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438. \u0412 \u043d\u0438\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u043d\u0430\u043c \u0443\u0433\u043e\u0434\u043d\u043e, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0433\u043e\u0440\u043e\u0434, \u0440\u0430\u0439\u043e\u043d, \u0446\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0432 \u044d\u0442\u0443 \u0437\u043e\u043d\u0443 \u0438 \u0446\u0432\u0435\u0442 \u0437\u043e\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0432\u0438\u0434, \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u0437\u043e\u043d\u0443 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0432 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<pre><code class=\"java\">@Schema(description = \"\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\") public record GeoJsonPropertiesDto(         @JsonProperty(\"city\")         @Schema(description = \"\u0413\u043e\u0440\u043e\u0434\", example = \"\u0412\u043e\u043b\u0433\u043e\u0433\u0440\u0430\u0434\")         String city,          @JsonProperty(\"district\")         @Schema(description = \"\u0420\u0430\u0439\u043e\u043d\", example = \"\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0439\u043e\u043d\")         String district,          @JsonProperty(\"price_rub\")         @Schema(description = \"\u0426\u0435\u043d\u0430 \u0432 \u0440\u0443\u0431\u043b\u044f\u0445\", example = \"100\")         BigDecimal price,          @JsonProperty(\"fill\")         @Schema(description = \"\u0426\u0432\u0435\u0442 \u0437\u043e\u043d\u044b\", example = \"#37ab0d\")         String fill ) { }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0443\u0436\u0435 \u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438:<\/p>\n<p>1. \u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0442\u043e\u0447\u043a\u0438<\/p>\n<blockquote>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0433\u0435\u043e\u0434\u0435\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 X &#8212; \u044d\u0442\u043e \u0434\u043e\u043b\u0433\u043e\u0442\u0430, \u0430 Y &#8212; \u0448\u0438\u0440\u043e\u0442\u0430<\/p>\n<\/blockquote>\n<pre><code class=\"java\">@Schema(description = \"\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b\") public record LocationPointRequest(         @JsonProperty(\"latitudeY\")         @Schema(description = \"\u0428\u0438\u0440\u043e\u0442\u0430\", example = \"48.716496\")         Float latitudeY,          @JsonProperty(\"longitudeX\")         @Schema(description = \"\u0414\u043e\u043b\u0433\u043e\u0442\u0430\", example = \"44.530353\")         Float longitudeX ) { }<\/code><\/pre>\n<p>2. \u0423\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0432 \u044d\u0442\u0443 \u0437\u043e\u043d\u0443<\/p>\n<pre><code class=\"java\">@Schema(description = \"\u0423\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\") public record DeliveryTermsResponse(         @Schema(description = \"\u0413\u043e\u0440\u043e\u0434\")         @JsonProperty(\"city\")         String city,          @Schema(description = \"\u0420\u0430\u0439\u043e\u043d\")         @JsonProperty(\"district\")         String district,          @Schema(description = \"\u0426\u0435\u043d\u0430 \u0432 \u0440\u0443\u0431\u043b\u044f\u0445\")         @JsonProperty(\"price_rub\")         BigDecimal price ) { }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440<\/p>\n<pre><code class=\"java\">@RestController @RequiredArgsConstructor @Tag(name=\"\u0417\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\") @ApiResponses({         @ApiResponse(responseCode = \"200\", description = \"\u0417\u043e\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \/ \u0410\u0434\u0440\u0435\u0441 \u0432 \u0437\u043e\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\"),         @ApiResponse(responseCode = \"406\", description = \"\u0410\u0434\u0440\u0435\u0441 \u0432\u043d\u0435 \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\") }) class DeliveryController {     public static final String SAVE_DELIVERY_LOCATION_URL = \"\/v1\/location\";     public static final String DELIVERY_LOCATION_TERM_URL = \"\/v1\/location-term\";     public static final String DELIVERY_LOCATION_CHECK_URL = \"\/v1\/location-check\";      private final GeoService geoService;      @Operation(summary = \"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 GeoJson\")     @PostMapping(SAVE_DELIVERY_LOCATION_URL)     @ResponseStatus(HttpStatus.OK)     public void saveAllDeliveryZones(@RequestBody CreateZonesRequest geoJson) {         geoService.saveAllDeliveryZones(geoJson);     }      @Operation(summary = \"\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0432 \u044d\u0442\u0443 \u0437\u043e\u043d\u0443\")     @PostMapping(DELIVERY_LOCATION_TERM_URL)     @ResponseStatus(HttpStatus.OK)     public DeliveryTermsResponse getDeliveryTerms(@RequestBody LocationPointRequest request) {         return geoService.getDeliveryTerms(request);     }      @Operation(summary = \"\u041d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u0432 \u0437\u043e\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\")     @PostMapping(DELIVERY_LOCATION_CHECK_URL)     @ResponseStatus(HttpStatus.OK)     public void inDeliveryZone(@RequestBody LocationPointRequest request) {         geoService.inDeliveryZone(request);     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435, \u044d\u0442\u043e \u043a\u0430\u043a \u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<pre><code class=\"java\">@Repository public interface DeliveryLocationRepository extends JpaRepository&lt;DeliveryLocation, UUID&gt; {      @Query(\"\"\"             SELECT COUNT(loc) &gt; 0 FROM DeliveryLocation loc             WHERE ST_Contains(loc.polygon, ST_SetSRID(ST_MakePoint(:x, :y), 4326))             \"\"\")     boolean existsLocationContainingPoint(@Param(\"x\") double longitudeX, @Param(\"y\") double latitudeY);      @Query(\"\"\"             SELECT loc FROM DeliveryLocation loc             WHERE ST_Contains(loc.polygon, ST_SetSRID(ST_MakePoint(:x, :y), 4326))             \"\"\")     Optional&lt;DeliveryLocation&gt; findLocationByCoordinates(@Param(\"x\") double longitudeX, @Param(\"y\") double latitudeY);  }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0435\u043e-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u044d\u0442\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c JPQL, \u0430 \u0437\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u043d\u0435\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 hibernate-spatial.\u00a0<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0ST_Contains:<\/p>\n<pre><code class=\"java\">boolean ST_Contains(geometry geomA, geometry geomB);<\/code><\/pre>\n<p>\u041a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 true, \u0435\u0441\u043b\u0438 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f A \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438 B.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u043f\u043e\u043b\u0438\u0433\u043e\u043d \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b\u00a0DeliveryLocation, \u0430 \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044e \u0442\u0438\u043f\u0430 Point \u043f\u043e \u043d\u0430\u0448\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c. <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0443\u0436\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0446\u0438\u0444\u0440\u044b, \u044d\u0442\u043e \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0EPSG:4326 (\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430). \u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u0430\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f SRID=4326, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u00a0SRID=4269 \u0434\u043b\u044f \u0421\u0435\u0432\u0435\u0440\u043d\u043e\u0439 \u0410\u043c\u0435\u0440\u0438\u043a\u0438 \u0438 \u041a\u0430\u043d\u0430\u0434\u044b.\u00a0<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0438 \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043d\u0430\u0448\u0438 \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u0442\u043e\u0447\u043a\u0430 \u0432 \u043d\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u043e\u043d\u044b. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0447\u0442\u043e \u044d\u0442\u0438 \u0437\u043e\u043d\u044b \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0438\u043b\u0438 \u043a\u0430\u043a-\u0442\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c.<\/p>\n<pre><code class=\"java\">@Service @RequiredArgsConstructor public class DeliveryGeoService implements GeoService {     private final DeliveryLocationRepository locationRepository;     private final DeliveryLocationToTermsMapper locationToTermsMapper;      public void saveAllDeliveryZones(CreateZonesRequest geoJson) {         var zones = geoJson.features().stream()                 .map(feature -&gt; DeliveryLocation.builder()                         .city(feature.properties().city())                         .district(feature.properties().district())                         .price(feature.properties().price())                         .fill(feature.properties().fill())                         .polygon((Polygon) feature.geometry())                         .build())                 .toList();          locationRepository.saveAll(zones);     }      public DeliveryTermsResponse getDeliveryTerms(LocationPointRequest request) {         var location = locationRepository.findLocationByCoordinates(                 request.longitudeX(), request.latitudeY()         ).orElseThrow(() -&gt; new RestException(Message.ADDRESS_OUT_OF_DELIVERY_ZONE));          return locationToTermsMapper.toResponse(location);     }       @Override     public void inDeliveryZone(LocationPointRequest request) {         var isDeliverable = locationRepository.existsLocationContainingPoint(                 request.longitudeX(), request.latitudeY()         );         if (!isDeliverable) throw new RestException(Message.ADDRESS_OUT_OF_DELIVERY_ZONE);     } }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0411\u0414.<\/p>\n<pre><code class=\"sql\">-- Migration to create delivery_location table -- Author: EGribanov -- Date: 2024-07-24 -- Service: geo  create table if not exists delivery_location (     id                 UUID           NOT NULL PRIMARY KEY UNIQUE,     version            BIGINT         NOT NULL,     city               VARCHAR(50)    NOT NULL,     district           VARCHAR(50)    NOT NULL,     price_rub          NUMERIC(10, 2) NOT NULL,     fill               VARCHAR(10),     polygon            GEOMETRY(Polygon, 4326),     created_date       TIMESTAMP(6)   NOT NULL,     last_modified_date TIMESTAMP(6) );  CREATE INDEX polygons_geom_idx ON delivery_location USING GIST (polygon);<\/code><\/pre>\n<h3>\u0413\u043b\u0430\u0432\u0430 3. \u0413\u0434\u0435 \u0436\u0435 \u0432\u0437\u044f\u0442\u044c \u044d\u0442\u0438 \u0437\u043e\u043d\u044b<\/h3>\n<p>\u041a\u0430\u043a \u0442\u044b \u0443\u0436\u0435 \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u0430\u043c \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043d\u0430\u0434\u043e \u0433\u0434\u0435-\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u044d\u0442\u0438 \u0441\u0430\u043c\u044b\u0435 \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c geojson.io \u0438 \u043d\u0430\u0447\u0435\u0440\u0442\u0438\u043c \u043d\u0430\u0448\u0438 \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435. \u0412\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430\u043c \u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0435 fill, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4dd\/e3d\/e4b\/4dde3de4b34f70d9ffb237769c102b6f.png\" alt=\"\u0421\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b (\u0438 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438)\" title=\"\u0421\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b (\u0438 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438)\" width=\"2841\" height=\"1673\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4dd\/e3d\/e4b\/4dde3de4b34f70d9ffb237769c102b6f.png\"\/><\/p>\n<div><figcaption>\u0421\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b (\u0438 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438)<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b (\u0438 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438)<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0430\u0448 geoJson. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c, \u043e\u0442\u043a\u0440\u043e\u0435\u043c \u043d\u0430\u0448 \u0441\u0432\u0430\u0433\u0435\u0440 (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u043b\u0438, \u0442\u043e \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 <code>localhost:8080\/swagger-ui\/index.html<\/code>)<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a26\/454\/d65\/a26454d65a2e4eaf151d3a0b85a2392b.png\" alt=\"\u0425\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u043b\u0438\u0441\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c json \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0440\u0443\u043a\u0430\u043c\u0438\" title=\"\u0425\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u043b\u0438\u0441\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c json \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0440\u0443\u043a\u0430\u043c\u0438\" width=\"2713\" height=\"1019\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a26\/454\/d65\/a26454d65a2e4eaf151d3a0b85a2392b.png\"\/><\/p>\n<div><figcaption>\u0425\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u043b\u0438\u0441\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c json \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0440\u0443\u043a\u0430\u043c\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u043d\u0430\u0448 GeoJson \u0447\u0435\u0440\u0435\u0437 Swagger \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2a9\/37b\/88c\/2a937b88cefbfbe44f226c573c2febd1.png\" alt=\"TablePlus, \u0435\u0441\u043b\u0438 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\" title=\"TablePlus, \u0435\u0441\u043b\u0438 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\" width=\"2733\" height=\"456\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2a9\/37b\/88c\/2a937b88cefbfbe44f226c573c2febd1.png\"\/><\/p>\n<div><figcaption>TablePlus, \u0435\u0441\u043b\u0438 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u043e\u0442 \u0447\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b hibernate:<\/p>\n<pre><code class=\"sql\">insert into delivery_location  (city,created_date,district,fill,last_modified_date,polygon,price_rub,version,id)  values (?,?,?,?,?,?,?,?,?)<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0446\u0435\u043d\u0430, \u0446\u0432\u0435\u0442, \u043d\u043e \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u044d\u0442\u043e \u0441\u0442\u043e\u043b\u0431\u0435\u0446 polygon. \u0412 \u043d\u0435\u043c \u043c\u044b \u0432\u0438\u0434\u0438\u043c SRID=4326 \u0438 \u043d\u0430\u0448 \u043e\u0431\u044c\u0435\u043a\u0442 POLYGON \u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c, \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0445\u043e\u0447\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438, \u0430 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u043e\u0447\u043d\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443.<\/p>\n<p>\u0422\u0430\u043a\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u043a \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u043d\u0433 (\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043f\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443) \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0437\u0430 \u0441\u043a\u043e\u0431\u043a\u0438. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0432\u0445\u043e\u0434\u0438\u0442 \u043b\u0438 \u044d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441 \u0432 \u0437\u043e\u043d\u0443 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u00a0<code>\/v1\/location-check<\/code>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0432 \u043e\u0442\u0432\u0435\u0442 HTTP 200 OK, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">select count(dl1_0.id) &gt; 0  from delivery_location dl1_0  where st_contains(dl1_0.polygon,st_setsrid(st_makepoint(?,?),4326))<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0432\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441\u043e\u0441\u0435\u0434\u043d\u0435\u0433\u043e \u0433\u043e\u0440\u043e\u0434\u0430, \u043e\u043d \u044f\u0432\u043d\u043e \u043d\u0435 \u0432 \u0437\u043e\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/919\/6fd\/1f5\/9196fd1f55518a1b8803dec7a06cd2c5.png\" alt=\"\u0412\u0440\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\" title=\"\u0412\u0440\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\" width=\"2423\" height=\"1044\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/919\/6fd\/1f5\/9196fd1f55518a1b8803dec7a06cd2c5.png\"\/><\/p>\n<div><figcaption>\u0412\u0440\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443 HTTP 406 \u043a\u0430\u043a \u0438 \u043e\u0436\u0438\u0434\u0430\u043b\u0438.<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/13e\/d54\/5ef\/13ed545efb2c0d1296b66d7920650550.png\" alt=\"\u0421\u0443\u0449\u0438\u0435 \u043a\u043e\u043f\u0435\u0439\u043a\u0438\" title=\"\u0421\u0443\u0449\u0438\u0435 \u043a\u043e\u043f\u0435\u0439\u043a\u0438\" width=\"2419\" height=\"1030\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/13e\/d54\/5ef\/13ed545efb2c0d1296b66d7920650550.png\"\/><\/p>\n<div><figcaption>\u0421\u0443\u0449\u0438\u0435 \u043a\u043e\u043f\u0435\u0439\u043a\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"sql\">select dl1_0.id,dl1_0.city,dl1_0.created_date,dl1_0.district,dl1_0.fill,dl1_0.last_modified_date,dl1_0.polygon,dl1_0.price_rub,dl1_0.version  from delivery_location dl1_0  where st_contains(dl1_0.polygon,st_setsrid(st_makepoint(?,?),4326))<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u043e\u0431\u044c\u0435\u043a\u0442 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043d\u0430\u043c \u0438 \u043d\u0435 \u043d\u0430\u0434\u043e.<\/p>\n<h3>\u041f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438<\/h3>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u0432\u043e\u0442 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0435\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c JPA \u0438 Spring Boot 3. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u0431\u0430\u0437\u044b \u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043a\u0430\u0437 \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0439 \u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0440\u0435\u0441\u0442\u043e\u0440\u0430\u043d.<\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u0433\u0435\u043e-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 NoSQL \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u043e\u0439, \u043a\u0430\u043a MongoDB. \u0410 \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0445 \u0432\u043e\u0442 \u0446\u0435\u043b\u0435\u0439 \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u0431\u043e\u043b\u0435\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c H2GIS, \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0443\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u044d\u0442\u0438 \u0437\u043e\u043d\u044b.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430 <a href=\"https:\/\/github.com\/gribanoveu\/geometry-jpa\" rel=\"noopener noreferrer nofollow\">GitHub<\/a> (\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0443)<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/831566\/\"> https:\/\/habr.com\/ru\/articles\/831566\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430. \u0412 \u043e\u0434\u0438\u043d \u0434\u0435\u043d\u044c \u0434\u043b\u044f \u043c\u043e\u0435\u0433\u043e pet-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u043b\u0438 \u044d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441 \u0432 \u0437\u043e\u043d\u0443 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438.\u00a0<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0440\u0430\u0437 \u0438 \u043e\u0431\u0447\u0435\u043b\u0441\u044f, \u0442\u043e \u0432\u043e\u0442 \u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 ?<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f, \u043a\u0430\u043a \u0441 \u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 sql \u0438 no-sql \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<h2>\u0413\u043b\u0430\u0432\u0430 1. \u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u0438\u0437 \u0434\u0430\u043b\u0435\u043a\u043e\u0433\u043e \u043a\u043e\u0441\u043c\u043e\u0441\u0430<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u043e\u0431\u044c\u0435\u043a\u0442 \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0443 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u043a Geometry, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 OGC (Open Geospatial Consortium). \u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.   <\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u0441\u0435 \u0432\u0438\u0434\u044b \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 OGC 06-103r4 \u0437\u0430 2010 \u0433\u043e\u0434<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0430\u043c \u0438\u0437 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043b\u0438\u0448\u044c Point \u0438 Polygon. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0438\u0434\u043e\u0432 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438, \u043d\u043e \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438. \u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043c\u044b \u043d\u0435 \u0441\u0442\u0440\u043e\u0438\u043c (\u044d\u0442\u043e \u043f\u043e\u043a\u0430, \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0434\u0435\u043c \u043a \u044d\u0442\u043e\u043c\u0443, \u043d\u0430\u043c \u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u043b\u044f \u043a\u0443\u0440\u044c\u0435\u0440\u0430, \u0432\u0435\u0440\u043d\u043e?).<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 Point, \u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0430 &#8212; \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 0-\u043c\u0435\u0440\u043d\u044b\u0439 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0434\u043d\u043e \u043c\u0435\u0441\u0442\u043e \u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445. \u0418\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 X \u0438 Y.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 GeoJson<\/p>\n<pre><code class=\"json\">{  \"type\": \"Feature\",  \"properties\": {     \"name\": \"\u0422\u043e\u0447\u043a\u0430\"   },   \"geometry\": {     \"coordinates\": [-71.29611889288435, -14.408046706270259],      type\": \"Point\"   } }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e \u043f\u043b\u0430\u043d\u0443 Polygon. \u041f\u043e\u043b\u0438\u0433\u043e\u043d \u2014 \u044d\u0442\u043e \u043f\u043b\u043e\u0441\u043a\u0430\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c. \u0421\u043e\u0441\u0442\u043e\u0438\u0442 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438\u0437 4 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u0430\u044f, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u044c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c\u0438 \u0431\u044b\u0432\u0430\u044e\u0442, \u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 GeoJson:<\/p>\n<pre><code class=\"json\">{       \"type\": \"Feature\",       \"properties\": {         \"name\": \"\u0414\u0430\u0436\u0435 \u043d\u0435 \u043f\u044b\u0442\u0430\u0439\u0442\u0435\u0441\u044c\"       },       \"geometry\": {         \"coordinates\": [           [             [               73.53858903225691,               55.0618396333995             ],             [               73.18414465774254,               55.06397418032029             ],             [               73.18785994493194,               54.891434295145984             ],             [               73.53857157115723,               54.88824517863438             ],             [               73.53858903225691,               55.0618396333995             ]           ]         ],         \"type\": \"Polygon\"       }     }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043c\u0435\u0442\u043a\u0438, \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 \u044d\u0442\u043e\u0442 GeoJson.<\/p>\n<blockquote>\n<p>The GeoJSON Specification (RFC 7946).\u00a0<\/p>\n<p>GeoJSON &#8212; \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>GeoJSON \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0438\u043f\u044b \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438: Point, LineString, Polygon, MultiPoint, MultiLineString \u0438 MultiPolygon. \u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 Feature. \u041d\u0430\u0431\u043e\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 FeatureCollection.<\/p>\n<p>\u0412 2015 \u0433\u043e\u0434\u0443 \u0420\u0430\u0431\u043e\u0447\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 (IETF) \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u0430\u0432\u0442\u043e\u0440\u0430\u043c\u0438 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0430 GeoJSON WG \u0434\u043b\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 GeoJSON. RFC 7946 \u0431\u044b\u043b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u0432 \u0430\u0432\u0433\u0443\u0441\u0442\u0435 2016 \u0433\u043e\u0434\u0430 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 GeoJSON, \u0437\u0430\u043c\u0435\u043d\u0438\u0432\u0448\u0435\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e GeoJSON 2008 \u0433\u043e\u0434\u0430.<\/p>\n<\/blockquote>\n<h3>\u0413\u043b\u0430\u0432\u0430 2. \u0420\u0430\u0437\u043b\u043e\u0436\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e \u043f\u043e\u043b\u043e\u0447\u043a\u0430\u043c<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u043a \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0430\u0431\u043e\u0442\u0435. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 Spring boot.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>Spring Initializr<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>Lombok\u00a0<\/p>\n<\/li>\n<li>\n<p>Spring Web<\/p>\n<\/li>\n<li>\n<p>Spring Data JPA<\/p>\n<\/li>\n<li>\n<p>PostgreSQL Driver<\/p>\n<\/li>\n<li>\n<p>Flyway Migration<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u043d\u0430\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL \u0441 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0433\u0435\u043e-\u0434\u0430\u043d\u043d\u044b\u043c\u0438.\u00a0<\/p>\n<p><strong>docker-compose.yml<\/strong><\/p>\n<pre><code class=\"yaml\">version: '3.8' name: \"geo-spring\" services:   postgres:     image: postgis\/postgis:15-3.4-alpine     container_name: postgres_geo_spring     restart: unless-stopped     environment:       PGUSER: PGCL_HABR       POSTGRES_USER: PGCL_HABR       POSTGRES_PASSWORD: PGCL_VERYSECURE       POSTGRES_DB: GEO_DB     volumes:       - pgdata:\/var\/lib\/postgresql\/data     ports:       - \"5454:5432\"     healthcheck:       test: [\"CMD-SHELL\", \"pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}\"]       interval: 5s       timeout: 5s       retries: 10     command: &gt;       postgres       -c shared_buffers=256MB       -c effective_cache_size=512MB       -c maintenance_work_mem=128MB       -c checkpoint_completion_target=0.7       -c wal_buffers=8MB       -c random_page_cost=2       -c effective_io_concurrency=1       -c work_mem=8192kB     networks:       - local  volumes:   cache:   pgdata:     driver: local  networks:   local:     driver: bridge<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 65 MB, \u0431\u0443\u0434\u044c\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b ?<\/p>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>application.yml<\/strong><\/p>\n<pre><code class=\"yaml\">spring:   application:     name: geo-spring-boot    datasource:     url: ${SPRING_DATASOURCE_URL:jdbc:postgresql:\/\/localhost:5454\/GEO_DB}     username: ${POSTGRES_USER:PGCL_HABR}     password: ${POSTGRES_PASSWORD:PGCL_VERYSECURE}     driver-class-name: org.postgresql.Driver    jpa:     hibernate:       ddl-auto: validate     show-sql: true    flyway:     user: ${POSTGRES_USER:PGCL_HABR}     password: ${POSTGRES_PASSWORD:PGCL_VERYSECURE}     default-schema: public     enabled: true<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a \u0436\u0435 \u0441\u0432\u0430\u0433\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c.<\/p>\n<pre><code class=\"xml\">&lt;dependency&gt; &lt;!-- swagger --&gt; &lt;groupId&gt;org.springdoc&lt;\/groupId&gt; &lt;artifactId&gt;springdoc-openapi-starter-webmvc-ui&lt;\/artifactId&gt; &lt;version&gt;2.3.0&lt;\/version&gt; &lt;\/dependency&gt;<\/code><\/pre>\n<p>\u0410 \u0442\u0430\u043a \u0436\u0435 \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u043a\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u044b \u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c.<\/p>\n<pre><code class=\"xml\">&lt;dependency&gt; &lt;groupId&gt;org.n52.jackson&lt;\/groupId&gt; &lt;artifactId&gt;jackson-datatype-jts&lt;\/artifactId&gt; &lt;version&gt;1.2.10&lt;\/version&gt; &lt;\/dependency&gt;<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Hibernate, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u043d\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<pre><code class=\"xml\">&lt;dependency&gt; &lt;!-- support postgis (need for jpql queries) --&gt; &lt;groupId&gt;org.hibernate.orm&lt;\/groupId&gt; &lt;artifactId&gt;hibernate-spatial&lt;\/artifactId&gt; &lt;\/dependency&gt;<\/code><\/pre>\n<p>\u041d\u0430\u0448 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b pom.xml<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt; &lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 https:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt; &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;  &lt;parent&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt; &lt;version&gt;3.3.2&lt;\/version&gt; &lt;relativePath\/&gt; &lt;\/parent&gt;  &lt;groupId&gt;com.habr.egribanov&lt;\/groupId&gt; &lt;artifactId&gt;geometry&lt;\/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt; &lt;name&gt;geometry&lt;\/name&gt;  &lt;properties&gt; &lt;java.version&gt;17&lt;\/java.version&gt; &lt;swagger.version&gt;2.3.0&lt;\/swagger.version&gt; &lt;jackson-datatype-jts.version&gt;1.2.10&lt;\/jackson-datatype-jts.version&gt; &lt;\/properties&gt;  &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;\/artifactId&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.flywaydb&lt;\/groupId&gt; &lt;artifactId&gt;flyway-core&lt;\/artifactId&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.flywaydb&lt;\/groupId&gt; &lt;artifactId&gt;flyway-database-postgresql&lt;\/artifactId&gt; &lt;\/dependency&gt;  &lt;dependency&gt; &lt;!-- support postgis (need for jpql queries) --&gt; &lt;groupId&gt;org.hibernate.orm&lt;\/groupId&gt; &lt;artifactId&gt;hibernate-spatial&lt;\/artifactId&gt; &lt;\/dependency&gt;  &lt;dependency&gt; &lt;groupId&gt;org.springdoc&lt;\/groupId&gt; &lt;artifactId&gt;springdoc-openapi-starter-webmvc-ui&lt;\/artifactId&gt; &lt;version&gt;${swagger.version}&lt;\/version&gt; &lt;\/dependency&gt;  &lt;dependency&gt; &lt;groupId&gt;org.n52.jackson&lt;\/groupId&gt; &lt;artifactId&gt;jackson-datatype-jts&lt;\/artifactId&gt; &lt;version&gt;${jackson-datatype-jts.version}&lt;\/version&gt; &lt;\/dependency&gt;  &lt;dependency&gt; &lt;groupId&gt;org.postgresql&lt;\/groupId&gt; &lt;artifactId&gt;postgresql&lt;\/artifactId&gt; &lt;scope&gt;runtime&lt;\/scope&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.projectlombok&lt;\/groupId&gt; &lt;artifactId&gt;lombok&lt;\/artifactId&gt; &lt;optional&gt;true&lt;\/optional&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt; &lt;scope&gt;test&lt;\/scope&gt; &lt;\/dependency&gt; &lt;\/dependencies&gt;  &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt; &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt; &lt;configuration&gt; &lt;excludes&gt; &lt;exclude&gt; &lt;groupId&gt;org.projectlombok&lt;\/groupId&gt; &lt;artifactId&gt;lombok&lt;\/artifactId&gt; &lt;\/exclude&gt; &lt;\/excludes&gt; &lt;\/configuration&gt; &lt;\/plugin&gt; &lt;\/plugins&gt; &lt;\/build&gt;  &lt;\/project&gt;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 \u043d\u0435\u0433\u043e GeoJson, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0442\u0440\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<p>1. \u041d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438.  <\/p>\n<pre><code class=\"java\">@Schema(description = \"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438, \u0444\u043e\u0440\u043c\u0430\u0442 GeoJson\") public record CreateZonesRequest(         @JsonProperty(\"type\")         @Schema(description = \"\u0422\u0438\u043f, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e FeatureCollection\", example = \"FeatureCollection\")         String type,          @JsonProperty(\"features\")         @Schema(description = \"\u0421\u043f\u0438\u0441\u043e\u043a \u0437\u043e\u043d\")         List&lt;GeoJsonFeatureDto&gt; features ) { }<\/code><\/pre>\n<p>2. \u0421\u0430\u043c\u0430 \u0437\u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f\u00a0GeometryDeserializer \u0438\u00a0GeometrySerializer \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 \u043d\u043e\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438.\u00a0<\/p>\n<pre><code class=\"java\">import org.locationtech.jts.geom.Geometry; import org.n52.jackson.datatype.jts.GeometryDeserializer; import org.n52.jackson.datatype.jts.GeometrySerializer;  @Schema(description = \"\u0417\u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\") public record GeoJsonFeatureDto(         @JsonProperty(\"type\")         @Schema(description = \"\u0422\u0438\u043f, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Feature\", example = \"Feature\")         String type,          @JsonProperty(\"properties\")         @Schema(description = \"\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\")         GeoJsonPropertiesDto properties,          @JsonDeserialize(using = GeometryDeserializer.class)         @JsonSerialize(using = GeometrySerializer.class)         @JsonProperty(\"geometry\")         @Schema(description = \"\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043e\u0431\u044a\u0435\u043a\u0442 GEOMETRY(Polygon, 4326)\")         Geometry geometry ) { }<\/code><\/pre>\n<p>3. \u041d\u0430\u0448\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438. \u0412 \u043d\u0438\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u043d\u0430\u043c \u0443\u0433\u043e\u0434\u043d\u043e, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0433\u043e\u0440\u043e\u0434, \u0440\u0430\u0439\u043e\u043d, \u0446\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0432 \u044d\u0442\u0443 \u0437\u043e\u043d\u0443 \u0438 \u0446\u0432\u0435\u0442 \u0437\u043e\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0432\u0438\u0434, \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u0437\u043e\u043d\u0443 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0432 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<pre><code class=\"java\">@Schema(description = \"\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u043e\u043d\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438\") public record GeoJsonPropertiesDto( <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-427453","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/427453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=427453"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/427453\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=427453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=427453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=427453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}