更多>>关于我们

西安鲲之鹏网络信息技术有限公司从2010年开始专注于Web(网站)数据抓取领域。致力于为广大中国客户提供准确、快捷的数据采集相关服务。我们采用分布式系统架构,日采集网页数千万。我们拥有海量稳定高匿HTTP代理IP地址池,可以有效获取互联网任何公开可见信息。

您只需告诉我们您想抓取的网站是什么,您感兴趣的字段有哪些,你需要的数据是哪种格式,我们将为您做所有的工作,最后把数据(或程序)交付给你。

数据的格式可以是CSV、JSON、XML、ACCESS、SQLITE、MSSQL、MYSQL等等。

更多>>官方微博

西安鲲之鹏
陕西 西安

加关注

  • 【经验分享】QEMU/KVM如何修改开机启动顺序?
    virsh edit name-of-vm-instance
    如下示例:
     <os>
        <type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>
        <boot dev="network"></boot>
        <boot dev="cdrom"></boot>
        <boot dev="hd"></boot>
        <bootmenu enable='yes'/>
      </os>
    
    bootmenu的enable设置为yes,就可以在启动的时候按F12选择启动设备。
    •  
    发布时间:2024-03-12 11:51:28
  • 【经验分享】使用VNC远程连接KVM虚拟机,鼠标不同步而且偏移很大(想砸掉鼠标冲动的那种)问题解决:
    (1)编辑虚拟机配置文件,例如sudo virsh edit win10_1,然后将<input type="mouse" bus="ps2" />修改为<input type="tablet" bus="usb" /> 。
    (2)强制关闭虚拟机win10_1然后重启,问题解决。
    发布时间:2024-03-13 09:26:51
  • 【经验分享】Frida里Java.choose找到某个类的实例,在调用该实例方法时出现“script should be invoke on MainThread”问题的解决:

    // Assign the javascript code to a variable.
    jsCode = """
    // Create a method called Cheese that will be exported.
    function Cheese()
    {
    // Perform the code from injected context.
    Java.perform(function ()
    {
    // Variable to store the view representing the button
    // to click programmatically.
    var view;
    // Define the Runnable type javascript wrapper.
    var Runnable = Java.use("java.lang.Runnable");

    // Find the MainActivity class in myApp.
    Java.choose("com.example.myApp.MainActivity",
    {
    // Once it has been found execute the following code.
    onMatch: function(instance)
    {
    // Get the view representing button to click.
    // 2131436712 id derived from decompiling app.
    view = instance.findViewById(2131436712);
    // Define a new class that implements Runnable and provide
    // the implementation of the run() method which, will
    // execute from the Main thread.
    const MyRunnable = Java.registerClass({
    name:'com.example.MyRunnable',
    implements: [Runnable],
    methods: {
    // run executes button click.
    run(){
    instance.onClick(view);
    },
    }
    });

    // Create an instance of the class just created.
    var MyGuiUpdate = MyRunnable .$new();
    // Schedule the run method in MyGuiUpdate to
    // execute on the UI thread.
    instance.runOnUiThread(MyGuiUpdate );

    },
    onComplete:function(){}
    });
    解决方法来源:https://stackoverflow.com/questions/65790594/calling-an-api-to-modify-an-apps-gui-from-non-main-thread-in-frida
    发布时间:2024-02-23 13:00:33
  • 【经验分享】Frida script中如何给Java的Long类型变量赋值?
    例如,某Java类中有如下Long类型变量定义:
    /* renamed from: e */
    public Long f90137e;

    尝试修改e的值,依次做如下测试:
    (1)classObj.e.value = 1978705204; 会报"Error: Expected value compatible with java.lang.Long"错误。
    (2)classObj.e.value = Java.use('java.lang.Long').parseLong.overload('java.lang.String').call(Java.use('java.lang.Long'), "1978705204");依然会报上述错误。
    (3)这个方法可以成功赋值:classObj.e.value = Java.use('java.lang.Long').$new(1978705204);
    发布时间:2024-02-21 21:45:47
  • 【经验分享】miller使用filter查询条件,当遇到字段含有空格或者其它特殊字符时怎么处理?如下示例中某个字段含有点号,直接查询会报错。解决方法如下:

    示例:mlr --icsv --oxtab --from mouser_products_202312.csv filter '${Mfr.}=~"TDK" || ${Brand}=~"TDK"' then count

    使用Pandas时,也有类似问题,解决方法:
    df[df['Brand'].str.contains("TDK")|df['Mfr.'].str.contains("TDK")]
    另外,Stackoverflow(https://stackoverflow.com/questions/50697536/pandas-query-function-not-working-with-spaces-in-column-names)上有人说可以用`字段`将字段包裹起来,例如:a.query('`a b` == 5') ,但是需要Pandas是0.25版本,我机器上是0.24.2,测试没有效果。
    发布时间:2024-02-21 19:01:04
  • 【经验分享】今天本地windows系统adb shell突然报错"error: unknown host service",尝试"adb kill-server"、甚至重启PC和手机均不起作用。后来网上查了下,说是PC端adb的后台服务进程的5037端口被其它程序占用了。

    解决方法:使用netstat -ano找到并关闭占有者进程,问题解决。 ​​​
    发布时间:2024-02-21 18:55:05
  • 【经验分享】PPPOE认证返回“User Locked”,可能是因为MAC被拉黑了,换一个就好了。 ​​​
    发布时间:2024-01-16 13:00:17
  • 【经验分享】Linux如何限制一个命令的运行时长?可以使用timeout命令。
    例如,限制ping最多运行10秒,可以这样:
    timeout 10s ping www.baidu.com ​​​
    发布时间:2024-01-12 12:11:50
  • 【经验分享】Playwright库使用context.route()/page.route()过滤HTTP(S)请求时发现有Ajax漏包的情况。查官方文档,发现有云:
    browser_context.route() will not intercept requests intercepted by Service Worker. See this issue. We recommend disabling Service Workers when using request interception by setting browser.new_context.service_workers to 'block'.

    尝试:
    context = browser.new_context(service_workers='block')
    问题解决。

    参考1:https://playwright.dev/python/docs/api/class-browsercontext#browser-context-route
    参考2:https://github.com/microsoft/playwright/issues/15684
    发布时间:2024-01-10 11:56:20
  • 【经验分享】Python fontTools 获取字体文件的字形名称列表,遇到"smile", "question", "space"等AGL名称,如何将其转为Unicode代码?

    >>>import fontTools
    >>>hex(fontTools.agl.AGL2UV['smileface'])
    '0x263a'

    参考:https://fonttools.readthedocs.io/en/latest/_modules/fontTools/agl.html ​​​
    发布时间:2023-10-12 10:58:26
当前位置: 首页 > 技术文章 >
图吧地图坐标转GCJ-02(火星)坐标方法
发布时间:2014-01-16

图吧地图坐标转GCJ-02(火星)坐标需要分两步进行:


1)图吧坐标->WGS84坐标。
2)WGS84坐标->火星坐标。这一步在以前是不容易做到的,因为它的算法是一个"秘密"。幸运的是,它已经被某个数学天才"破解"了,在互联网上可以轻易找到其实现算法。
 
具体算法:
1)下面是图吧坐标转WGS84坐标的JavaScript实现,来源于图吧官方的JS文件。
function mapBar2WGS84(x, y) {
    x = parseFloat(x) * 100000 % 36000000;
    y = parseFloat(y) * 100000 % 36000000;

    x1 = parseInt( - (((Math.cos(y / 100000)) * (x / 18000)) + ((Math.sin(x / 100000)) * (y / 9000))) + x);
    y1 = parseInt( - (((Math.sin(y / 100000)) * (x / 18000)) + ((Math.cos(x / 100000)) * (y / 9000))) + y);

    x2 = parseInt( - (((Math.cos(y1 / 100000)) * (x1 / 18000)) + ((Math.sin(x1 / 100000)) * (y1 / 9000))) + x + ((x > 0) ? 1 : -1));
    y2 = parseInt( - (((Math.sin(y1 / 100000)) * (x1 / 18000)) + ((Math.cos(x1 / 100000)) * (y1 / 9000))) + y + ((y > 0) ? 1 : -1));

    return [x2 / 100000.0, y2 / 100000.0];
}
对应的Python实现如下:
from __future__ import division
import math
 
def mapBar2WGS84(lng, lat):
    """图吧坐标转WGS84坐标
    参数:
    lng - 经度
    lat - 纬度
    返回值:
    (经度, 纬度)
    """
    lng = float(lng) * 100000 % 36000000;
    lat = float(lat) * 100000 % 36000000;
    lng1 = int( - (((math.cos(lat / 100000)) * (lng / 18000)) + ((math.sin(lng / 100000)) * (lat / 9000))) + lng)
    lat1 = int( - (((math.sin(lat / 100000)) * (lng / 18000)) + ((math.cos(lng / 100000)) * (lat / 9000))) + lat)
    lng2 = int( - (((math.cos(lat1 / 100000)) * (lng1 / 18000)) + ((math.sin(lng1 / 100000)) * (lat1 / 9000))) + lng + (1 if lng > 0 else -1))
    lat2 = int( - (((math.sin(lat1 / 100000)) * (lng1 / 18000)) + ((math.cos(lng1 / 100000)) * (lat1 / 9000))) + lat + (1 if lat >0 else -1))
    return lng2 / 100000.0, lat2 / 100000.0
2)WGS84坐标转火星坐标的算法最早成形的版本是https://on4wp7.codeplex.com/SourceControl/changeset/view/21483#353936,它的Python实现如下:
from __future__ import division
from math import pi,sqrt,sin,cos
 
a = 6378245.0
ee = 0.00669342162296594323
 
# World Geodetic System ==> Mars Geodetic System
def transform(wgLat, wgLon):
    """
    transform(latitude,longitude) , WGS84
    return (latitude,longitude) , GCJ02
    """
    if (outOfChina(wgLat, wgLon)):
        mgLat = wgLat
        mgLon = wgLon
        return
    dLat = transformLat(wgLon - 105.0, wgLat - 35.0)
    dLon = transformLon(wgLon - 105.0, wgLat - 35.0)
    radLat = wgLat / 180.0 * pi
    magic = sin(radLat)
    magic = 1 - ee * magic * magic
    sqrtMagic = sqrt(magic)
    dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi)
    dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * pi)
    mgLat = wgLat + dLat
    mgLon = wgLon + dLon
    return mgLat,mgLon
 
def outOfChina(lat, lon):
    if (lon < 72.004 or lon > 137.8347):
        return True
    if (lat < 0.8293 or lat > 55.8271):
        return True
    return False
 
def transformLat(x, y):
    ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * sqrt(abs(x))
    ret += (20.0 * sin(6.0 * x * pi) + 20.0 * sin(2.0 * x * pi)) * 2.0 / 3.0
    ret += (20.0 * sin(y * pi) + 40.0 * sin(y / 3.0 * pi)) * 2.0 / 3.0
    ret += (160.0 * sin(y / 12.0 * pi) + 320 * sin(y * pi / 30.0)) * 2.0 / 3.0
    return ret
 
def transformLon(x, y):
    ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * sqrt(abs(x))
    ret += (20.0 * sin(6.0 * x * pi) + 20.0 * sin(2.0 * x * pi)) * 2.0 / 3.0
    ret += (20.0 * sin(x * pi) + 40.0 * sin(x / 3.0 * pi)) * 2.0 / 3.0
    ret += (150.0 * sin(x / 12.0 * pi) + 300.0 * sin(x / 30.0 * pi)) * 2.0 / 3.0
    return ret
做一个测试:
大众点评的地图系统采用的是图吧地图,就拿我家附近的“小肥羊”(http://www.dianping.com/shop/550517)为例,我们测试一下它在图标地图上的标注和转换为火星坐标后在谷歌地图上的标注点十分一致。
1)它的图吧坐标是:'lat': 34.27071, 'lng': 108.98258。在图吧地图的标注位置如下图所示。
2)计算它的WGS84坐标值:mapBar2WGS84(lng=108.98258, lat=34.27071)的结果为(108.98525, 34.27116)。
3)计算它的GCj-02坐标(火星坐标):transform(wgLat=34.27116, wgLon=108.98525)的结果为(34.26968285889569, 108.99006153253407)。在谷歌地图(ditu.google.cn)中的标注位置如下图所示。
 
结论:转GCj-02坐标火星坐标后的店与图吧原标注点有很小的偏差(10M内),上述算法精确度很高。
特别说明:本文旨在技术交流,请勿将涉及的技术用于非法用途,否则一切后果自负。如果您觉得我们侵犯了您的合法权益,请联系我们予以处理。
☹ Disqus被Qiang了,之前所有的评论内容都看不到了。如果您有爬虫相关技术方面的问题,欢迎发到我们的问答平台:http://spider.site-digger.com/