Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 20-05-2012, 08:37   #1
Registered User
 
globalkeith's Avatar

Join Date: Sep 2010
Location: Zhuhai, China
Boat: Prout G55
Posts: 76
osm_pi - OpenSeaMap plugin for OpenCPN

Ok before you get too excited I've only made a stub project, this is my first attempt at OpenCPN plugin and my C++ knowledge is weak.

Here is the general idea:

OpenSeaMap is basically a set of tags inside the OpenStreetMap database. There are various tools already available for creating seamarks - and a growing data set. This is the wikipedia of seamarks. I believe a plugin enabling integration with this database will be a great addition.

1. Implement basic plugin structure*
2. Establish getting lat/lon bounds from OpenCPN view
3. Implement API calls to retrieve OSM data**
4. Implement a local data store***
5. Implement API calls to retrieve change sets (new or changes to data based on date)
6. Implement plugin UI to specify data types
7. Implement plugin UI to support API authentication to OpenStreetMap
8. Implement UI to add/edit/update seamark data

* I tried with demo_pi but couldn't get it working, so now I'm trying again with survey_pi
** the Overpass API supports requests for specific bounds and tags (all OSM data is tagged with various "seamark:" tags relating to S57 data types)
*** the survey_pi from Pavel uses spatialite (sqlite) database - which sounds like a great place to start

---

The repo is here: https://github.com/ktec/osm_pi


Please let me know if anyone else is already working on something like this, and if anyone is interested in helping me, just fork the project and send me pull requests, I would be hugely grateful!
__________________

__________________
globalkeith is offline   Reply With Quote
Old 21-05-2012, 02:42   #2
Senior Cruiser
 
idpnd's Avatar

Cruisers Forum Supporter

Join Date: Sep 2007
Location: Almerķa, ES
Boat: Chiquita 46 - Libertalia
Posts: 1,551
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Sounds exciting, also as a shared repository for cruising info
__________________

__________________
sv Libertalia
idpnd is offline   Reply With Quote
Old 21-05-2012, 10:09   #3
Registered User
 
globalkeith's Avatar

Join Date: Sep 2010
Location: Zhuhai, China
Boat: Prout G55
Posts: 76
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Ok, getting pretty frustrated now - I've tried from 3 sources (demo_pi, wmm_pi and survey_pi) to create my own "empty" plugin, with nothing more than an icon, and relevant plugin handlers - still getting no where. While its compiling as part of the main build, and installing to the correct location, despite my best efforts when I run OpenCPN there's no sign of my plugin in the preferences panel.

If someone who knows about these things could take a look at:

https://github.com/ktec/osm_pi

And point out what I'm missing I would be very grateful

thanks
Keith
__________________
globalkeith is offline   Reply With Quote
Old 21-05-2012, 21:54   #4
Registered User
 
globalkeith's Avatar

Join Date: Sep 2010
Location: Zhuhai, China
Boat: Prout G55
Posts: 76
Re: osm_pi - OpenSeaMap plugin for OpenCPN

1. Implement basic plugin structure*
2. Establish getting lat/lon bounds from OpenCPN view
3. Implement API calls to retrieve OSM data**
4. Implement a local data store***
5. Implement API calls to retrieve change sets (new or changes to data based on date)
6. Implement plugin UI to specify data types
7. Implement plugin UI to support API authentication to OpenStreetMap
8. Implement UI to add/edit/update seamark data
__________________
globalkeith is offline   Reply With Quote
Old 21-05-2012, 22:00   #5
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,884
Re: osm_pi - OpenSeaMap plugin for OpenCPN

globalkeith....

What does OpenCPN logfile say?

What version of OpenCPN are you working with?

Dave
__________________
bdbcat is offline   Reply With Quote
Old 21-05-2012, 22:06   #6
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,884
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Keith....

Are you on Windows or linux?

If linux, put some printf in the PlugIn code, especially to see if the ::Init() call is made.

