Invention content
In view of the above problems, the application provides a kind of method, apparatus and system for obtaining map datum, overcomes the above problemOr it solves the above problems at least partly.
The embodiment of the present application provides a kind of method for obtaining map datum, including:
Access instruction is sent to Data access module by preset data access interface, the access instruction is according to terminalThe first network of transmission requests to generate;
It is accessed according to the access instruction to the map server that accesses of needs operation, to obtain the mapData.
Optionally, in the embodiment of the present application, it is described by preset data access interface to the Data access moduleAccess instruction is sent to include:
The attribute information of map server for needing to access is obtained from configuration file, and according to the attributeInformation creating access instances;
The data access interface is called using the access instances, is referred to sending to access to the Data access moduleIt enables.
Optionally, in the embodiment of the present application, according to the access instruction to the map server that accesses of needs intoRow access operation is included with obtaining the map datum:
Second network request is generated according to the access instruction;
The map server to access to told needs sends second network request, to obtain the map numberAccording to.
Optionally, in the embodiment of the present application, it in the access instruction for parsing and receiving, is given birth to according to the access instructionInto after the second network request, the map server to access is needed to include before sending the second network request to described:
According to the access instruction, judge in caching with the presence or absence of the map datum;
If so, the map datum is then obtained from the caching;
Otherwise, the second network request is sent to the map server that needs access, to obtain the map datum, andIt will be in map datum deposit caching.
Optionally, in the embodiment of the present application, abscissa, ordinate and map are at least carried in the access instructionLevel.
A kind of device for obtaining map datum of the embodiment of the present application, including:
Application service module is set as sending access instruction to Data access module by preset data access interface,The access instruction is requested to generate according to the first network that terminal is sent;
Data access module is set as being accessed according to the map server that the access instruction accesses to needsOperation, to obtain the map datum.
Optionally, in the embodiment of the present application, the application service module includes:
Dispensing unit is set as obtaining the attribute letter of the map server for needing to access from configuration fileBreath, and access instances are created according to the attribute information;
Service unit is set as calling the data access interface using the access instances, with to the data accessModule sends access instruction.
Optionally, in the embodiment of the present application, the Data access module includes:
Interface unit is set as generating the second network request according to the access instruction;
Request unit is set as the map server to access being needed to send second network request to described, withObtain the map datum.
Optionally, in the embodiment of the present application, abscissa, ordinate and map are at least carried in the access instructionLevel.
The embodiment of the present application provides a kind of system for obtaining map datum, including:Terminal, application server, Map ServicesDevice;The application server is for determining the map server that accesses of needs, by preset data access interface to instituteIt states Data access module and sends access instruction, the access instruction is generated according to the network request that terminal is sent, and described in acquisitionAccess instruction needs the map server that accesses to access operation, to obtain according to the access instruction to describedIt states map datum and is sent to the terminal for generating the access instruction corresponding requests.
The present embodiment sends access instruction by preset data access interface to Data access module, according to the accessThe operation that accesses to the map server for needing to access is instructed, to obtain the map datum, the present embodiment can be adapted toIt accesses to a variety of map servers.
Specific embodiment
The present embodiment sends access instruction by preset data access interface to Data access module, according to the accessThe operation that accesses to the map server for needing to access is instructed, to obtain the map datum, the present embodiment can be adapted toIt accesses to a variety of map servers.
Certainly, implement any technical solution of the embodiment of the present application do not need necessarily to reach simultaneously more than it is all excellentPoint.
In order to which those skilled in the art is made to more fully understand the technical solution in the embodiment of the present application, below in conjunction with the applicationThe technical solution in the embodiment of the present application is clearly and completely described in attached drawing in embodiment, it is clear that described realityIt is only the embodiment of the present application part of the embodiment to apply example, instead of all the embodiments.Based on the implementation in the embodiment of the present applicationExample, those of ordinary skill in the art's all other embodiments obtained should all belong to the range that the embodiment of the present application is protected.
Further illustrate that the embodiment of the present application implements with reference to the embodiment of the present application attached drawing.
Referring to Fig. 1, in the application one in the specific implementation, the method for obtaining map datum includes:
S101, access instruction, the access instruction root are sent to Data access module by preset data access interfaceThe first network sent according to terminal requests to generate.
S102, access to the map server for needing to access according to the access instruction operation, to obtainState map datum.
Specifically, the map server can be the map server and to described that map data provider providesThe API of figure server access, such as the Map Services of the offers such as Google Maps, Baidu map, Tencent's map, AmapDevice.It can be by the way that corresponding API be called to obtain corresponding map datum.The present embodiment can set in configuration file and be visitedThe map server asked or the map server that needs can be selected to access by user.
In the present embodiment, terminal can include hardware, software or embedded logic module or such group two or moreThe electronic device of the combination of part, and be able to carry out by network communicating function.For example, terminal can be computer, smart mobile phone, put downPlate computer, laptop, net book, intelligent wearable device etc..
In the present embodiment, the map datum can be the base map data of map;The map datum can be specifically figureThe base map of map in the present embodiment, can be cut into the figure of 256px × 256px sizes by the data of piece form, such as png, jpgPiece, the picture of this equal size can be described as grille picture or grid picture.
Application program is then obtained in the level and the region of current map and is owned when showing the map in some regionGrille picture coordinate.The level of the map can behave as the engineer's scale of map.The coordinate of the grille picture includes groundThe abscissa and ordinate of figure.
In the present embodiment, the interface is the set of certain methods (Method, alternatively referred to as function) feature.With JavaFor language, keyword Interface can be used to define an interface, the interface generally comprises several parameters.In this realityIt applies in example, the access instruction can be specifically the design parameter value of interface parameters.For example, define an interface:interfaceIAgent;It may include multiple abstract methods in interface, such as access (MapInfo mapInfo), access is expressed as accessThe abstract method of figure server, mapInfo are the parameter of this method, are represented by grille picture, horizontal stroke is included at least in mapInfoCoordinate, ordinate and map level.In the present embodiment, the access instruction can be ginseng when calling above-mentioned abstract methodNumber, i.e. mapInfo.
In the present embodiment, comprising several entity class (class) in Data access module, above-mentioned interface can be inherited from, oftenA entity class may have access to corresponding map server, to obtain the map datum.
The present embodiment sends access instruction by preset data access interface to Data access module, according to the accessThe operation that accesses to the map server for needing to access is instructed, to obtain the map datum, the present embodiment can be adapted toIt accesses to a variety of map servers.
It is another in the application in the specific implementation, the method 101 for obtaining map datum includes referring to Fig. 2:
S201, the attribute information of map server for needing to access is obtained from configuration file, and according to instituteIt states attribute information and creates access instances;
Specifically, in the present embodiment, it may be determined that need the map server to access, map server may be configured asIt is multiple, and may be configured as different type.
In the present embodiment, the form of the configuration file can be any one in xml, ini, config.
Specifically, in the present embodiment, the attribute information of the map server includes:Title, IP address, port, clothesOne or more of device type of being engaged in.
S202, the data access interface is called using the access instances, is visited with being sent to the Data access moduleAsk instruction;
Specifically, in the present embodiment, the access instances refer to the concept in programming language, i.e., to a class (class)The object obtained after being instantiated occupies certain memory space in memory.Access instances can be used for depositing the dataStorage module accesses.In the present embodiment, one can be created after the map server that needs that step S201 is determined accessIts a corresponding access instances.
Specifically, in the present embodiment, corresponding identical access operation, the interface that each access instances are called is identical, for example,Application scenarios is add a data into the data buffer storage, then each access instances call connecing for addition a dataMouthful.The calling of physical interface is similar to Fig. 1 corresponding embodiments, and details are not described herein.
S203, access to the map server for needing to access according to the access instruction operation, to obtainState map datum;
In the present embodiment, step S203 is repeated no more in detail like the step S102 in above-mentioned Fig. 1 embodiments.
Referring to Fig. 3, it is another in the application in the specific implementation, the method includes:
S301, access instruction, the access instruction root are sent to Data access module by preset data access interfaceThe first network sent according to terminal requests to generate.
S302, the second network request is generated according to the access instruction;
Specifically, in the present embodiment, the access instruction can be the parameter of the interface, for example, can be to interfaceParameter is parsed, and determines to need the data memory module to access by some parameter, which relies on Java languageIn compiling when polymorphic (Compile Time Polymorphism) technology, belong to the prior art, details are not described herein.
Specifically, in the present embodiment, the access instances for calling the interface can be also obtained, and can be accessed in fact according to describedExample determines the type of the access instances, further determines that the data for needing to access store mould according to the typeBlock, polymorphic (Runtime Polymorphism) technology when which relies on the operation in Java language, belongs to the prior art,This is repeated no more.
S303, according to the access instruction, judge in caching with the presence or absence of the map datum;
S304, the map datum is obtained from the caching;
S305, the map server to access is needed to send the second network request to described, to obtain the map numberAccording to, and will be in map datum deposit caching.
In the present embodiment, the caching can be the file of local disk storage, specifically, can be by different grid mapsPiece is put under different catalogues, such as is deposited with the bibliographic structure of " map server title/map level/abscissa/ordinate "Store up grille picture.
In the present embodiment, the caching can also be cache server (Cache Server), for storing hot spotThe higher map datum of diagram data, i.e. rate of people logging in.Caching refers to carry out the memory of high-speed data exchange, it is prior to memoryData are exchanged with CPU, therefore speed ratio is very fast.For example, cache server can be Memcached servers or Redis servicesDevice.
Optionally, in the present embodiment, periodic cleaning is carried out to the grille picture in the caching, e.g., when reaching defaultGrille picture is cleared up after intermediate node or is cleared up after the number of visits of grille picture reaches predetermined threshold value.
In the present embodiment, after map datum is obtained from map server, by map datum deposit caching, net can be reducedThe expense of network flow, while improve the speed of response of server.
Referring to Fig. 4, in the application one in the specific implementation, the device for obtaining map datum includes:
Application service module 401 is set as sending to access to Data access module by preset data access interface referring toIt enables, the access instruction is requested to generate according to the first network that terminal is sent.
Data access module 402 is set as carrying out the map server that needs access according to the access instructionAccess operation, to obtain the map datum.
Specifically, the map server can be the map server and to described that map data provider providesThe API of figure server access, such as the Map Services of the offers such as Google Maps, Baidu map, Tencent's map, AmapDevice.It can be by the way that corresponding API be called to obtain corresponding map datum.The present embodiment can set in configuration file and be visitedThe map server asked or the map server that needs can be selected to access by user.
In the present embodiment, terminal can include hardware, software or embedded logic module or such group two or moreThe electronic device of the combination of part, and be able to carry out by network communicating function.For example, terminal can be computer, smart mobile phone, put downPlate computer, laptop, net book, intelligent wearable device etc..
In the present embodiment, the map datum can be the base map data of map;The map datum can be specifically figureThe base map of map in the present embodiment, can be cut into the figure of 256px × 256px sizes by the data of piece form, such as png, jpgPiece, the picture of this equal size can be described as grille picture or grid picture.
Application program is then obtained in the level and the region of current map and is owned when showing the map in some regionGrille picture coordinate.The level of the map can behave as the engineer's scale of map.The coordinate of the grille picture includes groundThe abscissa and ordinate of figure.
In the present embodiment, the interface is the set of certain methods (Method, alternatively referred to as function) feature.With JavaFor language, keyword Interface can be used to define an interface, the interface generally comprises several parameters.In this realityIt applies in example, the access instruction can be specifically the design parameter value of interface parameters.For example, define an interface:interfaceIAgent;It may include multiple abstract methods in interface, such as access (MapInfo mapInfo), access is expressed as accessThe abstract method of figure server, mapInfo are the parameter of this method, are represented by grille picture, horizontal stroke is included at least in mapInfoCoordinate, ordinate and map level.In the present embodiment, the access instruction can be ginseng when calling above-mentioned abstract methodNumber, i.e. mapInfo.
In the present embodiment, comprising several entity class (class) in Data access module, above-mentioned interface can be inherited from, oftenA entity class may have access to corresponding map server, to obtain the map datum.
The present embodiment sends access instruction by preset data access interface to Data access module, according to the accessThe operation that accesses to the map server for needing to access is instructed, to obtain the map datum, the present embodiment can be adapted toIt accesses to a variety of map servers.
It is another in the application in the specific implementation, the device for obtaining map datum includes referring to Fig. 5:Application service mouldBlock 501, Data access module 502, wherein, application service module 501 includes:
Dispensing unit 511 is set as obtaining the attribute of map server for needing to access from configuration fileInformation, and access instances are created according to the attribute information;
Specifically, in the present embodiment, it may be determined that need the map server to access, map server may be configured asIt is multiple, and may be configured as different type.
In the present embodiment, the form of the configuration file can be any one in xml, ini, config.
Specifically, in the present embodiment, the attribute information of the map server includes:Title, IP address, port, clothesOne or more of device type of being engaged in.
Service unit 521 is set as calling the data access interface using the access instances, to be visited to the dataAsk that module sends access instruction;
Specifically, in the present embodiment, the access instances refer to the concept in programming language, i.e., to a class (class)The object obtained after being instantiated occupies certain memory space in memory.Access instances can be used for depositing the dataStorage module accesses.In the present embodiment, one can be created after the map server that needs that step S201 is determined accessIts a corresponding access instances.
Specifically, in the present embodiment, corresponding identical access operation, the interface that each access instances are called is identical, for example,Application scenarios is add a data into the data buffer storage, then each access instances call connecing for addition a dataMouthful.The calling of physical interface is similar to Fig. 1 corresponding embodiments, and details are not described herein.
In the present embodiment, application service module 501, Data access module 502 are analogous respectively in Fig. 4 corresponding embodimentsApplication service module 401, Data access module 402, repeat no more in detail.
It is another in the application in the specific implementation, the device for obtaining map datum includes referring to Fig. 6:Application service mouldBlock 601, Data access module 602, wherein, Data access module 602 includes:
Interface unit 612 is set as generating the second network request according to the access instruction;
Request unit 622 is set as the map server to access being needed to send second network request to described,To obtain the map datum.
Specifically, in the present embodiment, the access instruction can be the parameter of the interface, for example, can be to interfaceParameter is parsed, and determines to need the data memory module to access by some parameter, which relies on Java languageIn compiling when polymorphic (Compile Time Polymorphism) technology, belong to the prior art, details are not described herein.
Specifically, in the present embodiment, the access instances for calling the interface can be also obtained, and can be accessed in fact according to describedExample determines the type of the access instances, further determines that the data for needing to access store mould according to the typeBlock, polymorphic (Runtime Polymorphism) technology when which relies on the operation in Java language, belongs to the prior art,This is repeated no more.
In the present embodiment, application service module 601, dispensing unit 611, service unit 621 are analogous respectively to Fig. 5 correspondencesApplication service module 501, dispensing unit 511, service unit 521 in embodiment, repeat no more in detail.
It is another in the application in the specific implementation, a kind of system for obtaining map datum, which is characterized in that packet referring to Fig. 7It includes:Terminal 701, application server 702, map server 703;The application server 702 accesses for determining needsMap server, access instruction is sent to the Data access module by preset data access interface, the access refers toThe first network sent according to terminal 701 is enabled to request to generate, and obtain the access instruction, according to the access instruction to describedThe map server to access 703 is needed to access operation, to obtain the map datum and be sent to the generation visitAsk the terminal 701 of instruction corresponding requests.
In the present embodiment, terminal 701 includes application module 711 and rendering module 721, and the two can be based on JavaScriptLanguage is realized.Application module 711 can receive the instructions such as described point, scribing line, dynamic window, and will be at instruction for being interacted with userFirst network request is formed after reason, and first network request is sent to application server 702.721 charge map of rendering moduleBase map and pel, which are superimposed, to be rendered, and the pel includes the map elements such as point, line, point of interest.
In the present embodiment, the map that is shown in terminal 701 can be selected on the basis of the map making that a map supply quotient providesMap, for example, reference map of the google maps as terminal can be selected.User is in terminal operation map, application module711 obtain the operational order of user, and operational order is parsed, and obtain the screen coordinate of map datum in display areaThe screen coordinate is converted into the coordinate (x, y, level) of google maps, according to google maps by (x, y, level)Coordinate generation network request, and network request is sent to application server 702.
Application service module in application server 702 can generate request object according to configuration information, receive terminal 701The first network of transmission requests to generate access instruction, and access instruction is sent to by interface;Data access module is according to instituteIt states access instruction to access to the map server that accesses of needs operation, to obtain the map datum.
Fig. 8 is the hardware architecture diagram for some electronic equipments that the application performs the method for obtaining map datum.According toShown in Fig. 8, which includes:
One or more processors 801 and memory 802, in Fig. 8 by taking a processor 801 as an example.
The equipment for performing the method for obtaining map datum can also include:Input unit 803 and output device 803.
Processor 801, memory 802, input unit 803 and output device 804 can pass through bus or other modesIt connects, in Fig. 8 for being connected by bus.
Memory 802 is used as a kind of non-volatile computer readable storage medium storing program for executing, available for storing non-volatile software journeySequence, non-volatile computer executable program and module, as the method for the acquisition map datum in the embodiment of the present application corresponds toProgram instruction/module.Processor 801 by operation be stored in non-volatile software program in memory 802, instruction andModule, various function application and data processing so as to execute server are realized in above method embodiment and obtain mapThe method of data.
Memory 802 can include storing program area and storage data field, wherein, storing program area can store operation systemSystem, the required application program of at least one function;Storage data field can be stored uses institute according to acquisition map datum deviceData of establishment etc..In addition, memory 802 can include high-speed random access memory 802, non-volatile deposit can also be includedReservoir 802, for example, at least a magnetic disk storage 802, flush memory device or other non-volatile solid state memories 802.In some embodiments, memory 802 is optional including relative to the remotely located memory 802 of processor 801, these long-range storagesDevice 802 can pass through network connection to the device for obtaining map datum.The example of above-mentioned network includes but not limited to internet, enterpriseIndustry intranet, LAN, mobile radio communication and combinations thereof.
Input unit 803 can receive the device of the number or character information and generation of input with obtaining map datumUser setting and function control it is related key signals input.Input unit 803 may include pressing the equipment such as module.
One or more of modules are stored in the memory 802, when by one or more of processorsDuring 801 execution, the method for obtaining map datum in above-mentioned any means embodiment is performed.
The said goods can perform the method that the embodiment of the present application is provided, and has the corresponding function module of execution method and hasBeneficial effect.The not technical detail of detailed description in the present embodiment, reference can be made to the method that the embodiment of the present application is provided.
The electronic equipment of the embodiment of the present application exists in a variety of forms, including but not limited to:
(1) mobile communication equipment:The characteristics of this kind equipment is that have mobile communication function, and to provide speech, dataIt communicates as main target.This Terminal Type includes:Smart mobile phone (such as iPhone), multimedia handset, functional mobile phone and lowHold mobile phone etc..
(2) super mobile personal computer equipment:This kind equipment belongs to the scope of personal computer, there is calculating and processing work(Can, generally also have mobile Internet access characteristic.This Terminal Type includes:PDA, MID and UMPC equipment etc., such as iPad.
(3) portable entertainment device:This kind equipment can show and play multimedia content.The kind equipment includes:Audio,Video player (such as iPod), handheld device, e-book and intelligent toy and portable car-mounted navigation equipment.
(4) server:The equipment for providing the service of calculating, the composition of server include processor 801, hard disk, memory, systemBus etc., server is similar with general computer architecture, but due to needing to provide highly reliable service, in processing energyPower, stability, reliability, safety, scalability, manageability etc. are more demanding.
(5) other have the function of the electronic device of data interaction.
The apparatus embodiments described above are merely exemplary, wherein the module illustrated as separating component canTo be or may not be physically separate, the component shown as module may or may not be physics mouldBlock, you can be located at a place or can also be distributed on multiple network modules.It can be selected according to the actual needsIn some or all of module realize the purpose of this embodiment scheme.Those of ordinary skill in the art are not paying creativenessLabour in the case of, you can to understand and implement.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment canIt is realized by the mode of software plus required general hardware platform, naturally it is also possible to pass through hardware.Based on such understanding, onTechnical solution is stated substantially in other words to embody the part that the prior art contributes in the form of software product, it shouldComputer software product can store in a computer-readable storage medium, the computer readable recording medium storing program for performing include forThe readable form storage of computer (such as computer) or any mechanism of transmission information.For example, machine readable media is included onlyRead memory (ROM), random access memory (RAM), magnetic disk storage medium, optical storage media, flash medium, electricity, light,Sound or the transmitting signal of other forms (for example, carrier wave, infrared signal, digital signal etc.) etc., which includesSome instructions are used so that computer equipment (can be personal computer, server or the network equipment etc.) perform it is eachMethod described in certain parts of a embodiment or embodiment.
Finally it should be noted that:Above example is only to illustrate the technical solution of the embodiment of the present application rather than it is limitedSystem;Although the application is described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that:ItsStill it can modify to the technical solution recorded in foregoing embodiments or which part technical characteristic is equalIt replaces;And these modifications or replacement, each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solutionSpirit and scope.