CN117252941B - Grid map drawing method - Google Patents

Grid map drawing method Download PDF

Info

Publication number
CN117252941B
CN117252941B CN202311196602.4A CN202311196602A CN117252941B CN 117252941 B CN117252941 B CN 117252941B CN 202311196602 A CN202311196602 A CN 202311196602A CN 117252941 B CN117252941 B CN 117252941B
Authority
CN
China
Prior art keywords
points
point
grid
polygon
latitude
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311196602.4A
Other languages
Chinese (zh)
Other versions
CN117252941A (en
Inventor
籍艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Zhuoyi Strategy Data Information Technology Co ltd
Original Assignee
Qingdao Zhuoyi Strategy Data Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Zhuoyi Strategy Data Information Technology Co ltd filed Critical Qingdao Zhuoyi Strategy Data Information Technology Co ltd
Priority to CN202311196602.4A priority Critical patent/CN117252941B/en
Publication of CN117252941A publication Critical patent/CN117252941A/en
Application granted granted Critical
Publication of CN117252941B publication Critical patent/CN117252941B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention relates to the technical field of grid map drawing, and provides a grid map drawing method, which comprises the following steps: s1: drawing polygons in the map according to the selected region boundaries; s2: marking longitude and latitude coordinates of the polygon boundary to obtain a coordinate point set; s3: marking diagonal vertices of the bounding rectangle of the selected region; s4: graining the circumscribed rectangle of the selected area; s5: the grid in the circumscribed rectangle but not in the polygonal area is culled. Aiming at the problems that in the existing map rasterization processing algorithm, larger errors exist in the boundary processing of a selected area, and the grid processing cannot be performed on a map with a specified boundary range accurately to obtain a grid map with an accurate boundary range, the invention provides an effective eliminating method, has high processing efficiency, and enables the boundary of the map after the grid processing to be accurate and clear.

Description

Grid map drawing method
Technical Field
The invention relates to the technical field of grid map drawing, in particular to a grid map drawing method.
Background
The map rasterization is a process of converting a vector map into a bitmap, wherein the grid is pixels, and the common map rasterization process is to perform pixel rendering on a two-dimensional surface area represented by polygons to obtain a rasterized map of a specific area.
In the existing map rasterization processing algorithm, a large error exists in the boundary processing of a selected area, and the grid processing of the map with the specified boundary range cannot be accurately performed to obtain the grid map with the accurate boundary range.
Disclosure of Invention
In order to solve the problems in the background art, the invention provides a grid map drawing method, which comprises the following steps:
S1: drawing polygons in the map according to the selected region boundaries;
s2: marking longitude and latitude coordinates of the polygon boundary to obtain a coordinate point set;
s3: marking diagonal vertices of the bounding rectangle of the selected region;
S4: graining the circumscribed rectangle of the selected area;
S5: the grid in the circumscribed rectangle but not in the polygonal area is culled.
Further, the specific process of step S3 is as follows: traversing longitude and latitude coordinates of the polygon boundary, and finding out the following four values: minimum longitude lngMin, minimum latitude latMin, maximum longitude lngMax, and maximum latitude latMax; the coordinate points (lngMin, latMin), (lngMax, latMax) are diagonal vertices of the bounding rectangle of the selected region.
Further, let the equator be located at 0 degree weft, radius r, circumference c=2pi r;
From north to south, along the longitude, the latitude is increased, and the circumferences of different longitudes are the same; from east to west, along the latitude, the longitude increases, the circumferences of different latitude lines are different, the longitude differences corresponding to the same distance are different, and the longitude differences depend on the current latitude;
let the side length of square grille be a, the altitude difference ψ formula that distance a corresponds is:
the latitude difference psi and the corresponding length difference calculation formula is:
a latitudinal coil having a latitudinal dimension of ψ and a circumference of c=2pi rcos ψ,
The distance a on the weft coil corresponds to the longitude difference theta and has the following calculation formula:
In the latitude value interval [ latMin, latMax ], the step length of the latitude difference psi corresponding to the grating length a is used for obtaining a grating latitude value set, which is arranged from small to large as follows:
[latMin,latMin+ψ,latMin+2ψ,…,latMin+nψ]
Wherein latMin + (n-1) psi is less than latMax, latMin +npsi is more than or equal to latMax
Similarly, in the longitude value interval [ lngMin, lngMax ], taking the longitude difference θ corresponding to the grid length a as a step length, the grid longitude value set is obtained and arranged from small to large as follows:
[lngMin,lngMin+θ,lngMin+2θ,…,lngMin+nθ]
Wherein lngMin + (n-1) theta is less than lngMax, lngMin +nθ is more than or equal to lngMax
In the horizontal direction, from left to right, from west to east, longitude increases, the difference value theta is a variable, and the value depends on the current latitude;
in the vertical direction, from bottom to top, from south to north, the latitude increases progressively, and the difference value psi is a fixed value;
the longitude and latitude of the lower left corner and the upper right corner of the grid can uniquely position one grid, and the calculation formula of the rectangular coordinates of the c (minimum 1) column of the (minimum 1) row of the (r) is as follows:
Lower left corner coordinates:
(lngMin+(c-1)θ,latMin+(r-1)ψ)
upper right angular position:
(lngMin+cθ,latMin+rψ)。
Further, the specific steps of the step S5 are as follows:
Q1: setting three inspection conditions; and in a grid rectangle set obtained after external rectangle graining:
The method comprises the steps of A, checking whether a grid rectangular center point is in a map selected area or not;
the condition B is that whether four vertexes of the remaining grid rectangle are in the area is checked;
C, checking whether boundary points of the map area are in the residual grid rectangle;
Q2, sequentially taking out rectangles from the grid rectangle set, and checking whether the condition A is met; checking the condition B if the condition A is not satisfied; checking the condition C if the condition A and the condition B are not met;
And Q3, regarding the grid rectangle which does not meet all the inspection conditions as not being in the selected map region, and eliminating.
Further, the specific steps of Q2 are:
Judging whether the point is in the area by using a ray method, starting from a detection point, horizontally taking rays to the right or left, calculating the number of intersection points of the rays and each side of the polygon, and if the number of intersection points is odd, locating the point in the polygon, and if the number of intersection points is even, locating the point outside the polygon; whether the points are in the polygon or not is converted into a problem that the number of the points and the focuses of the polygon edges is an odd-even number;
consider the following special case:
case D: the points are on the sides of the polygon,
Assuming that the starting point is taken as an intersection point, the intersection point of the rays may be odd or even, and the situation needs to be eliminated;
The method for judging the point on the line segment comprises the following steps:
setting the line segment endpoints as p1 and p2, and judging whether the point o is on the line segment or not;
Firstly, judging whether a point o is in a rectangle taking p1 and p2 as diagonal angles;
The logical expression is:
min(p1.x,p2.x)≤o.x≤max(p1.x,p2.x)&&min(p1.y,p2.y)≤o.y≤max(p1.y,p2.y)
Then judging whether the included angles of the line segments (o, p 1) and the horizontal direction are equal to the included angles of the line segments (p 1, p 2) and the horizontal direction, wherein the logic expression is as follows:
if the expression is established, the point is on the line segment, and the point is identified as not being in the map area;
Case E: the points coincide with the vertices of the polygon,
Comparing coordinate values with the target point through boundary coordinate points of the variable map, and if the coordinate values are the same, overlapping the points with polygon vertexes and identifying the points as not being in the map area;
Case F: the ray passes through one side of the polygon,
The vertical axis coordinates of the termination points of the line segment initial segments are the same as those of the detection points, and the horizontal coordinates of the detection points are on the left side of the initial points; let the starting point of line segment be p1, the end point be p2, the detection point be o, the logic expression be:
p1.y==p2.y==o.y&&o.x<p1.x
If the expression is established, the point ray is overlapped with the polygon edge and is identified as not being in the map area;
case G: the ray passes through the vertices of a polygon,
Both p1 and p2 rays pass through the vertices of the polygon, with p1 being within the polygon and p2 not;
p1 satisfies the condition: three points (B2, B3, B4) corresponding to the two line segments associated with the intersection point B3, wherein the other two points are arranged on two sides of the ray longitudinal axis except the intersection point B3;
p2 satisfies the condition: three points (B3, B4, B1) corresponding to the two line segments associated with the intersection point B4, wherein the other two points are on the same side of the ray longitudinal axis except the intersection point B4;
Let the intersection point be B0, two other two points of two line segments be B1, B2, the check point be p, satisfy p2 conditional logic expression as:
p.y==B0.y&&((B1.y>B0.y&&B2.y>B0.y)||(B1.y<B0.y&&B2.y<B0.y))
Filtering out the points meeting the p2 condition, and identifying the points as not being in the polygon;
after the special condition is eliminated, counting the number of intersection points of rays and the map area, and judging whether the points are in the area or not;
the line segment is (p 1, p 2), the detection point is o, if the ray intersects the line segment, the intersection point is p; the trigonometric function formula:
The abscissa of the intersection point is:
If the expression o.x is less than p.x, the ray intersects the line segment, and the intersection point count is increased by one;
counting intersection points of all line segments of the detection point and the map area, and meeting the following conditions:
count%2==1
I.e. the number of intersections is an odd number, the point is within the region.
The beneficial effects achieved by the invention are as follows:
Aiming at the problems that in the existing map rasterization processing algorithm, larger errors exist in the boundary processing of a selected area, and the grid processing cannot be performed on a map with a specified boundary range accurately to obtain a grid map with an accurate boundary range, the invention provides an effective eliminating method, has high processing efficiency, and enables the boundary of the map after the grid processing to be accurate and clear.
Drawings
FIG. 1 is a grid map after processing in embodiment 1;
FIG. 2 is a boundary detail representation of FIG. 1;
Fig. 3 is a polygon map of a selected area in embodiment 1;
FIG. 4 is a schematic view of the selected area circumscribed rectangle in example 1;
FIG. 5 is a schematic diagram of a grid rectangular coordinate calculation mode;
FIG. 6 is a schematic view of an externally attached rectangular split grid in example 1;
FIG. 7 is a schematic diagram of checking whether the center point of the grid rectangle is within a selected area of the map;
FIG. 8 is a schematic diagram of checking whether the four vertices of the remaining grid rectangle are within an area;
FIG. 9 is a schematic diagram of checking whether map region boundary points are within the remaining grid rectangle;
FIG. 10 is a schematic diagram of whether a radiographic checkpoint is within an area;
FIG. 11 is a schematic diagram of case D;
FIG. 12 is a schematic diagram II of case D;
FIG. 13 is a schematic diagram of case E;
fig. 14 is a schematic diagram of case F;
FIG. 15 is a schematic diagram of case G;
fig. 16 is a schematic diagram two of case G.
Detailed Description
The embodiments of the present invention will be described more fully hereinafter with reference to the accompanying drawings, in which the embodiments of the present invention are shown by way of illustration only, and the invention is not limited to the embodiments of the present invention, but other embodiments of the present invention will be apparent to those skilled in the art without making any inventive effort.
The invention relates to a grid map drawing method, which comprises the following steps:
S1: drawing polygons in the map according to the selected region boundaries;
s2: marking longitude and latitude coordinates of the polygon boundary to obtain a coordinate point set;
s3: marking diagonal vertices of the bounding rectangle of the selected region;
S4: graining the circumscribed rectangle of the selected area;
S5: the grid in the circumscribed rectangle but not in the polygonal area is culled.
For clarity of explanation of the process of the present invention, it is illustrated by example 1.
In embodiment 1, the present embodiment uses the peninsula area map to draw the entire peninsula area polygon map, as shown in fig. 3.
And obtaining a regional polygon coordinate point set which is a longitude and latitude coordinate point set.
And optionally drawing a polygonal or circular area on the map, marking a required range, and obtaining a boundary point coordinate set of the selected area of the map.
The process of drawing the circumscribed rectangle is as follows:
traversing the boundary point set and splitting the longitude and latitude set. Traversing the longitude and latitude set to find out the following four values:
Minimum longitude lngMin, minimum latitude latMin, maximum longitude lngMax, and maximum latitude latMax.
The coordinate points (lngMin, latMin), (lngMax, latMax) are diagonal vertices of the bounding rectangle.
Taking the urban Qingdao border as an example, calculating the diagonal vertex coordinates:
lngMin:119.514825,latMin:35.575601,lngMax:120.984493,latMax:37.149118
the drawing area circumscribes a rectangle as shown in fig. 4.
External rectangular grid
The earth can be seen approximately as a uniform sphere with a perimeter c=2pi r and a radius r=6371000 meters.
The equator is positioned at a 0-degree weft circle, from the south to the north, along the longitude, the latitude is increased, and the circumferences of different longitudes are the same.
From east to west, along the latitude, the longitude increases, the circumferences of different latitude lines are different, and longitude differences corresponding to the same distance are different, depending on the current latitude.
Let the side length of square grille be a, the altitude difference ψ formula that distance a corresponds is:
for example, moving 1 meter in the north-south direction along the coil, the difference in altitude is about 9X 10 -6 degrees
The latitude difference psi and the corresponding length difference are calculated according to the following formula:
For example, the difference in elevation from north to south is 1 degree, and the distance is about 111 km
A latitudinal coil having a latitudinal dimension of ψ and a circumference of c=2pi rcos ψ,
The distance a on the weft coil corresponds to the longitude difference theta and has the calculation formula of
For example, the number of the cells to be processed,
The latitude on the equator is 0, the east-west direction is shifted by 1m, and the longitude difference is about 9×10 -6 degrees.
The latitude is 35 degrees, the east-west direction is shifted by 1 meter, and the longitude difference is about 1.1×10 -5 degrees.
In the latitude value interval [ latMin, latMax ], the step length of the latitude difference psi corresponding to the grating length a is used for obtaining a grating latitude value set, which is arranged from small to large as follows:
[latMin,latMin+ψ,latMin+2ψ,…,latMin+nψ]
Wherein latMin + (n-1) psi is less than latMax, latMin +npsi is more than or equal to latMax
Similarly, in the longitude value interval [ lngMin, lngMax ], the longitude difference θ corresponding to the grid length a is taken as the step length, and the grid longitude value set is obtained and arranged as follows from small to large
[lngMin,lngMin+θ,lngMin+2θ,…,lngMin+nθ]
Wherein lngMin + (n-1) theta is less than lngMax, lngMin +nθ is more than or equal to lngMax
The grid rectangular coordinate calculation mode is shown in fig. 5.
In the horizontal direction, from left to right, from west to east, longitude increases, the difference value theta is a variable, and the value depends on the current latitude;
in the vertical direction, from bottom to top, from south to north, the latitude increases progressively, and the difference value psi is the constant value.
The longitude and latitude of the lower left corner and the upper right corner of the grid can uniquely position one grid, and the calculation formula of the rectangular coordinates of the c (minimum 1) column of the (minimum 1) row of the (r) is as follows:
Lower left corner coordinates
(lngMin+(c-1)θ,latMin+(r-1)ψ)
Upper right angular position
(lngMin+cθ,latMin+rψ)
Let grid length a take the value 1 meter, split external rectangle into like 6 style grids:
FIG. 6
Screening grids:
the grids which circumscribe the rectangle but are not in the polygonal area do not belong to the research scope, and are removed from the grid rectangle set.
The existing grid rectangular set is a rectangular set obtained by externally connecting rectangular grids, and coordinates of a rectangular center point and four vertexes are known;
The coordinate points are ordered clockwise or anticlockwise according to the coordinate set of the boundary points of the existing map area, and the coordinate points after sequential continuous ordering can form a closed polygon;
traversing the map region boundary point coordinate set, wherein two adjacent points form line segments, and all the line segments form the map region line segment set.
The criterion is whether the grid rectangle intersects the selected area of the map.
Traversing the grid rectangle set, and judging whether the rectangle is in the map area or not comprises the following steps:
A. Checking whether the rectangular center point of the grid is in the map selected area; as shown in fig. 7.
B. Checking whether four vertexes of the remaining grid rectangle are in the area; as shown in fig. 8.
C. Checking whether the map area boundary points are within the remaining grid rectangle: as shown in fig. 9.
And sequentially taking out rectangles from the grid rectangle set, checking whether the condition A is met, if the condition B is not met, checking the condition C if the condition B is not met A, B. Grid rectangles for which all inspection conditions are not satisfied are regarded as not being within the map area.
Determining whether the point is within the polygon:
All three inspection conditions need to judge whether the points are in the area or not, and a ray method is used for judging.
The ray method principle starts with a detection point, rays are horizontally taken to the right (or to the left), the number of intersection points of the rays and each side of the polygon is calculated, if the number of the intersection points is odd, the points are positioned in the polygon, and if the number of the intersection points is even, the points are positioned outside the polygon. The rays are made horizontally to the right in this example as shown in fig. 10.
The problem that whether the points are in the polygon is converted into the problem that the number of the points and the focuses of the sides of the polygon is odd and even.
Consider the following special case:
D. the points being on sides of a polygon, as shown in FIG. 11
Assuming that the origin is taken as an intersection, the ray intersection may be odd or even, which is to be excluded.
As shown in fig. 12, the method for determining that the point is on the line segment is to set the end points of the line segment as p1 and p2, and determine whether the point o is on the line segment.
Firstly, judging whether a point o is in a rectangle taking p1 and p2 as diagonal angles;
The logical expression is:
min(p1.x,p2.x)≤o.x≤max(p1.x,p2.x)&&min(p1.y,p2.y)≤o.y≤max(p1.y,p2.y)
Then judging whether the included angles of the line segments (o, p 1) and the horizontal direction are equal to the included angles of the line segments (p 1, p 2) and the horizontal direction, wherein the logic expression is as follows:
If the expression is true, the point is on the line segment and the point is identified as not being within the map area.
E. the points coincide with the vertices of the polygon, as shown in FIG. 13;
And comparing the coordinate value with the target point through the boundary coordinate point of the variable map, and if the coordinate value is the same, overlapping the point with the polygon vertex, and identifying the point as not being in the map area.
F. the ray passes through one side of the polygon as shown in FIG. 14;
The vertical axis coordinates of the end points of the line segment starting section are the same as those of the detection points, and the horizontal axis coordinates of the detection points are on the left side of the starting point. Let the starting point of line segment be p1, the end point be p2, the detection point be o, the logic expression be:
p1.y==p2.y==o.y&&o.x<p1.x
if the expression is established, the point ray coincides with the polygon edge and is recognized as not being in the map area.
G. Rays pass through the vertices of the polygon, as shown in FIG. 15, both p1 and p2 rays pass through the vertices of the polygon, with p1 being within the polygon and p2 not.
P1 satisfies the condition: three points (B2, B3, B4) corresponding to the two line segments associated with the intersection point B3, wherein the other two points are arranged on two sides of the ray longitudinal axis except the intersection point B3;
p2 satisfies the condition: three points (B3, B4, B1) corresponding to the two line segments associated with the intersection point B4, wherein the other two points are on the same side of the ray longitudinal axis except the intersection point B4;
Let the intersection point be B0, two other two points of two line segments be B1, B2, the check point be p, satisfy p2 conditional logic expression as:
p.y==B0.y&&((B1.y>B0.y&&B2.y>B0.y)||(B1.y<B0.y&&B2.y<B0.y))
The points that meet the p2 condition are filtered out and identified as not being within the polygon.
And after the special condition is eliminated, counting the number of intersection points of the ray and the map area, and judging whether the points are in the area.
As shown in fig. 16, the line segment is (p 1, p 2), the detection point is o, and if the ray intersects the line segment, the intersection point is p. The trigonometric function formula:
The abscissa of the intersection point is:
If expression o.x < p.x is satisfied, then the ray intersects the line segment, the number of intersections count plus one.
Counting intersection points of all line segments of the detection point and the map area, and meeting the following conditions:
count%2==1
I.e. the number of intersections is an odd number, the point is within the region. The screened grid pattern is shown in figure 1 and the boundary details are shown in figure 2.
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (2)

1. A method of grid mapping, comprising the steps of:
S1: drawing polygons in the map according to the selected region boundaries;
s2: marking longitude and latitude coordinates of the polygon boundary to obtain a coordinate point set;
s3: marking diagonal vertices of the bounding rectangle of the selected region;
S4: graining the circumscribed rectangle of the selected area;
S5: removing the grids in the circumscribed rectangle but not in the polygonal area;
The specific process of step S3 is as follows: traversing longitude and latitude coordinates of the polygon boundary, and finding out the following four values: minimum longitude lngMin, minimum latitude latMin, maximum longitude lngMax, and maximum latitude latMax; the coordinate points (lngMin, latMin), (lngMax, latMax) are diagonal vertices of the selected region bounding rectangle;
the specific process of step S4 is:
Setting the equator to be positioned at a 0-degree weft ring, wherein the radius is r, and the perimeter C=2pi r;
From north to south, along the longitude, the latitude is increased, and the circumferences of different longitudes are the same; from east to west, along the latitude, the longitude increases, the circumferences of different latitude lines are different, the longitude differences corresponding to the same distance are different, and the longitude differences depend on the current latitude;
let the side length of square grille be a, the altitude difference ψ formula that distance a corresponds is:
the latitude difference psi and the corresponding length difference calculation formula is:
a latitudinal coil having a latitudinal dimension of ψ and a circumference of c=2pi rcos ψ,
The distance a on the weft coil corresponds to the longitude difference theta and has the following calculation formula:
In the latitude value interval [ latMin, latMax ], the step length of the latitude difference psi corresponding to the grating length a is used for obtaining a grating latitude value set, which is arranged from small to large as follows:
[latMin,latMin+ψ,latMin+2ψ,…,latMin+nψ]
Wherein latMin + (n-1) psi is less than latMax, latMin +npsi is more than or equal to latMax
Similarly, in the longitude value interval [ lngMin, lngMax ], taking the longitude difference θ corresponding to the grid length a as a step length, the grid longitude value set is obtained and arranged from small to large as follows:
[lngMin,lngMin+θ,lngMin+2θ,…,lngMin+nθ]
Wherein lngMin + (n-1) theta is less than lngMax, lngMin +nθ is more than or equal to lngMax
In the horizontal direction, from left to right, from west to east, longitude increases, the difference value theta is a variable, and the value depends on the current latitude;
in the vertical direction, from bottom to top, from south to north, the latitude increases progressively, and the difference value psi is a fixed value;
the longitude and latitude of the lower left corner and the upper right corner of the grid can uniquely position one grid, and the calculation formula of the rectangular coordinates of the c (minimum 1) column of the (minimum 1) row of the (r) is as follows:
Lower left corner coordinates:
(lngMin+(c-1)θ,latMin+(r-1)ψ)
upper right angular position:
(lngMin+cθ,latMin+rψ);
the specific steps of the step S5 are as follows:
Q1: setting three inspection conditions; and in a grid rectangle set obtained after external rectangle graining:
The method comprises the steps of A, checking whether a grid rectangular center point is in a map selected area or not;
the condition B is that whether four vertexes of the remaining grid rectangle are in the area is checked;
C, checking whether boundary points of the map area are in the residual grid rectangle;
Q2, sequentially taking out rectangles from the grid rectangle set, and checking whether the condition A is met; checking the condition B if the condition A is not satisfied; checking the condition C if the condition A and the condition B are not met;
And Q3, regarding the grid rectangle which does not meet all the inspection conditions as not being in the selected map region, and eliminating.
2. A grid mapping method according to claim 1, wherein the specific steps of Q2 are:
Judging whether the point is in the area by using a ray method, starting from a detection point, horizontally taking rays to the right or left, calculating the number of intersection points of the rays and each side of the polygon, and if the number of intersection points is odd, locating the point in the polygon, and if the number of intersection points is even, locating the point outside the polygon; whether the points are in the polygon or not is converted into a problem that the number of the points and the focuses of the polygon edges is an odd-even number;
consider the following special case:
case D: the points are on the sides of the polygon,
Assuming that the starting point is taken as an intersection point, the intersection point of the rays may be odd or even, and the situation needs to be eliminated;
The method for judging the point on the line segment comprises the following steps:
setting the line segment endpoints as p1 and p2, and judging whether the point o is on the line segment or not;
Firstly, judging whether a point o is in a rectangle taking p1 and p2 as diagonal angles;
The logical expression is:
min(p1.x,p2.x)≤o.x≤max(p1.x,p2.x)&&min(p1.y,p2.y)≤o.y≤max(p1.y,p2.y)
Then judging whether the included angles of the line segments (o, p 1) and the horizontal direction are equal to the included angles of the line segments (p 1, p 2) and the horizontal direction, wherein the logic expression is as follows:
if the expression is established, the point is on the line segment, and the point is identified as not being in the map area;
Case E: the points coincide with the vertices of the polygon,
Comparing coordinate values with the target point through boundary coordinate points of the variable map, and if the coordinate values are the same, overlapping the points with polygon vertexes and identifying the points as not being in the map area;
Case F: the ray passes through one side of the polygon,
The vertical axis coordinates of the termination points of the line segment initial segments are the same as those of the detection points, and the horizontal coordinates of the detection points are on the left side of the initial points; let the starting point of line segment be p1, the end point be p2, the detection point be o, the logic expression be:
p1.y==p2.y==o.y&&o.x<p1.x
If the expression is established, the point ray is overlapped with the polygon edge and is identified as not being in the map area;
case G: the ray passes through the vertices of a polygon,
Both p1 and p2 rays pass through the vertices of the polygon, with p1 being within the polygon and p2 not;
p1 satisfies the condition: three points (B2, B3, B4) corresponding to the two line segments associated with the intersection point B3, wherein the other two points are arranged on two sides of the ray longitudinal axis except the intersection point B3;
p2 satisfies the condition: three points (B3, B4, B1) corresponding to the two line segments associated with the intersection point B4, wherein the other two points are on the same side of the ray longitudinal axis except the intersection point B4;
Let the intersection point be B0, two other two points of two line segments be B1, B2, the check point be p, satisfy p2 conditional logic expression as:
p.y==B0.y&&((B1.y>B0.y&&B2.y>B0.y)||(B1.y<B0.y&&B2.y<B0.y))
Filtering out the points meeting the p2 condition, and identifying the points as not being in the polygon;
after the special condition is eliminated, counting the number of intersection points of rays and the map area, and judging whether the points are in the area or not;
the line segment is (p 1, p 2), the detection point is o, if the ray intersects the line segment, the intersection point is p; the trigonometric function formula:
The abscissa of the intersection point is:
If the expression o.x is less than p.x, the ray intersects the line segment, and the intersection point count is increased by one;
counting intersection points of all line segments of the detection point and the map area, and meeting the following conditions:
count%2==1
I.e. the number of intersections is an odd number, the point is within the region.
CN202311196602.4A 2023-09-18 2023-09-18 Grid map drawing method Active CN117252941B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311196602.4A CN117252941B (en) 2023-09-18 2023-09-18 Grid map drawing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311196602.4A CN117252941B (en) 2023-09-18 2023-09-18 Grid map drawing method

Publications (2)

Publication Number Publication Date
CN117252941A CN117252941A (en) 2023-12-19
CN117252941B true CN117252941B (en) 2024-05-31

Family

ID=89134306

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311196602.4A Active CN117252941B (en) 2023-09-18 2023-09-18 Grid map drawing method

Country Status (1)

Country Link
CN (1) CN117252941B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118068442A (en) * 2024-04-17 2024-05-24 四川吉埃智能科技有限公司 Method and system for realizing vehicle-mounted tunnel intrusion detection based on laser scanning

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5341463A (en) * 1990-01-31 1994-08-23 The United States Of America As Represented By The Secretary Of The Navy Selective polygon map display method
EP0843285A2 (en) * 1996-11-19 1998-05-20 Matsushita Electric Industrial Co., Ltd. Method for the preparation of the raster map data
CN103473984A (en) * 2013-08-14 2013-12-25 中国地质大学(武汉) Template-based dynamic map obtaining method in network environment
WO2016116045A1 (en) * 2015-01-21 2016-07-28 高德软件有限公司 Method and apparatus for generating digital terrain model data of electronic maps
WO2018113787A1 (en) * 2016-12-23 2018-06-28 中兴通讯股份有限公司 Region division method and device, and storage medium
CN109710711A (en) * 2018-12-13 2019-05-03 中国联合网络通信集团有限公司 Map gridding method and platform

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5341463A (en) * 1990-01-31 1994-08-23 The United States Of America As Represented By The Secretary Of The Navy Selective polygon map display method
EP0843285A2 (en) * 1996-11-19 1998-05-20 Matsushita Electric Industrial Co., Ltd. Method for the preparation of the raster map data
CN103473984A (en) * 2013-08-14 2013-12-25 中国地质大学(武汉) Template-based dynamic map obtaining method in network environment
WO2016116045A1 (en) * 2015-01-21 2016-07-28 高德软件有限公司 Method and apparatus for generating digital terrain model data of electronic maps
WO2018113787A1 (en) * 2016-12-23 2018-06-28 中兴通讯股份有限公司 Region division method and device, and storage medium
CN109710711A (en) * 2018-12-13 2019-05-03 中国联合网络通信集团有限公司 Map gridding method and platform

Also Published As

Publication number Publication date
CN117252941A (en) 2023-12-19

Similar Documents

Publication Publication Date Title
CN117252941B (en) Grid map drawing method
CA2705809C (en) Method and apparatus of taking aerial surveys
CN102147250B (en) Digital line graph mapping method
JPH05101183A (en) Method and apparatus for matching image of body comprising straight line
CN107918953B (en) Three-dimensional space-based laser scanning power line point cloud extraction method and device
CN106096497B (en) A kind of house vectorization method for polynary remotely-sensed data
CN104732577A (en) Building texture extraction method based on UAV low-altitude aerial survey system
CN110415304B (en) Vision calibration method and system
CN112669280B (en) Unmanned aerial vehicle inclination aerial photography right-angle image control point target detection method based on LSD algorithm
CN104180794B (en) The disposal route in digital orthoimage garland region
Rau et al. Automatic roof model reconstruction from ALS data and 2D ground plans based on side projection and the TMR algorithm
CN115953421A (en) Harris honeycomb vertex extraction method for detecting regularity of honeycomb structure
CN117576219A (en) Camera calibration equipment and calibration method for single shot image of large wide-angle fish-eye lens
CN104200527B (en) A kind of generation method of true orthophoto
CN116958218A (en) Point cloud and image registration method and equipment based on calibration plate corner alignment
Zhong et al. A vector-based backward projection method for robust detection of occlusions when generating true ortho photos
CN115619623A (en) Parallel fisheye camera image splicing method based on moving least square transformation
JP2005346665A (en) Shoreline extraction method and shoreline-extracting system
CN112541943A (en) Robot positioning method based on visual road signs
CN115657049A (en) Tunnel vehicle-mounted laser radar positioning and deviation rectifying method and system
CN112308907B (en) Route planning method for carrying out close-range photogrammetry on slope by using aircraft
CN104157012A (en) Edge-contraction-based mesh parameterization method
CN109636840B (en) Method for detecting building shadow based on ghost image
CN113282695A (en) Vector geographic information acquisition method and device based on remote sensing image
Megahed et al. Semi-automatic approach for optical and LiDAR data integration using phase congruency model at multiple resolutions

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant