A method to quickly establish color correspondence between ArcGIS surface data
By generating ArcGIS color map and Style files and using RGB values for color rendering, the problem of inconvenient promotion of programming methods and inconsistent conversion of CYMK values in the existing technology is solved, and efficient and simple establishment of color correspondence relationships in ArcGIS surface data is achieved.
Patent Information
- Application Number
- CN202410246798.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-05
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-03-05
AI Technical Summary
When establishing the color correspondence relationship of ArcGIS surface data in the prior art, there is a problem that programming methods are inconvenient to promote and the same CYMK value is converted to different colors.
By obtaining the target project file, generating a raster file and dividing it into three bands: R, G, and B, extracting the legend and converting it into a point file, and generating an ArcGIS color map and Style file based on the RGB value to realize color rendering.
This method does not require writing code, avoids problems with the same CYMK value but different displays, improves the quality and efficiency of data conversion, and is suitable for practitioners without a programming foundation.
Smart Images

Figure CN118229803B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of geographic information technology, and in particular to a method for quickly establishing ArcGIS surface data color correspondence. Background Art
[0002] The essence of data conversion between different software is content conversion and symbol system conversion. Most GIS software comes with a data conversion module. Due to differences in data structure and storage methods among different software, data converted using the data conversion module of GIS software may sometimes have problems such as topological relationship errors and missing attribute information.
[0003] In the content conversion research, based on the analysis of data storage format, the conversion of spatial position, attributes, etc. is realized through reading and writing programming. For example, Zhongdi Company has also developed MAPGIS and ArcGIS data conversion software map2shp and shp2map.
[0004] The key to symbol system conversion is to establish a correspondence / mapping relationship between the symbol systems of the two software. The converted point data and line data can basically meet the rendering requirements using the existing symbol system of ArcGIS. Special point symbols can be combined or created with FontCreator. The rendering of surface data requires that the color number of the original data corresponds to the corresponding RGB value or the RGB value is determined according to relevant technical requirements before rendering. Since the same color has different color numbers in different software, and different software has different color modes, such as ArcGIS has three color modes of RGB, CYMK, and HSV, and MAPGIS has two modes of RGB and CYMK, the key problem that needs to be solved in the color correspondence / mapping relationship is how to establish the correspondence between the color number and the RGB value, so color conversion is still relatively complicated.
[0005] At present, the research on data conversion between different software and ArcGIS is relatively mature. Taking the conversion of MapGIS data format to ArcGIS data format as an example, it mainly includes: the method of establishing a color comparison table according to the RGB value of the corresponding color number in MapGIS; the method of making a color symbol comparison table after calculating the RGB value of the CYMK value of the corresponding color number in the MapGIS color table; the method of using C#.Net to write a shp file and MapGIS point and line area file conversion interface program, by traversing the MapGIS color number and collecting the RGB value of the color; the method of using the API function GetColorRGB Value to obtain the RGB information of the MapGIS color number mapping to establish a color mapping table. The efficiency of establishing the color correspondence of surface data is gradually improving from obtaining one by one to calculating the RGB value after programming the traversal of the color number CMYK value.
[0006] However, after reviewing the above existing methods, the inventors found that the current conversion methods still have some shortcomings, including: 1. There are cases in which the CYMK values in the MAPGIS color table are the same but the display is different (such as Fig. 22 2. Most practitioners do not have programming foundation or programming ability, and the existing methods are not easy to promote. Therefore, with the continuous improvement of data standardization and visualization requirements, it is very necessary to explore an accurate, simple and effective color correspondence / mapping method. Summary of the invention
[0007] In order to solve the problem that the ArcGIS color comparison table established based on programming methods is not convenient for promotion and the same CYMK value is converted into different colors, the present invention provides a method for quickly establishing ArcGIS surface data color correspondence, improves data conversion quality and efficiency, and meets data standardization and visualization requirements.
[0008] The present invention provides a method for quickly establishing ArcGIS surface data color correspondence, comprising:
[0009] Step 1: Obtain a target project file; wherein the target project file is a vector file generated by GIS software, including a region file for which ArcGIS surface data color correspondence needs to be established;
[0010] Step 2: Generate a corresponding raster file according to the target project file, and record the raster file generated by the zone file as the first raster file;
[0011] Step 3: convert the zone file into a shp format, and record the converted file as the first shp file;
[0012] Step 4: Divide the first raster file into three bands: R, G, and B;
[0013] Step 5: extract all legends in the first shp file and store them as a second shp file;
[0014] Step 6: According to the second shp file, convert the legend into points and store them as a third shp file, and generate a grid according to the legend and store it as a second grid file;
[0015] Step 7: Generate an ArcGIS color mapping table and a style file according to the three bands of R, G, and B, the third shp file, and the second raster file;
[0016] Step 8: Perform color rendering on the first shp file according to the style file.
[0017] Furthermore, before step 2, the method further includes: preprocessing the target project file;
[0018] Correspondingly, step 2 specifically includes:
[0019] Outputting the pre-processed target engineering file as a first raster file using an adapted GIS software;
[0020] Correspondingly, step 3 specifically includes:
[0021] The pre-processed zone file is converted into a first shp file using GIS format conversion software.
[0022] Furthermore, the target project file is preprocessed, specifically including:
[0023] Using the adapted GIS software, the scale of the target project file is adjusted to a preset scale;
[0024] The legends contained in the area file for which ArcGIS surface data color correspondence needs to be established in the target project file are numbered, and the serial number of the legend is added to the attribute information of the area file.
[0025] Furthermore, before step 4, the method further includes:
[0026] In ArcGIS software, registering the first raster file using the first shp file;
[0027] Correspondingly, step 4 is:
[0028] The first raster file after registration is divided into three bands: R, G, and B.
[0029] Furthermore, step 7 specifically includes:
[0030] Step 7.1: In ArcGIS software, RGB values are extracted using the spatial analysis function according to the three bands of R, G, and B, and the final extracted RGB values are added to the third shp file;
[0031] Step 7.2: Generate an ArcGIS color mapping table according to the attribute information of the third shp file processed in step 7.1;
[0032] Step 7.3: Import the ArcGIS color mapping table into the third raster file to generate a style file.
[0033] Beneficial effects of the present invention:
[0034] Compared with the existing methods, the method of the present invention does not require coding and CYMK calculation and conversion in the whole process, which is very friendly to practitioners without computer software development or programming foundation; in the application, only pre-processed pictures or relevant technical requirements and converted ArcGIS surface data are required, and all existing GIS software are applicable. At the same time, through verification, the method of the present invention does not have the problem of showing different CYMK values for the same CYMK value. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 One of the flow charts of a method for quickly establishing color correspondence of ArcGIS surface data provided by an embodiment of the present invention;
[0036] Figure 2 A second flow chart of a method for quickly establishing color correspondence between ArcGIS surface data provided by an embodiment of the present invention;
[0037] Figure 3 An example of a zone file provided for an embodiment of the present invention;
[0038] Figure 4 A schematic diagram of projection parameters before projection transformation (left) and a schematic diagram of projection parameters after projection transformation (right) provided in an embodiment of the present invention;
[0039] Figure 5 The LX.wp middle area primitives and legend attributes before preprocessing provided by the embodiment of the present invention;
[0040] Figure 6 The pre-processed LX.wp middle area graphic element and legend attributes provided by the embodiment of the present invention;
[0041] Figure 7 A schematic diagram of page settings for exporting a project file as a raster file provided by an embodiment of the present invention;
[0042] Figure 8 A schematic diagram of converting a file LX.wp into LX.shp, displaying the file LX.shp in ArcGIS and defining a projection for the file provided in an embodiment of the present invention;
[0043] Fig. 9 A schematic diagram of setting the transparency of the file LX.shp to 30% and superimposing it with the registered LX.tif provided in an embodiment of the present invention;
[0044] Fig.10 The embodiment of the present invention provides a method for converting LXTL.shp (surface type) into a point file LXTLL.shp (point type) using ArcGIS software;
[0045] Fig.11The conversion image analysis tool of ArcGIS provided in the embodiment of the present invention is used to extract the R band of LX.tif;
[0046] Fig.12 The three bands of LX.tif are extracted using the conversion image analysis tool of ArcGIS provided in the embodiment of the present invention;
[0047] Fig.13 The spatial analysis tool of ArcGIS is used to extract the color R, G, and B values provided in the embodiment of the present invention;
[0048] Fig.14 The first legend provided for the embodiment of the present invention is a color mode in MAPGIS;
[0049] Fig.15 The first illustration provided for the embodiment of the present invention is in Photoshop color mode;
[0050] Fig.16 The ArcGIS provided in the embodiment of the present invention extracts the RGB value (corresponding to RV, GV BV) of the legend;
[0051] Fig.17 The ArcGIS conversion tool provided in the embodiment of the present invention generates a raster LXTL.tif from LXTL.shp;
[0052] Fig.18 The LXTLLA.shp attribute table (left) and the compiled color mapping table LXTL.clr (right) provided in the embodiment of the present invention;
[0053] Fig.19 A comparison before and after importing LXTL.tif into a color mapping table provided in an embodiment of the present invention (left: before importing, right: after importing);
[0054] Fig. 20 The embodiment of the present invention provides the use of the TLXH field to match LX.shp and LX.style;
[0055] Fig.21 The final LX.shp rendering result obtained by using the method of the present invention provided in the embodiment of the present invention;
[0056] Fig. 22 The results are displayed for several color numbers with the same CYMK values in the MAPGIS "National Standard Library GB958" color table. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] Example 1
[0059] like Figure 1 As shown, an embodiment of the present invention provides a method for quickly establishing a color correspondence relationship of ArcGIS surface data, comprising the following steps:
[0060] S101: Obtain a target project file; wherein the target project file is a vector file generated by GIS software, including a region file for which ArcGIS surface data color correspondence needs to be established;
[0061] S102: Generate a corresponding raster file according to the target project file, and record the raster file generated by the zone file as a first raster file;
[0062] S103: converting the zone file into a shp format, and recording the converted file as a first shp file;
[0063] S104: Divide the first raster file into three bands: R, G, and B;
[0064] S105: extracting all legends from the first shp file and storing them as a second shp file;
[0065] S106: according to the second shp file, converting the legend into points and storing them as a third shp file, and generating a grid according to the legend and storing them as a second grid file;
[0066] S107: Generate an ArcGIS color mapping table and a style file according to the three bands R, G, and B, the third shp file, and the second raster file;
[0067] S108: Perform color rendering on the first shp file according to the style file.
[0068] The method for quickly establishing the color correspondence of ArcGIS surface data provided by the embodiment of the present invention is a method for converting the surface data generated by GIS software other than ArcGIS software into ArcGIS format and rendering it according to the original color, or directly rendering the surface data and raster data generated by ArcGIS software according to relevant technical requirements. Different from the existing research that uses programming to traverse the color number to obtain the color RGB value, the method of the present invention uses the RGB multi-band characteristics of the raster file and the powerful spatial analysis function of ArcGIS software to generate ArcGIS color mapping table and Style file, and uses the Style file to match the shp file to achieve color rendering. The whole process does not require coding, and is easy to convert and promote.
[0069] Example 2
[0070] On the basis of the above-mentioned embodiment, the embodiment of the present invention uses the soil type data of a certain place to be converted from MAPGIS format to ArcGIS format for color rendering to further illustrate the concept of the present invention. Figure 2 As shown, the following steps are included:
[0071] S201: Get the target project file: MAPLX.mpj;
[0072] Specifically, the target project file includes LX.wl, LX.wp, LX.wt, LXframe.wl, LXframe.wt; wherein, .wl represents a line file, and .wp represents a region file (such as Figure 3 As shown), .wt indicates a dot file;
[0073] S202: surface data preprocessing;
[0074] S2021: In MAPGIS, the scale of the target project file is changed from the original 1:100000 to 1:1000 through projection transformation, and other projection parameters remain unchanged.
[0075] Specifically, Figure 4 As shown in the figure, the left figure shows the projection parameters before the projection transformation, and the right figure shows the projection parameters after the projection transformation. Figure 4 As shown, other projection parameters include coordinate system type: projection plane rectangular; ellipsoid parameters: Beijing 1954; projection type: Albers equal area conic projection; central meridian: 1050000; first latitude: 250000; second latitude: 470000.
[0076] S2022: Sort and number the legends. The numbering sequence can refer to the relevant technical requirements;
[0077] Specifically, if there is no legend in the original project file, the legend version function is used to automatically extract the legend. In this embodiment, when the legends are sorted and numbered, the method of editing in EXCEL is adopted, and the generated file is recorded as LXTLBH.XLS, with a total of 20 legends, as shown in Table 1.
[0078] Table 1 Legend and serial number of soil types included in the target project file
[0079] Subclass name TLX Subclass name TLX Brown soil 1 Yellow red soil 11 Brown soil 2 Neutral purple 12 Lakes and water 3 Yellow brown soil 13 Alluvial soil 4 Gray fluvo-aquic soil 14 Leaching brown soil 5 Lime purple 15 Brown soil 6 Red soil 16 Brown soil 7 Sticky yellow-brown 17 Lime (rock) soil 8 Calcite 18 Yellow brown soil 9 Leaching black calcium 19 Yellow-brown soil 10 Yellow-brown soil 20
[0080] In Table 1, TLXH represents the legend number.
[0081] S2023: Add the serial number of the soil type legend to the attribute information of the zone file.
[0082] Specifically, Figure 3 As shown in the figure, the zone file attributes contain soil subclass names. Therefore, the attribute library management function of MAPGIS or the SECTION plug-in can be used to connect LX.wp and LXTLBH.XLS through the subclass name. Figure 5 To pre-process the primitives and legend properties in LX.wp; Figure 6 It is the properties of the graphic elements and legends in LX.wp after preprocessing.
[0083] S203: Data format conversion
[0084] S2031: In MAPGIS, export the project file MAPLX.mpj to a raster file LX.tif.
[0085] Specifically, the X and Y axis ratios in the page settings are set to 0.005, the output height*width is 46.6cm*51.93cm, and the resolution is 300dpi. Figure 7 shown.
[0086] S2032: converting the pre-processed zone file LX.wp into the shp format through the map2shp software, naming it as the file LX.shp, and defining the projection of the file LX.shp;
[0087] Specifically, after the data format is converted, all faces are displayed in the same color. Figure 8 As shown in the figure, the left picture shows the display effect in ArcGIS after LX.wp is converted to LX.shp; the right picture is a schematic diagram of defining the projection of LX.shp in ArcGIS.
[0088] S2033: Using the LX.shp file as a reference, align the raster file LX.tif.
[0089] Specifically, Fig. 9As shown, LX.shp is set to 30% transparency and is superimposed on the registered LX.TIF.
[0090] S204: Obtaining the RGB value of the legend;
[0091] S2041: Extract all legends in the LX.shp file and save them as the file LXTL.shp, and convert the file LXTL.shp into the point file LXTLL.shp. Fig.10 shown.
[0092] S2042: Decompose LX.tif into three bands: R, G, and B, which are Func_LX.TIF, Func1_LX.TIF, and Func2_LX.TIF. Fig.11 and Fig.12 shown.
[0093] S2043: Get the RGB value of the legend point LXTLL.shp and export the final file LXTLLA.shp.
[0094] Specifically, the ArcGIS Spatial Analyst Multi-Value Extraction to Points tool was used to export the file LXTLL.shp that obtained the RGB values and rename it to LXTLLA.shp.
[0095] S2044: Verify the extracted RGB value. Take the first extracted legend as an example.
[0096] (1) In MAPGIS: the color number in the color table is 813, the CYMK values are 10 30 20 0, and the RGB values are 229 207178. Fig.14 shown.
[0097] (2) In Photoshop: Color code: E5CCB2, CYMK values are 11 30 19 0, and RGB values are 229204 178. Fig.15 shown.
[0098] (3) RGB values calculated according to the formula in the literature
[0099] double T=1.0-(double)K / 100.0;
[0100] R=(int)(255*(1-(float)C / 100.0)*T+0.5);
[0101] G=(int)(255*(1-(float)M / 100.0)*T+0.5);
[0102] B=(int)(255*(1-(float)Y / 100.0)*T+0.5);
[0103] RGB are 230 204 179 respectively;
[0104] (4) The value obtained in ArcGIS is 229 204 178; Fig.16 shown.
[0105] From the above, it can be seen that the RGB values extracted by ArcGIS are consistent with the RGB values of MAPGIS. This method is credible and reliable.
[0106] S205: Generate a color mapping table;
[0107] S2051: Generate the grid file LXTL.tif according to the file LXTL.shp and the TLXH field in the legend. Fig.17 shown.
[0108] S2052: Write the color mapping table LXTL.clr according to the attribute information of the file LXTLLA.shp. Fig.18 As shown, the left picture is the LXTLLA.shp attribute table; the right picture is the compiled color mapping table LXTL.clr.
[0109] S2053: Import the color mapping table LXTL.clr into the raster file LXTL.tif to generate the style file LX.style; Fig.19 As shown, the left picture is before importing, and the right picture is after importing.
[0110] S206: Rendering the file LX.shp in color according to the style file;
[0111] Specifically, Fig. 20 and Fig.21 As shown, after rendering in ArcGIS, the color display is exactly the same as that in MAPGIS.
[0112] Compared with the existing methods, the method provided by the embodiment of the present invention does not require code writing and CYMK calculation conversion throughout the entire process, and is very friendly to practitioners who have no computer software development or programming foundation; the application only requires preprocessed raster files or ArcGIS surface data with relevant technical requirements and data format conversion, and all existing GIS software is applicable.
[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for quickly establishing color correspondence between ArcGIS surface data, characterized in that: include: Step 1: Obtain a target project file; wherein the target project file is a vector file generated by GIS software, including a region file for which ArcGIS surface data color correspondence needs to be established; Step 2: Generate a corresponding raster file according to the target project file, and record the raster file generated by the zone file as the first raster file; Step 3: convert the zone file into a shp format, and record the converted file as the first shp file; Step 4: Divide the first raster file into three bands: R, G, and B; Step 5: extract all legends in the first shp file and store them as a second shp file; Step 6: According to the second shp file, convert the legend into points and store them as a third shp file, and generate a grid according to the legend and store it as a second grid file; Step 7: Generate an ArcGIS color mapping table and a style file according to the three bands of R, G, and B, the third shp file, and the second raster file; Step 8: Perform color rendering on the first shp file according to the style file.
2. A method for quickly establishing color correspondence of ArcGIS surface data according to claim 1, characterized in that: Before step 2, the method further includes: preprocessing the target project file; Correspondingly, step 2 specifically includes: Using the adapted GIS software, the area file in the pre-processed target project file for which the ArcGIS surface data color correspondence relationship needs to be established is output as a first raster file; Correspondingly, step 3 specifically includes: The pre-processed zone file is converted into a first shp file using GIS format conversion software.
3. A method for quickly establishing ArcGIS surface data color correspondence according to claim 2, characterized in that: Preprocessing the target project file specifically includes: Using the adapted GIS software, the scale of the target project file is adjusted to a preset scale; The legends contained in the area file for which ArcGIS surface data color correspondence needs to be established in the target project file are numbered, and the serial number of the legend is added to the attribute information of the area file.
4. A method for quickly establishing color correspondence of ArcGIS surface data according to claim 1, characterized in that: Before step 4, also include: In ArcGIS software, registering the first raster file using the first shp file; Correspondingly, step 4 is: The first raster file after registration is divided into three bands: R, G, and B.
5. The method for quickly establishing color correspondence of ArcGIS surface data according to claim 1, characterized in that: Step 7 specifically includes: Step 7.1: In ArcGIS software, RGB values are extracted using the spatial analysis function according to the three bands of R, G, and B, and the final extracted RGB values are added to the third shp file; Step 7.2: Generate an ArcGIS color mapping table according to the attribute information of the third shp file processed in step 7.1; Step 7.3: Import the ArcGIS color mapping table into the second raster file to generate a style file.
Citation Information
Patent Citations
Grid structure-based spatial index establishing method and grid structure-based spatial index establishing system
CN101719154A
Lightweight ocean scalar field visualization method
CN116107972A