Code:
int osm_pi::Init(void){
  printf("OSM Init call\n");
  ::wxBell();                       // ring the bell

      m_lat = 999.0;
      m_lon = 999.0;
      AddLocaleCatalog( _T("opencpn-osm_pi") );


      // Set some default private member parameters
      m_osm_dialog_x = 0;
      m_osm_dialog_y = 0;


      ::wxDisplaySize(&m_display_width, &m_display_height);


      //    Get a pointer to the opencpn display canvas, to use as a parent for the POI Manager dialog
      m_parent_window = GetOCPNCanvasWindow();


      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();
Dave
__________________
bdbcat is offline   Reply With Quote
Old 22-05-2012, 02:10   #7
Registered User
 
globalkeith's Avatar

Join Date: Sep 2010
Location: Zhuhai, China
Boat: Prout G55
Posts: 76
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Hi Dave,

Pavel already helped me get this resolved this morning.

Now trying to:

2. Establish getting lat/lon bounds from OpenCPN view

I've managed to register for cursor lat/lon events using "WANTS_CURSOR_LATLON" and write this to the log, but I'm actually looking for something else.

I want to be able to get the bounds of the screen, so something like

min_lat, min_lon, max_lat, max_lon

Any ideas? I've searched through the existing plugins but not found anything just yet.

thanks
Keith

I'm on linux btw...
__________________
globalkeith is offline   Reply With Quote
Old 22-05-2012, 02:24   #8
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,018
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Keith...
WANTS_ONPAINT_VIEWPORT & https://github.com/nohal/OpenCPN/blob/cppcheck/include/ocpn_plugin.h#L397 & https://github.com/nohal/OpenCPN/blo...n_plugin.h#L97 (sample usage in https://github.com/nohal/gecomapi_pi)
Or do you want to create it as an overlay? Then have a look at survey, grib or kml plugin code. Or implement it as a custom chart type? No sample code available for this, but BSB4 and NV plugins use it.

Pavel
__________________
nohal is online now   Reply With Quote
Old 22-05-2012, 03:59   #9
Registered User
 
globalkeith's Avatar

Join Date: Sep 2010
Location: Zhuhai, China
Boat: Prout G55
Posts: 76
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Pavel,

Right now I'm just looking to get the bounds of the view port to make my API calls - however your comments raise some good options.

Once I get data back from I'll want to paint:

- what are the benefits of using either custom chart type or overlay?
- what factors should I consider when making this choice?
__________________
globalkeith is offline   Reply With Quote
Old 22-05-2012, 05:30   #10
Registered User
 
globalkeith's Avatar

Join Date: Sep 2010
Location: Zhuhai, China
Boat: Prout G55
Posts: 76
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Ok great, thanks Pavel, I'll pulling off these:

vp.lat_max, vp.lat_min, vp.lon_max, vp.lon_min

But i'm getting values like this:

-1474451447,1078553508,-1895027811,1078479710

Sorry if this is a dumb question but what kind of processing do I need to get this into decimal degress? Do I just /60/60 or something?
__________________
globalkeith is offline   Reply With Quote
Old 22-05-2012, 05:42   #11
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,018
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Keith...
https://github.com/nohal/gecomapi_pi...pi_pi.cpp#L287 - they are doubles representing degrees, no calculation needed. Are you sure your logic is right? If you push the code to github, I will have a look...

Pavel
__________________
nohal is online now   Reply With Quote
Old 22-05-2012, 06:14   #12
Registered User
 
globalkeith's Avatar

Join Date: Sep 2010
Location: Zhuhai, China
Boat: Prout G55
Posts: 76
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Thanks Pavel, My bad, it was just that i was using "%d" in my LogMessage, thats why!!
__________________
globalkeith is offline   Reply With Quote
Old 22-05-2012, 22:35   #13
Registered User
 
globalkeith's Avatar

Join Date: Sep 2010
Location: Zhuhai, China
Boat: Prout G55
Posts: 76
Re: osm_pi - OpenSeaMap plugin for OpenCPN

I need write code to start download and parse an xml file. Looking at survey_pi its using TinyXml package and looking at the chartdldr_pi its using a httpbuilder.cpp library. Are these good options, or should I consider something else?
__________________
globalkeith is offline   Reply With Quote
Old 22-05-2012, 22:44   #14
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,018
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Keith...
TinyXml is used everywhere in OpenCPN - very stable, very simple, very very fast. If you don't need a validating parser, it's your choice.
httpbuilder. Well, it's actually the reason for chartdldr_pi not being finished - I was unable to make it reliably work in multiple threads on all platforms with the same codebase. But it's pretty possible that the reason is I was doing something wrong, as me, C++ and multithreading are not kind of friends. But otherwise it was not that bad to use and I didn't find (actually didn't look for) anything better. You may try wxCode - wxCURL

Pavel
__________________
nohal is online now   Reply With Quote
Old 23-05-2012, 00:48   #15
Registered User
 
globalkeith's Avatar

Join Date: Sep 2010
Location: Zhuhai, China
Boat: Prout G55
Posts: 76
Re: osm_pi - OpenSeaMap plugin for OpenCPN

Ok so wxCurl sounds like a good option, however when trying to build I get an error about wxST_ELLIPSIZE_MIDDLE (not present in 2.8 wxW versions)

For wxCURL 1.0 I need wxW 2.9

What are the implications of this? What version does OpenCPN currently depend upon?

Also, if I decide to use this library, how should I proceed - do I compile and then add something to my plugin header file, or do i need to include the wxCurl source with the plugin?

(sorry little out of my depth here without examples to follow)

Keith
__________________

__________________
globalkeith is offline   Reply With Quote
Reply

Tags
opencpn

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 17:51.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.