{"id":362738,"date":"2024-05-21T01:41:08","date_gmt":"2024-05-21T01:41:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=362738"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=362738","title":{"rendered":"<span>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430<\/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>TL;DR<\/p>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u043e\u0432 \u0441 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430, \u0440\u0430\u0437\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0438\u0434\u043e\u0432 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430, \u0442\u043e\u043b\u0449\u0438\u043d\u0430 \u0438 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u043b\u0438\u043d\u0438\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430. \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439 \u0442\u0443\u0442:<\/p>\n<p><a href=\"https:\/\/github.com\/dragoon\/cityliner\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/dragoon\/cityliner<\/a><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fef\/2d0\/b3f\/fef2d0b3f425e1ff0991bea59c1c3234.png\" width=\"2035\" height=\"1414\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fef\/2d0\/b3f\/fef2d0b3f425e1ff0991bea59c1c3234.png\"\/><\/figure>\n<h3>\u0418\u0441\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p>\u041e\u043a\u043e\u043b\u043e 10 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u041c\u0430\u0439\u043a\u043b \u041c\u044e\u043b\u043b\u0435\u0440 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 <a href=\"https:\/\/github.com\/cmichi\/gtfs-visualizations\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/cmichi\/gtfs-visualizations<\/a> \u043d\u0430 \u0441\u043c\u0435\u0441\u0438 JavaScript\/Node.js \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 GTFS \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Processing\" rel=\"noopener noreferrer nofollow\"><abbr class=\"habraabbr\" title=\"\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Java\" data-title=\"&lt;p>\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439&amp;nbsp;&lt;a href=&quot;https:\/\/ru.wikipedia.org\/wiki\/%D0%AF%D0%B7%D1%8B%D0%BA_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F&quot;>\u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f&lt;\/a>, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430&amp;nbsp;&lt;a href=&quot;https:\/\/ru.wikipedia.org\/wiki\/Java&quot;>Java&lt;\/a>&lt;\/p>&#187; data-abbr=&#187;Processing&#187;>Processing<\/abbr><\/a> \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 PDF. \u041c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u044d\u0442\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0438 \u044f  \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0435\u0433\u043e \u043a\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u0430, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0440\u0430\u0434\u0438\u0443\u0441\u0443, \u0438 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0444\u0430\u0439\u043b\u044b \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u043b\u0438\u0441\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432 \u043f\u0430\u043c\u044f\u0442\u044c (\u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u0434\u0430\u0436\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430).<\/p>\n<p>\u041f\u0430\u0440\u0443 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430\u0437\u0430\u0434 \u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 c \u043d\u0443\u043b\u044f \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u0442\u0435\u043c\u044b \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u043e\u0434\u043e\u0435\u043c\u043e\u0432, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0435\u0440\u0430 \u0441 \u0438\u043a\u043e\u043d\u043a\u0430\u043c\u0438 \u0433\u043e\u0440\u043e\u0434\u043e\u0432.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h3>GTFS \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p><strong>GTFS (General Transit Feed Specification)<\/strong> \u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u043d \u0431\u044b\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d Google \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043a\u0430\u0440\u0442, \u0441\u0435\u0439\u0447\u0430\u0441 \u0434\u0435-\u0444\u0430\u043a\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430. \u0415\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 (static) \u0438 real-time \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u0430\u0439\u043b <code>shapes.txt<\/code>. \u042d\u0442\u043e \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0438 \u043d\u0435 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442, \u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u043d\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u043b\u0438\u043b\u0438\u043d\u0438\u0439.<\/p>\n<h3>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/h3>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u0442\u0435\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><strong>\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0446\u0435\u043d\u0442\u0440\u0430 \u043a\u0430\u0440\u0442\u044b (\u0448\u0438\u0440\u043e\u0442\u0430\/\u0434\u043e\u043b\u0433\u043e\u0442\u0430)<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u0441\u0442\u0435\u0440\u0430 (\u0432\u044b\u0441\u043e\u0442\u0430\/\u0448\u0438\u0440\u0438\u043d\u0430 \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445)<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e Y (\u043a\u043c)<\/strong>: \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e X \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u043f\u043e\u0441\u0442\u0435\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 GTFS<\/h3>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u0435\u0437\u0434\u043e\u043a (trips)<\/h4>\n<p>\u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u043e\u0435\u0437\u0434\u043a\u0430\u043c (<code>trips<\/code>) \u0432 GTFS, \u0441\u0447\u0438\u0442\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043b\u0438\u043d\u0438\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 (<code>shape_id<\/code> ) \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 (<code>route_type<\/code>):<\/p>\n<pre><code class=\"python\">def _get_trips_and_routes(self) -> Tuple[dict, dict]:     route_id_types = self._get_route_id_types()     route_types = {}     # count the trips on a certain id     trips_on_a_shape = defaultdict(lambda: 0)      for shape_id, route_id in self._parse_trips():         trips_on_a_shape[shape_id] += 1         route_type = route_id_types[route_id]         if shape_id not in route_types:             route_types[shape_id] = route_type          return route_types, trips_on_a_shape  # route_types = {\"shape_id\": route_type, ...} # trips_on_a_shape = {\"shape_id\": N_trips, ...}<\/code><\/pre>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u0438\u043d\u0438\u0439 (shapes)<\/h4>\n<p>\u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c <code>shapes<\/code> \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0435, \u0447\u0442\u043e \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430:<\/p>\n<pre><code class=\"python\">def _get_sequences(self, center_point: Point, max_dist: MaxDistance) -> dict:     logging.debug(\"Starting shape iteration...\")     sequences = defaultdict(dict)     for shape_id, shape_pt_lat, shape_pt_lon, shape_pt_sequence, shape_row in self._parse_shapes():         # check out of boundaries         if is_allowed_point(Point(float(shape_pt_lat), float(shape_pt_lon)), center_point, max_dist):             sequences[shape_id][shape_pt_sequence] = shape_row return sequences  ##  sequences = {\"shape_id\": {\"1\": {lat\/lon\/...}, \"2\": {lat\/lon\/...}, ...} , ...}<\/code><\/pre>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/h4>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435, \u0435\u0433\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0438 \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430:<\/p>\n<pre><code class=\"python\">segments.append({                   \"trips\": trips_n,                   \"coordinates\": pts,                   \"route_type\": route_type         }) ##  segments = [{\"trips\": N_trips, \"coordinates\": [{lat\/lon}, ...], \"route_type\": route_type}, ...]<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435\/\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0445 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u043c\u043a\u0443 (bounding box):<\/p>\n<pre><code class=\"python\">if trips_n > max_trips:     max_trips = trips_n  if trips_n &lt; min_trips:     min_trips = trips_n  for seq, shape in shape_sequences.items():     y = float(shape['shape_pt_lat'])     x = float(shape['shape_pt_lon'])     min_left = min(x, min_left)     min_bottom = min(y, min_bottom)     max_top = max(y, max_top)     max_right = max(x, max_right<\/code><\/pre>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/h4>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0448\u0438\u0440\u043e\u0442\u0443\/\u0434\u043e\u043b\u0433\u043e\u0442\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043f\u043e x, y (\u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445):<\/p>\n<pre><code class=\"python\">def coord2px(lat: float, lng: float, bbox: BoundingBox):     coord_x = bbox.width \/ 2 + (lng - bbox.center.lon) * bbox.scale_factor_lon     coord_y = bbox.height \/ 2 - (lat - bbox.center.lat) * bbox.scale_factor_lat     return {'x': int(coord_x), 'y': int(coord_y)}<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0417\u0435\u043c\u043b\u0438, \u0442\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e: \u0446\u0435\u043d\u0442\u0440 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 (0,0) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u0446\u0435\u043d\u0442\u0440\u0430 \u043a\u0430\u0440\u0442\u044b (\u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432), \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0448\u0438\u0440\u043e\u0442\u044b \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u044b:<\/p>\n<pre><code class=\"python\">@dataclass(frozen=True) class BoundingBox: ...     @property     def scale_factor_lat(self):         return self.render_area.height_px \/ max(abs(self.center.lat - self.top),                                                 abs(self.center.lat - self.bottom))     @property     def scale_factor_lon(self):         return self.render_area.width_px \/ max(abs(self.center.lon - self.left),                                                abs(self.center.lon - self.right))   <\/code><\/pre>\n<p>\u0413\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0448\u0438\u0440\u043e\u0442\u0430 \u043e\u0442 50 \u0434\u043e 51, \u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 1000, \u0442\u043e 1 \u0433\u0440\u0430\u0434\u0443\u0441 \u0448\u0438\u0440\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u0441\u043f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u0432 1000 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0442\u0440\u0435\u043c\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c\u0438: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0435\u0437\u0434\u043e\u043a, \u0442\u0438\u043f\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0438 \u0441\u043f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.<\/p>\n<h3>\u0412\u043e\u0434\u043e\u0435\u043c\u044b<\/h3>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c \u0432\u043e\u0434\u043e\u0435\u043c\u043e\u0432 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438\u0437 <a href=\"https:\/\/www.openstreetmap.org\/\" rel=\"noopener noreferrer nofollow\">OpenStreetMap<\/a>.<\/p>\n<p>\u041c\u043e\u0440\u044f \u0438 \u043e\u043a\u0435\u0430\u043d\u044b \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0441 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430\u043c\u0438 \u043e\u0442 OpenStreetMap \u0447\u0435\u0440\u0435\u0437 GeoPandas \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u043c\u043a\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e shapely:<\/p>\n<pre><code class=\"python\">import geopandas as gpd from shapely.geometry import box  water_gdf = gpd.read_file('oceans\/water_polygons.shp') bbox = box(bbox_orig.left, bbox_orig.bottom, bbox_orig.right, bbox_orig.top) filtered_water_gdf = water_gdf[water_gdf.geometry.intersects(bbox)]<\/code><\/pre>\n<p>\u0424\u0430\u0439\u043b \u0441 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/osmdata.openstreetmap.de\/data\/water-polygons.html\" rel=\"noopener noreferrer nofollow\">https:\/\/osmdata.openstreetmap.de\/data\/water-polygons.html<\/a>\u00a0(WGS84 Projection).<\/p>\n<p>\u0420\u0435\u043a\u0438, \u043e\u0437\u0435\u0440\u0430 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0440\u0443\u0447\u0435\u0439\u043a\u0438 \u0437\u0430\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/overpass-turbo.eu\/\" rel=\"noopener noreferrer nofollow\">Overpass Turbo<\/a> API \u043f\u043e \u0442\u043e\u0439 \u0436\u0435 \u0440\u0430\u043c\u043a\u0435 (\u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e):<\/p>\n<pre><code class=\"python\">overpass_url = \"&lt;https:\/\/overpass-api.de\/api\/interpreter>\"     query = f\"\"\"     [out:json][bbox:{bbox.bottom},{bbox.left},{bbox.top},{bbox.right}];     (       relation[\"natural\"=\"water\"][\"water\"~\"lake|river|pond|reservoir|stream|canal\"];       way(r);       way[\"natural\"=\"water\"][\"water\"~\"lake|river|pond|reservoir|stream|canal\"];     );     out tags body;     >;     out tags skel qt;     \"\"\"     response = requests.get(overpass_url, params={'data': query}) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0434\u043e\u0435\u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0432 JSON \u0444\u043e\u0440\u043c\u0430\u0442\u0435.<\/p>\n<h3>\u041f\u043e\u0441\u0442\u0435\u0440<\/h3>\n<p>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0442 Processing \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432 PDF, \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435 \u044f \u043d\u0430\u0448\u0435\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/pypi.org\/project\/reportlab\/\" rel=\"noopener noreferrer nofollow\">ReportLab<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 ReportLab \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 (\u043c\u0438\u043b\u043b\u0438\u043c\u0435\u0442\u0440\u044b\/\u0434\u044e\u0439\u043c\u044b), \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"python\">c = canvas.Canvas(str(self.out_path), pagesize=(A0[0], A0[1])) c.scale(A0[0] \/ self.render_area.width_px, A0[1] \/ self.render_area.height_px)<\/code><\/pre>\n<h4>\u0412\u043e\u0434\u043e\u0435\u043c\u044b<\/h4>\n<p>ReportLab \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0434\u043e\u0435\u043c\u044b \u0440\u0438\u0441\u0443\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u043c\u0438. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0433\u0440\u0430\u043d\u0438\u0446 \u0432\u043e\u0434\u043e\u0435\u043c\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c:<\/p>\n<pre><code class=\"python\">for body in water_bodies:     points = [coord for point in body[\"nodes\"] for coord in (point[\"x\"], point[\"y\"])]     # Add a Polygon or any other shapes to the Drawing     if len(points) > 2:         polygon = Polygon(points, fillColor='#0e142a')         d.add(polygon) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0437\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0440\u043e\u0432\u0430 (<code>interiors<\/code>) \u0447\u0435\u0440\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430\u043c\u0438 \u043f\u043e\u0432\u0435\u0440\u0445:<\/p>\n<pre><code class=\"python\"># add islands with black on top if \"interiors\" in body:     for interior in body[\"interiors\"]:         int_points = [coord for point in interior for coord in (point[\"x\"], point[\"y\"])]         if len(int_points) > 2:             polygon = Polygon(int_points, fillColor='#000000')             d.add(polygon)<\/code><\/pre>\n<h4>\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u043b\u0438\u043b\u0438\u043d\u0438\u0439.<\/p>\n<p>\u041a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0446\u0432\u0435\u0442 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043b\u0438\u0442\u0440\u044b. \u0422\u043e\u043b\u0449\u0438\u043d\u0430 \u043b\u0438\u043d\u0438\u0438 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0443 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u0435\u0437\u0434\u043e\u043a, \u0430 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435, \u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u043a\u0430\u0440\u0442\u0435, \u043d\u043e \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 0.2:<\/p>\n<pre><code class=\"python\">factor = 1.7 stroke_weight = math.log(float(trips) * factor) * 3 if stroke_weight &lt; 0:     stroke_weight = 1.0 * factor alph = 100 * (float(trips) \/ max_trips) if alph &lt; 20.0:     alph = 20.0 <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0432\u043e\u0434\u043d\u044b\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u043b\u0438\u043d\u0438\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 0.4, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0445 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0440\u0443\u0433\u0438\u0445.<\/p>\n<h4>\u0422\u0435\u043a\u0441\u0442 \u0438 \u0438\u043a\u043e\u043d\u043a\u0438 \u0433\u043e\u0440\u043e\u0434\u0430<\/h4>\n<p>\u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u043a\u043e\u043d\u043a\u0438 \u0433\u043e\u0440\u043e\u0434\u0430, \u0440\u0435\u0433\u0438\u043e\u043d\u0430 \u0438\/\u0438\u043b\u0438 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430\/\u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u0443 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d5f\/a56\/d52\/d5fa56d52f08c3b1debbc2b7f4b3eea4.png\" alt=\"template.png\" title=\"\" width=\"900\" height=\"182\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d5f\/a56\/d52\/d5fa56d52f08c3b1debbc2b7f4b3eea4.png\"\/><\/figure>\n<h4>\u041d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435<\/h4>\n<p>\u0411\u044b\u043b\u043e \u0431\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442 \u0437\u0430\u0442\u0443\u0445\u0430\u043d\u0438\u044f (fade out) \u043f\u043e \u043a\u0440\u0430\u044f\u043c \u043f\u043e\u0441\u0442\u0435\u0440\u0430.<\/p>\n<p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043d\u0430\u0448\u0435\u043b \u2014 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/python-pillow.org\/\" rel=\"noopener noreferrer nofollow\">Pillow<\/a>. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0437-\u0437\u0430 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0442\u0435\u043a\u0441\u0442 \u0438 \u0438\u043a\u043e\u043d\u043a\u0438 \u043d\u0430 \u043a\u0440\u0430\u044f\u0445 \u043f\u043e\u0441\u0442\u0435\u0440\u0430 \u0442\u043e\u0436\u0435 \u201c\u0437\u0430\u0442\u0443\u0445\u0430\u044e\u0442\u201d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0438 \u0438\u043a\u043e\u043d\u043a\u0438 \u0443\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Pillow \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u043a\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d4f\/79b\/3d2\/d4f79b3d2e1abd4a61b9f89497372937.png\" width=\"1656\" height=\"2341\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d4f\/79b\/3d2\/d4f79b3d2e1abd4a61b9f89497372937.png\"\/><\/figure>\n<p>\u041f\u0440\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 Readme \u043a \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u044e: <a href=\"https:\/\/github.com\/dragoon\/cityliner\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/dragoon\/cityliner<\/a><\/p>\n<p>\u041a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 GTFS \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/github.com\/MobilityData\/mobility-database-catalogs\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/MobilityData\/mobility-database-catalogs<\/a>, \u0445\u043e\u0442\u044f \u0442\u0430\u043c \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 <code>shapes.txt<\/code> \u0432 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435.<\/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\/780150\/\"> https:\/\/habr.com\/ru\/articles\/780150\/<\/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>TL;DR<\/p>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u043e\u0432 \u0441 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430, \u0440\u0430\u0437\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0438\u0434\u043e\u0432 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430, \u0442\u043e\u043b\u0449\u0438\u043d\u0430 \u0438 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u043b\u0438\u043d\u0438\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430. \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439 \u0442\u0443\u0442:<\/p>\n<p><a href=\"https:\/\/github.com\/dragoon\/cityliner\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/dragoon\/cityliner<\/a><\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0418\u0441\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p>\u041e\u043a\u043e\u043b\u043e 10 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u041c\u0430\u0439\u043a\u043b \u041c\u044e\u043b\u043b\u0435\u0440 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 <a href=\"https:\/\/github.com\/cmichi\/gtfs-visualizations\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/cmichi\/gtfs-visualizations<\/a> \u043d\u0430 \u0441\u043c\u0435\u0441\u0438 JavaScript\/Node.js \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 GTFS \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Processing\" rel=\"noopener noreferrer nofollow\"><abbr class=\"habraabbr\" title=\"\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Java\" data-title=\"&lt;p>\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Java&#187; data-title=&#187;&lt;p>\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439&amp;nbsp;&lt;a href=&quot;https:\/\/ru.wikipedia.org\/wiki\/%D0%AF%D0%B7%D1%8B%D0%BA_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F&quot;>\u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f&lt;\/a>, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430&amp;nbsp;&lt;a href=&quot;https:\/\/ru.wikipedia.org\/wiki\/Java&quot;>Java&lt;\/a>&lt;\/p>&#187; data-abbr=&#187;Processing&#187;>Processing<\/abbr><\/a> \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 PDF. \u041c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u044d\u0442\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0438 \u044f  \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0435\u0433\u043e \u043a\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u0430, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0440\u0430\u0434\u0438\u0443\u0441\u0443, \u0438 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0444\u0430\u0439\u043b\u044b \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u043b\u0438\u0441\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432 \u043f\u0430\u043c\u044f\u0442\u044c (\u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u0434\u0430\u0436\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430).<\/p>\n<p>\u041f\u0430\u0440\u0443 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430\u0437\u0430\u0434 \u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 c \u043d\u0443\u043b\u044f \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u0442\u0435\u043c\u044b \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u043e\u0434\u043e\u0435\u043c\u043e\u0432, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0435\u0440\u0430 \u0441 \u0438\u043a\u043e\u043d\u043a\u0430\u043c\u0438 \u0433\u043e\u0440\u043e\u0434\u043e\u0432.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h3>GTFS \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p><strong>GTFS (General Transit Feed Specification)<\/strong> \u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u043d \u0431\u044b\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d Google \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043a\u0430\u0440\u0442, \u0441\u0435\u0439\u0447\u0430\u0441 \u0434\u0435-\u0444\u0430\u043a\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430. \u0415\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 (static) \u0438 real-time \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u0430\u0439\u043b <code>shapes.txt<\/code>. \u042d\u0442\u043e \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0438 \u043d\u0435 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442, \u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u043d\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u043b\u0438\u043b\u0438\u043d\u0438\u0439.<\/p>\n<h3>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/h3>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u0442\u0435\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><strong>\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0446\u0435\u043d\u0442\u0440\u0430 \u043a\u0430\u0440\u0442\u044b (\u0448\u0438\u0440\u043e\u0442\u0430\/\u0434\u043e\u043b\u0433\u043e\u0442\u0430)<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u0441\u0442\u0435\u0440\u0430 (\u0432\u044b\u0441\u043e\u0442\u0430\/\u0448\u0438\u0440\u0438\u043d\u0430 \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445)<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e Y (\u043a\u043c)<\/strong>: \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e X \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u043f\u043e\u0441\u0442\u0435\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 GTFS<\/h3>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u0435\u0437\u0434\u043e\u043a (trips)<\/h4>\n<p>\u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u043e\u0435\u0437\u0434\u043a\u0430\u043c (<code>trips<\/code>) \u0432 GTFS, \u0441\u0447\u0438\u0442\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043b\u0438\u043d\u0438\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 (<code>shape_id<\/code> ) \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 (<code>route_type<\/code>):<\/p>\n<pre><code class=\"python\">def _get_trips_and_routes(self) -> Tuple[dict, dict]:     route_id_types = self._get_route_id_types()     route_types = {}     # count the trips on a certain id     trips_on_a_shape = defaultdict(lambda: 0)      for shape_id, route_id in self._parse_trips():         trips_on_a_shape[shape_id] += 1         route_type = route_id_types[route_id]         if shape_id not in route_types:             route_types[shape_id] = route_type          return route_types, trips_on_a_shape  # route_types = {\"shape_id\": route_type, ...} # trips_on_a_shape = {\"shape_id\": N_trips, ...}<\/code><\/pre>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u0438\u043d\u0438\u0439 (shapes)<\/h4>\n<p>\u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c <code>shapes<\/code> \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0435, \u0447\u0442\u043e \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430:<\/p>\n<pre><code class=\"python\">def _get_sequences(self, center_point: Point, max_dist: MaxDistance) -> dict:     logging.debug(\"Starting shape iteration...\")     sequences = defaultdict(dict)     for shape_id, shape_pt_lat, shape_pt_lon, shape_pt_sequence, shape_row in self._parse_shapes():         # check out of boundaries         if is_allowed_point(Point(float(shape_pt_lat), float(shape_pt_lon)), center_point, max_dist):             sequences[shape_id][shape_pt_sequence] = shape_row return sequences  ##  sequences = {\"shape_id\": {\"1\": {lat\/lon\/...}, \"2\": {lat\/lon\/...}, ...} , ...}<\/code><\/pre>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/h4>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435, \u0435\u0433\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0438 \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430:<\/p>\n<pre><code class=\"python\">segments.append({                   \"trips\": trips_n,                   \"coordinates\": pts,                   \"route_type\": route_type         }) ##  segments = [{\"trips\": N_trips, \"coordinates\": [{lat\/lon}, ...], \"route_type\": route_type}, ...]<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435\/\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0445 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u043c\u043a\u0443 (bounding box):<\/p>\n<pre><code class=\"python\">if trips_n > max_trips:     max_trips = trips_n  if trips_n &lt; min_trips:     min_trips = trips_n  for seq, shape in shape_sequences.items():     y = float(shape['shape_pt_lat'])     x = float(shape['shape_pt_lon'])     min_left = min(x, min_left)     min_bottom = min(y, min_bottom)     max_top = max(y, max_top)     max_right = max(x, max_right<\/code><\/pre>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/h4>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0448\u0438\u0440\u043e\u0442\u0443\/\u0434\u043e\u043b\u0433\u043e\u0442\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043f\u043e x, y (\u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445):<\/p>\n<pre><code class=\"python\">def coord2px(lat: float, lng: float, bbox: BoundingBox):     coord_x = bbox.width \/ 2 + (lng - bbox.center.lon) * bbox.scale_factor_lon     coord_y = bbox.height \/ 2 - (lat - bbox.center.lat) * bbox.scale_factor_lat     return {'x': int(coord_x), 'y': int(coord_y)}<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0417\u0435\u043c\u043b\u0438, \u0442\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e: \u0446\u0435\u043d\u0442\u0440 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 (0,0) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u0446\u0435\u043d\u0442\u0440\u0430 \u043a\u0430\u0440\u0442\u044b (\u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432), \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0448\u0438\u0440\u043e\u0442\u044b \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u044b:<\/p>\n<pre><code class=\"python\">@dataclass(frozen=True) class BoundingBox: ...     @property     def scale_factor_lat(self):         return self.render_area.height_px \/ max(abs(self.center.lat - self.top),                                                 abs(self.center.lat - self.bottom))     @property     def scale_factor_lon(self):         return self.render_area.width_px \/ max(abs(self.center.lon - self.left),                                                abs(self.center.lon - self.right))   <\/code><\/pre>\n<p>\u0413\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0448\u0438\u0440\u043e\u0442\u0430 \u043e\u0442 50 \u0434\u043e 51, \u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 1000, \u0442\u043e 1 \u0433\u0440\u0430\u0434\u0443\u0441 \u0448\u0438\u0440\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u0441\u043f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u0432 1000 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0442\u0440\u0435\u043c\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c\u0438: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0435\u0437\u0434\u043e\u043a, \u0442\u0438\u043f\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0438 \u0441\u043f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438.<\/p>\n<h3>\u0412\u043e\u0434\u043e\u0435\u043c\u044b<\/h3>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c \u0432\u043e\u0434\u043e\u0435\u043c\u043e\u0432 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438\u0437 <a href=\"https:\/\/www.openstreetmap.org\/\" rel=\"noopener noreferrer nofollow\">OpenStreetMap<\/a>.<\/p>\n<p>\u041c\u043e\u0440\u044f \u0438 \u043e\u043a\u0435\u0430\u043d\u044b \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0441 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430\u043c\u0438 \u043e\u0442 OpenStreetMap \u0447\u0435\u0440\u0435\u0437 GeoPandas \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u043c\u043a\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e shapely:<\/p>\n<pre><code class=\"python\">import geopandas as gpd from shapely.geometry import box  water_gdf = gpd.read_file('oceans\/water_polygons.shp') bbox = box(bbox_orig.left, bbox_orig.bottom, bbox_orig.right, bbox_orig.top) filtered_water_gdf = water_gdf[water_gdf.geometry.intersects(bbox)]<\/code><\/pre>\n<p>\u0424\u0430\u0439\u043b \u0441 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/osmdata.openstreetmap.de\/data\/water-polygons.html\" rel=\"noopener noreferrer nofollow\">https:\/\/osmdata.openstreetmap.de\/data\/water-polygons.html<\/a>\u00a0(WGS84 Projection).<\/p>\n<p>\u0420\u0435\u043a\u0438, \u043e\u0437\u0435\u0440\u0430 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0440\u0443\u0447\u0435\u0439\u043a\u0438 \u0437\u0430\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/overpass-turbo.eu\/\" rel=\"noopener noreferrer nofollow\">Overpass Turbo<\/a> API \u043f\u043e \u0442\u043e\u0439 \u0436\u0435 \u0440\u0430\u043c\u043a\u0435 (\u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e):<\/p>\n<pre><code class=\"python\">overpass_url = \"&lt;https:\/\/overpass-api.de\/api\/interpreter>\"     query = f\"\"\"     [out:json][bbox:{bbox.bottom},{bbox.left},{bbox.top},{bbox.right}];     (       relation[\"natural\"=\"water\"][\"water\"~\"lake|river|pond|reservoir|stream|canal\"];       way(r);       way[\"natural\"=\"water\"][\"water\"~\"lake|river|pond|reservoir|stream|canal\"];     );     out tags body;     >;     out tags skel qt;     \"\"\"     response = requests.get(overpass_url, params={'data': query}) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0434\u043e\u0435\u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0432 JSON \u0444\u043e\u0440\u043c\u0430\u0442\u0435.<\/p>\n<h3>\u041f\u043e\u0441\u0442\u0435\u0440<\/h3>\n<p>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0442 Processing \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432 PDF, \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435 \u044f \u043d\u0430\u0448\u0435\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/pypi.org\/project\/reportlab\/\" rel=\"noopener noreferrer nofollow\">ReportLab<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 ReportLab \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 (\u043c\u0438\u043b\u043b\u0438\u043c\u0435\u0442\u0440\u044b\/\u0434\u044e\u0439\u043c\u044b), \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"python\">c = canvas.Canvas(str(self.out_path), pagesize=(A0[0], A0[1])) c.scale(A0[0] \/ self.render_area.width_px, A0[1] \/ self.render_area.height_px)<\/code><\/pre>\n<h4>\u0412\u043e\u0434\u043e\u0435\u043c\u044b<\/h4>\n<p>ReportLab \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0434\u043e\u0435\u043c\u044b \u0440\u0438\u0441\u0443\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u043c\u0438. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0433\u0440\u0430\u043d\u0438\u0446 \u0432\u043e\u0434\u043e\u0435\u043c\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c:<\/p>\n<pre><code class=\"python\">for body in water_bodies:     points = [coord for point in body[\"nodes\"] for coord in (point[\"x\"], point[\"y\"])]     # Add a Polygon or any other shapes to the Drawing     if len(points) > 2:         polygon = Polygon(points, fillColor='#0e142a')         d.add(polygon) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0437\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0440\u043e\u0432\u0430 (<code>interiors<\/code>) \u0447\u0435\u0440\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430\u043c\u0438 \u043f\u043e\u0432\u0435\u0440\u0445:<\/p>\n<pre><code class=\"python\"># add islands with black on top if \"interiors\" in body:     for interior in body[\"interiors\"]:         int_points = [coord for point in interior for coord in (point[\"x\"], point[\"y\"])]         if len(int_points) > 2:             polygon = Polygon(int_points, fillColor='#000000')             d.add(polygon)<\/code><\/pre>\n<h4>\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u043b\u0438\u043b\u0438\u043d\u0438\u0439.<\/p>\n<p>\u041a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0446\u0432\u0435\u0442 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043b\u0438\u0442\u0440\u044b. \u0422\u043e\u043b\u0449\u0438\u043d\u0430 \u043b\u0438\u043d\u0438\u0438 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0443 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u0435\u0437\u0434\u043e\u043a, \u0430 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435, \u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043d\u0430 \u043a\u0430\u0440\u0442\u0435, \u043d\u043e \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 0.2:<\/p>\n<pre><code class=\"python\">factor = 1.7 stroke_weight = math.log(float(trips) * factor) * 3 if stroke_weight &lt; 0:     stroke_weight = 1.0 * factor alph = 100 * (float(trips) \/ max_trips) if alph &lt; 20.0:     alph = 20.0 <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0432\u043e\u0434\u043d\u044b\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u043b\u0438\u043d\u0438\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 0.4, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0445 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0440\u0443\u0433\u0438\u0445.<\/p>\n<h4>\u0422\u0435\u043a\u0441\u0442 \u0438 \u0438\u043a\u043e\u043d\u043a\u0438 \u0433\u043e\u0440\u043e\u0434\u0430<\/h4>\n<p>\u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u043a\u043e\u043d\u043a\u0438 \u0433\u043e\u0440\u043e\u0434\u0430, \u0440\u0435\u0433\u0438\u043e\u043d\u0430 \u0438\/\u0438\u043b\u0438 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430\/\u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u0443 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<figure class=\"full-width\"><\/figure>\n<h4>\u041d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435<\/h4>\n<p>\u0411\u044b\u043b\u043e \u0431\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442 \u0437\u0430\u0442\u0443\u0445\u0430\u043d\u0438\u044f (fade out) \u043f\u043e \u043a\u0440\u0430\u044f\u043c \u043f\u043e\u0441\u0442\u0435\u0440\u0430.<\/p>\n<p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043d\u0430\u0448\u0435\u043b \u2014 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/python-pillow.org\/\" rel=\"noopener noreferrer nofollow\">Pillow<\/a>. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0437-\u0437\u0430 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0442\u0435\u043a\u0441\u0442 \u0438 \u0438\u043a\u043e\u043d\u043a\u0438 \u043d\u0430 \u043a\u0440\u0430\u044f\u0445 \u043f\u043e\u0441\u0442\u0435\u0440\u0430 \u0442\u043e\u0436\u0435 \u201c\u0437\u0430\u0442\u0443\u0445\u0430\u044e\u0442\u201d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0438 \u0438\u043a\u043e\u043d\u043a\u0438 \u0443\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Pillow \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u043a\u0438.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 Readme \u043a \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u044e: <a href=\"https:\/\/github.com\/dragoon\/cityliner\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/dragoon\/cityliner<\/a><\/p>\n<p>\u041a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 GTFS \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/github.com\/MobilityData\/mobility-database-catalogs\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/MobilityData\/mobility-database-catalogs<\/a>, \u0445\u043e\u0442\u044f \u0442\u0430\u043c \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 <code>shapes.txt<\/code> \u0432 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435.<\/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\/780150\/\"> https:\/\/habr.com\/ru\/articles\/780150\/<\/a><br \/><\/br><\/br><\/p>\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-362738","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/362738","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=362738"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/362738\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=362738"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=362738"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=362738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}