使用gvNIX创建基于地图的应用程序 [英] Using gvNIX to create Map Based Application

查看:128
本文介绍了使用gvNIX创建基于地图的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对创建gvNIX/Roo应用程序感兴趣,该应用程序可以在地图上显示坦桑尼亚医疗机构的位置.我正在此处中尝试该教程.但是,我的数据采用下面显示的格式,其中我的位置数据位于两列(southingseastings)中.本教程介绍了如何创建三种数据类型:

I am interested in creating a gvNIX/Roo application which shows the location of health facilities in Tanzania on a map. I am trying the tutorial available here. However my data is in the format shown below where my location data is in two columns (southings and eastings). The tutorial shows how to create three data types:

field geo --fieldName location --type POINT --class ~.domain.Owner
field geo --fieldName distance --type LINESTRING --class ~.domain.Owner
field geo --fieldName area --type POLYGON --class ~.domain.Owner

假设我需要POINT数据类型来保存医疗机构位置上的数据,但是不确定如何将下面的2列(南北和东向)放入单个POINT变量中. GIS也很新.数据如下(CSV格式):

Am assuming I need the POINT data type to hold data on a health facility location but am not sure how to get the below 2 columns (southings and eastings) into a single POINT variable. Am pretty new to GIS as well. The data is as below (csv format):

outlet_name,Status ,southings,eastings,streetward,name_of_outlet 
REHEMA MEDICS,02,2.49993,32.89512,K/POLISI,REVINA
KIRUMBA MEDICS,02,2.50023,32.89503,K/POLISI,GEDION
KIRUMBA PHARMACY,02,2.50152,32.89742,K/POLISI,MAURETH
TULI MEDICS,02,2.48737,32.89686,KITANGIRI,TULI
JULLY MEDICS,02,2.53275,32.93855,BUZURUGA,JULLY
MAGOMA MEDICS,02,2.53181,32.94211,BUZURUGA,MAGOMA
MECO PHARMACY,02,2.52923,32.94730,MECCO,DORCAS
UPENDO MEDICS,02,2.52923,32.94786,MECCO,UPENDO
DORIS MEDICS,02,2.49961,32.89191,KABUHORO,DORIS
SOPHIA MEDICS,02,2.49975,32.89120,KABUHORO,ESTER
MWALONI PHAMCY,02,2.56351,32.89416,MWALONI,ESTER
SILVER PHAMACY,02,2.51728,32.90614,K/KILOMERO,WANDWATA
KIBO PHARMACY,02,2.51688,32.90710,MISSION,MARIAM

谢谢

推荐答案

您需要将坐标转换为 WKT 格式(众所周知的文本),以便将其插入数据库(支持Postgis的Postgresql数据库)的列中.为此,您需要执行以下步骤:

You need to transform your coordinates to WKT format (Well Known Text) in order to insert them in a column in your database (a postgresql database with postgis support). In order to achieve this you need to follow these steps:

  • 找到您的坐标参考系统(CRS)的SRID.即,定义您的坐标系的标识符.否则,您的点将与真实坐标不匹配.在最后一步中,您将需要SRID.
  • 将您的数据转换为WKT.插入点所需的数据在southings和eastings列中(我想它们等于最常用的经度和纬度),因此您需要将这些列转换为WKT格式的单个列.例如对于您的第一行数据:Point(32.89512 2.49993).注意它们之间的空间以及数字之间的切换.
  • 使用SQL语法(但使用postgis函数)继续插入.第一行的示例为:INSERT into health_facilities (outlet_name, Status, streetward, location) VALUES ('REHEMA MEDICS', 02, 'K/POLISI', ST_GeomFromText('Point(32.89512 2.49993)', 4326));.其中"4326"是您必须找到的SRID的编号(假设是最常见的-> EPSG:4326).
  • Find the SRID of your coordinates reference system (CRS). That is, the identificator which define your coordinates system. Otherwise, your points won't match the real coordinates. You'll need the SRID in the last step.
  • Transform your data to WKT. The data needed for inserting the points is in the southings and eastings columns (I suppose they are equal to latitude and longitude, that are the most common used), so you'll need to transform these columns in one single column with WKT format. e.g. for your first row of data: Point(32.89512 2.49993). Note the space between them and the switch between the numbers.
  • Proceed with the inserts with SQL syntax, but using postgis functions. An example for your first row would be: INSERT into health_facilities (outlet_name, Status, streetward, location) VALUES ('REHEMA MEDICS', 02, 'K/POLISI', ST_GeomFromText('Point(32.89512 2.49993)', 4326));. Where "4326" are the numbers of the SRID you have to find (supossing it is the most common -> EPSG:4326).

您可以在此处此处.此外,还有几个页面可用于检查坐标并在不同的CRS之间进行转换,例如

You can find more info here and here. Also there are several pages where you can check coordinates and transform them between diferent CRS, like this and this.

这篇关于使用gvNIX创建基于地图的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