Disclosure of Invention
The embodiment of the invention provides a method and a device for determining the longitude and latitude of a population, which can obtain more accurate longitude and latitude of the population.
In a first aspect, a method for determining longitude and latitude of a population in an embodiment of the present invention includes: presetting a map script, and further comprising:
s1: acquiring basic population information;
s2: determining a region range according to the population basic information;
s3: judging whether the basic population information contains population longitude and latitude, if so, executing S4, otherwise, executing S5;
s4: judging whether the longitude and latitude of the population are in the area range by using the map script, and if not, executing S5;
s5: determining the longitude and latitude of a target population according to the area range;
s6: and updating the basic population information by using the longitude and latitude of the target population.
Preferably, the first and second electrodes are formed of a metal,
the S5, including:
a1: generating a random number by using a preset random function;
a2: generating a virtual longitude and latitude according to the area range and the random number;
a3: judging whether the virtual longitude and latitude is in the area range by using the map script, if so, executing A4, otherwise, executing A1;
a4: and determining the virtual longitude and latitude as the longitude and latitude of the target population.
Preferably, the first and second electrodes are formed of a metal,
the A2, comprising:
determining the longitude and latitude of the central point of the area range and the width and height of the area range;
generating a virtual longitude by using a first formula according to the random number, the longitude of the central point of the area range and the width of the area range;
the first formula includes:
wherein x is used to characterize the virtual longitude, x0Longitude of a center point for characterizing the region range, w for characterizing a width of the region range, and r for characterizing the random number;
generating a virtual latitude by using a following second formula according to the random number, the central point latitude of the area range and the height of the area range;
the second formula, comprising:
wherein y is used to characterize the virtual latitude, y0For characterizing the regionH is used to characterize the height of the area range, r is used to characterize the random number.
In a second aspect, an embodiment of the present invention provides an apparatus for determining longitude and latitude of a population, including:
a setting unit for setting a map script;
the acquisition unit is used for acquiring basic population information and determining an area range according to the basic population information;
the judging unit is used for judging whether the basic population information acquired by the acquiring unit has population longitude and latitude, if so, the executing unit is triggered, and otherwise, the determining unit is triggered;
the execution unit is used for judging whether the population longitude and latitude is in the area range by using the map script set by the setting unit, and if not, the determining unit is triggered;
the determining unit is used for determining the longitude and latitude of a target population according to the area range determined by the acquiring unit;
and the updating unit is used for updating the basic population information by utilizing the longitude and latitude of the target population determined by the determining unit.
Preferably, the first and second electrodes are formed of a metal,
the determination unit is used for A1: generating a random number by using a preset random function; a2: generating a virtual longitude and latitude according to the area range and the random number; a3: judging whether the virtual longitude and latitude is in the area range by using the map script, if so, executing A4, otherwise, executing A1; a4: and determining the virtual longitude and latitude as the longitude and latitude of the target population.
Preferably, the first and second electrodes are formed of a metal,
the determining unit is used for determining the longitude and latitude of the central point of the area range and the width and height of the area range; generating a virtual longitude by using a first formula according to the random number, the longitude of the central point of the area range and the width of the area range;
the first formula includes:
wherein x is used to characterize the virtual longitude, x0Longitude of a center point for characterizing the region range, w for characterizing a width of the region range, and r for characterizing the random number;
generating a virtual latitude by using a following second formula according to the random number, the central point latitude of the area range and the height of the area range;
the second formula, comprising:
wherein y is used to characterize the virtual latitude, y0The latitude of the center point of the area range is characterized, h is used for characterizing the height of the area range, and r is used for characterizing the random number.
In a third aspect, an embodiment of the present invention provides a readable medium, which includes an execution instruction, and when a processor of a storage controller executes the execution instruction, the storage controller executes a method described in any one of the above embodiments.
In a fourth aspect, an embodiment of the present invention provides a storage controller, including: a processor, a memory, and a bus;
the memory is used for storing execution instructions, the processor is connected with the memory through the bus, and when the storage controller runs, the processor executes the execution instructions stored in the memory, so that the storage controller executes the method of any one of the above embodiments.
The embodiment of the invention provides a method and a device for determining population longitude and latitude, wherein when the population basic information does not have the population longitude and latitude or the existing population longitude and latitude are not in a determined area range, the target population longitude and latitude can be determined according to the area range, and the population basic information is updated by using the target population longitude and latitude. The method can obtain more accurate longitude and latitude of the population, and avoid the condition that the longitude and latitude of the population is missing or inaccurate.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer and more complete, the technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention, and based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts belong to the scope of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a method for determining longitude and latitude of a population, which may include the following steps:
step 101: setting a map script;
step 102: acquiring basic population information;
step 103: determining a region range according to basic population information;
step 104: judging whether population longitude and latitude exist in the population basic information, if so, executing a step 105, otherwise, executing a step 106;
step 105: judging whether the longitude and latitude of the population are in the area range by using the map script, and if not, executing a step 106;
step 106: determining the longitude and latitude of a target population according to the regional scope;
step 107: and updating basic population information by using the longitude and latitude of the target population.
When the population basic information does not have the population longitude and latitude or the existing population longitude and latitude are not in the determined area range, the target population longitude and latitude can be determined according to the area range, and the population basic information is updated by using the target population longitude and latitude. The method can obtain more accurate longitude and latitude of the population, and avoid the condition that the longitude and latitude of the population is missing or inaccurate.
In one embodiment of the present invention, in order to obtain more accurate population longitude and latitude, step 106 includes:
a1: generating a random number by using a preset random function;
a2: generating a virtual longitude and latitude according to the area range and the random number;
a3: judging whether the virtual longitude and latitude is within the area range by using the map script, if so, executing A4, otherwise, executing A1;
a4: and determining the virtual longitude and latitude as the longitude and latitude of the target population.
The range of random numbers that can be generated by the random function is 0 to 1. For example, when the virtual longitude and latitude generated by using the random number 0.2 is not within the area range, the random function is required to be used again to generate a new random number 0.3, then the random number 0.3 is used to generate the virtual longitude and latitude, and so on until the generated virtual longitude and latitude is within the area range.
In one embodiment of the present invention, a2, comprises:
determining the longitude and latitude of the central point of the area range and the width and height of the area range;
generating a virtual longitude by using an equation (1) according to the random number, the center point longitude of the area range and the width of the area range;
where x is used to characterize the virtual longitude, x0The longitude of a center point used for representing the range of the area, the width of the range of the area, and the random number;
generating a virtual latitude by using an equation (2) according to the random number, the central point latitude of the area range and the height of the area range;
wherein y is used for representing the virtual latitude, y0The latitude of the center point of the area range is represented, h is used for representing the height of the area range, and r is used for representing the random number.
In order to make the obtained longitude and latitude of the population more consistent with the actual situation, the regional scope is generally the minimum administrative region where the population is located, such as villages. The general procedure for determining the extent of a region is as follows: and taking out the home address information from the basic population information, and determining the area range corresponding to the population according to the final-stage area ID of the home address information in the basic population information.
It should be noted that the processing may be performed for one piece of basic population information, or may be performed for a population information table including a plurality of pieces of basic population information.
As shown in fig. 2, the embodiment of the present invention takes a piece of basic population information as an example, and describes in detail a method for determining the longitude and latitude of a human mouth, where the method includes:
step 201: and setting a map script.
Step 202: basic information of the population is obtained.
Step 203: and determining the area range according to the basic information of the population.
The basic population information includes home address information, and a regional scope is determined according to the home address information, and in this embodiment, the regional scope is a minimum administrative region, village, where the population is located.
Step 204: and judging whether the basic information of the population has the latitude and longitude of the population, if so, executing the step 205, otherwise, executing the step 206.
Step 205: and judging whether the longitude and latitude of the population are within the area range by using the map script, and if not, executing a step 206.
Step 206: and generating a random number by using a preset random function.
In the present embodiment, the random number is any one of 0 to 1.
Step 207: and determining the longitude and latitude of the central point of the area range and the width and height of the area range.
The last level area ID in the home address information corresponds to the center point coordinate of the area range in the extracted area information table and the width and height of the area range.
Step 208: and generating a virtual longitude according to the random number, the longitude of the central point of the area range and the width of the area range.
The virtual longitude is generated by using the formula (3),
where x is used to characterize the virtual longitude, x0The longitude of a center point used for representing the range of the area, the width of the range of the area, and the random number;
for example, the center point longitude of the area range is x060 °, the width w of the region is 10, r is 0.2, formula (3) is substituted, and x is 57 °.
Step 209: and generating a virtual latitude according to the random number, the central point latitude of the area range and the height of the area range.
By using the equation (4), a virtual latitude is generated,
wherein y is used for representing the virtual latitude, y0For characterising the extent of a regionThe center point latitude, h is used for representing the height of the area range, and r is used for representing the random number.
For example, the center point of the region has a latitude x050 degrees, the height w of the area range is 20 degrees, r is 0.1 degrees, formula (3) is substituted, and y is 42 degrees.
Step 210: and judging whether the virtual longitude and latitude is within the area range by using the map script, if so, executing step 211, otherwise, executing step 206.
Step 211: and determining the virtual longitude and latitude as the longitude and latitude of the target population.
Step 212: and updating basic population information by using the longitude and latitude of the target population.
In an embodiment of the present invention, taking the poor user information table as an example, the program implementation of the method is described in detail:
(1) the Poor user information table Arc _ Poor _ Family is shown in table 1, and only some fields related to the present flow are listed in the following table.
TABLE 1
Field numbering
|
Name of field
|
Type of field
|
AAA001
|
ID
|
Varchar(36)
|
AZC001
|
Province number
|
Varchar(20)
|
AZC002
|
City weavingNumber (C)
|
Varchar(20)
|
AZC003
|
County number
|
Varchar(20)
|
AZC004
|
Country number
|
Varchar(20)
|
AZC005
|
Village number
|
Varchar(20)
|
LONGITUDE
|
Longitude (G)
|
Number
|
LATITUDE
|
Latitude
|
Number |
(2) And acquiring data of the poverty-stricken user through a table input component in the ETL tool.
selection from arc _ por _ family _ ad105 ═ national Standard' and NAD 003! 0 ═ 0
(3) The map administration area table (VILLAGE) is shown in table 2.
(4) And acquiring data in the village administrative region table through a table input component in the ETL tool.
Select*from VILLAGE
(5) And after the data acquired by the two table input components are sequenced, the data are connected in the ETL through the village number by using a record set connecting tool.
TABLE 2
Field numbering
|
Name of field
|
Type of field
|
ID
|
ID
|
Varchar(36)
|
V_Code
|
Village number
|
Varchar(20)
|
LONGITUDE_center
|
Center point longitude
|
Varchar(20)
|
LATITUDE_center
|
Center point latitude
|
Varchar(20)
|
Width
|
Width of area
|
Varchar(20)
|
Hight
|
Height of area
|
Varchar(20)
|
polygon
|
Graphical boundaries
|
SHAPE |
(6) And after the record set connecting tool, a JavaScript processing component is followed. And judging whether the original longitude and latitude exists or not and the correctness are finished in the assembly, and subsequently generating the virtual longitude and latitude.
(7) And updating the finally determined longitude and latitude x and y into the table by using the table updating component.
As shown in fig. 3, an embodiment of the present invention provides an apparatus for determining longitude and latitude of a population, including:
a setting unit 301 for setting a map script;
an obtaining unit 302, configured to obtain basic population information, and determine an area range according to the basic population information;
a judging unit 303, configured to judge whether the basic population information acquired by the acquiring unit 302 includes population longitude and latitude, if so, trigger the executing unit 304, and otherwise, trigger the determining unit 305;
an execution unit 304, configured to determine whether the population longitude and latitude is within a region range by using the map script set by the setting unit 301, and if not, trigger the determination unit 305;
a determining unit 305, configured to determine the longitude and latitude of the target population according to the area range determined by the obtaining unit 302;
an updating unit 306, configured to update the basic population information by using the longitude and latitude of the target population determined by the determining unit 305.
In an embodiment of the invention, the determining unit 305 is configured to a 1: generating a random number by using a preset random function; a2: generating a virtual longitude and latitude according to the area range and the random number; a3: judging whether the virtual longitude and latitude is within the area range by using the map script, if so, executing A4, otherwise, executing A1; a4: and determining the virtual longitude and latitude as the longitude and latitude of the target population.
In an embodiment of the present invention, the determining unit 305 is configured to determine a longitude and latitude of a center point of the area range, a width and a height of the area range; generating a virtual longitude by using a first formula according to the random number, the longitude of the central point of the area range and the width of the area range;
a first formula comprising:
where x is used to characterize the virtual longitude, x0The longitude of a center point used for representing the range of the area, the width of the range of the area, and the random number;
generating a virtual latitude by using the following second formula according to the random number, the central point latitude of the area range and the height of the area range;
a second formula comprising:
wherein y is used for representing the virtual latitude, y0The latitude of the center point of the area range is represented, h is used for representing the height of the area range, and r is used for representing the random number.
Because the information interaction, execution process, and other contents between the units in the device are based on the same concept as the method embodiment of the present invention, specific contents may refer to the description in the method embodiment of the present invention, and are not described herein again.
The embodiment of the invention provides a readable medium, which comprises an execution instruction, and when a processor of a storage controller executes the execution instruction, the storage controller executes the method of any one of the above embodiments.
An embodiment of the present invention provides a storage controller, including: a processor, a memory, and a bus;
the memory is used for storing execution instructions, the processor is connected with the memory through the bus, and when the storage controller runs, the processor executes the execution instructions stored by the memory so as to enable the storage controller to execute the method of any one of the above embodiments.
In summary, the embodiments of the present invention have at least the following effects:
1. in the embodiment of the invention, when the population longitude and latitude do not exist in the population basic information or the existing population longitude and latitude are not in the determined area range, the target population longitude and latitude can be determined according to the area range, and the population basic information is updated by using the target population longitude and latitude. The method can obtain more accurate longitude and latitude of the population, and avoid the condition that the longitude and latitude of the population is missing or inaccurate.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it is to be noted that: the above description is only a preferred embodiment of the present invention, and is only used to illustrate the technical solutions of the present invention, and not to limit the protection scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.