dongyi6668 2014-03-17 19:49
浏览 139

从GIS形状文件中提取每个邻域的多边形数据

I have a dataset that has four types of files with the following file extensions - .DBF,.PRJ,SHP,SHX

My goal is to get all the polygon coordinates for each neighborhood and draw the boundary outline on the google map when a user is on a specific Neighborhood page. Currently the datasource for the site is a MySQL Database.

I have tried converting the shp file to Geojson but then parsing that file is time taking.

I have also tried using tools such as QGIS and shp2sql etc.

I would like to know what is the best way to get the main attributes from the dataset along with each neighborhood's Polygon coordinates.

please advise

  • 写回答

2条回答 默认 最新

  • douzheng5717 2014-03-25 22:10
    关注

    I have managed to accomplish this using the ogr2ogr command line tool -

    ogr2ogr -f "MySQL" MYSQL:"mydb,host=myhost,user=mylogin,password=mypassword,port=3306" -nln "world" -a_srs "EPSG:4326" path/to/world_adm0.shp

    I have the polygon coordinates in a geometry field in the table attached to its corresponding neighborhood id.

    I did Select ASTEXT(Shape) as POLYGON from world to get the array of coordinates and now I can convert that to json and send it to Javascript so that it can be mapped

    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站