制作地图坐标(lan,& long)存储在sqlite数据库中
如何创建一个应用程序,在 SQLite 数据库中记录一系列经度和纬度值,并将它们显示为 MapActivity 上的彩色轨迹。
我需要帮助。如何将地图坐标存储在sqlite数据库中并在表中显示旅程详细信息。例如,我完成了从孟买到浦那的一次旅程。然后如何将数据存储到数据库中以供将来参考。当用户单击旅程名称时它应该提供所有详细信息
how to created an application that records a series of longitude and latitude values in a SQLite database and display them as a coloured track on a MapActivity.
I need help. How can store the map coordinates in sqlite database and display like journey details in table .For example I have done one journey from mumbai to Pune .Then how can store the data into database that can available for future reference .when user click on journey name it should give all details
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您是 Sqlite 新手,那么请查看此类的数据库
创建两个数据库文件如下
---->>>>
Database.h
在此文件中写入以下代码
---->>>>>>
Database.m
在此文件中写入以下代码
现在使用以下代码获取数据
它将以 NSDictionary 的形式返回所有行的数组。
要添加新记录,请使用以下代码
以同样的方式,还有更新和删除记录的方法。
所以这是我见过的最好的例子,我们只需要调用一种方法来获取、插入、更新或删除。
感谢您看到问题,
If you are new to Sqlite Then look into this class for data base
Create two database file as the following
---->>>>
Database.h
Write the following code in this file
---->>>>
Database.m
Write the following code in this file
Now to get data use the following code
It will return array of all the row in form of NSDictionary.
To add new record use the following code
In the same way there is also method to update and delete record.
so This is the best example I have seen we just need to call one method to for fetch, insert , update or delete.
Thanks for seeing the question,
要获取位置,请在项目中导入 corelocation 框架。
请点击此链接
http://developer.apple.com/library/ios/#samplecode/LocateMe/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007801 获取获取位置的示例。
这是在 json 中设置位置的格式
[{"Longitude":"45.2655","Latitude":"23.2655"},{"Longitude":"45.2655","Latitude":"23.2655"},{"Longitude" :"45.2655","纬度":"23.2655"}]
谢谢。
To get location import corelocation framework in your project.
follow this link
http://developer.apple.com/library/ios/#samplecode/LocateMe/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007801 to get sample for getting location.
This is the format to set location in json
[{"Longitude":"45.2655","Latitude":"23.2655"},{"Longitude":"45.2655","Latitude":"23.2655"},{"Longitude":"45.2655","Latitude":"23.2655"}]
Thanks.
您需要创建一个包含字段......Source,Destination,SourceLat,SourceLong,DestinationLat,DestinationLong.......的表,在此您将通过
谢谢,
You need to create a table with fields ...... Source,Destination,SourceLat,SourceLong,DestinationLat,DestinationLong....... and in this you will pass
Thanks,
首先你需要创建 NSMutableArray *arrayOflocation 对象;在 .h 文件中,
然后在 locationUpdate 方法中编写以下代码,
现在当您保存行程时,您需要创建 json 格式的字符串,因为您需要使用 json API,您可以使用 google 轻松获取它。当你想将字符串保存到文件中时,编写以下代码。
最后需要将文件名以及行程的其他详细信息存储在 sqlite 中。
First you need to create object of NSMutableArray *arrayOflocation; in .h file,
Then in you locationUpdate method write the following code
now when you save the trip you need to create the string for the json format for that you need to use json API you can get it using google easily . write the following code when you want to save the string in file.
and at finally need to store the file name in sqlite along with other detail for the trip.