You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Chris Howe <cj...@yahoo.com> on 2007/12/07 05:53:22 UTC

Re: GIS Tools/modeling

Al, others

I've been studying this a bit further and I'm running into a couple of limitations and I'm not sure if they're avoidable without purchasing subscriptions.  When geocoding the only free services I'm finding are webservices that don't allow batch processing so each request/response cycle takes about 2 seconds.  Have you come across anything that can batch the requests and response to retrieve the coordinates of the address?  And even better, one that doesn't limit the number of addresses.  I would simply do an overlay, but I'm needing to run calculations to test whether the coordinate pair is inside a polygon.

----- Original Message ----
From: Al Byers <by...@automationgroups.com>
To: dev@ofbiz.apache.org
Sent: Monday, November 26, 2007 2:22:17 PM
Subject: Re: GIS Tools/modeling

Here is an interesting blog talking about some of the issues:
http://radar.oreilly.com/archives/2006/05/where_20_standards_1.html
This was written in 2006 and it could be that GeoRSS has come on
 stronger
since then.

You may well want to implement your app using GeoRSS. I forgot that I
 added
the RomeEventHandler. I see that JIRA issue OFBIZ-721 deals with RSS
 and my
issue is https://issues.apache.org/jira/browse/OFBIZ-1208. Maybe we
 should
use 1208 to capture discussion.

My controller.xml file has these:

    <!--handler name="wfs" type="view" class="
org.ofbiz.webapp.view.WfsViewHandler"/-->
    <handler name="rome" type="request" class="
org.ofbiz.webapp.event.RomeEventHandler"/>
...
    <request-map uri="ViewCustomRssFeed">
        <security https="false" auth="false"/>
        <event type="rome" invoke="generateCustomRssFeed"/>
        <response name="success" type="none"/>
        <response name="error" type="view" value="error"/>
    </request-map>

Here is the code for generateCustomRssFeed:


       public static Map generateCustomRssFeed(DispatchContext dctx,
 Map
context) {
           Debug.logInfo("generateCustomCustomRssFeed(0) context:" +
context, module);
           GenericValue userLogin = (GenericValue)
 context.get("userLogin");
           String entryLink = (String) context.get("entryLink");
           String feedType = (String) context.get("feedType");
           Locale locale = (Locale) context.get("locale");

           // create the main link
           String mainLink = (String) context.get("mainLink");

           LocalDispatcher dispatcher = dctx.getDispatcher();
           GenericDelegator delegator = dctx.getDelegator();

           // get the main blog content
           GenericValue content = null;
             // create the feed
           SyndFeed feed = new SyndFeedImpl();
           feed.setFeedType(feedType);
           feed.setLink(mainLink);

           feed.setTitle("Custom RSS Feed");
           feed.setDescription("Custom RSS Feed");
           Debug.logInfo("generateCustomRssFeed(1) feed:" + feed,
 module);
           feed.setEntries(generateEntryList(dispatcher, delegator,
entryLink, locale, userLogin));

           Map resp = ServiceUtil.returnSuccess();
           resp.put("wireFeed", feed.createWireFeed());
           return resp;
       }

       public static List generateEntryList(LocalDispatcher dispatcher,
GenericDelegator delegator, String entryLink, Locale locale,
 GenericValue
userLogin) {
           List entries = FastList.newInstance();
           List customList = null;
           Map nullMap = null;
           try {
               customList = delegator.findByAnd("CustomEntity",
 nullMap);
           } catch (GenericEntityException e) {
               Debug.logError(e, module);
           }

           if (UtilValidate.isEmpty(customList)) {
               return entries;
           }


               Iterator i = customList.iterator();
               while (i.hasNext()) {
                   GenericValue v = (GenericValue) i.next();
           Debug.logInfo("generateEntryList(1) v:" + v, module);
                   String sub = v.getString("customName");
                   if (sub != null) {
                       String thisLink = entryLink + "?customId=" +
v.getString("customId");
                       SyndContent desc = new SyndContentImpl();
                       desc.setType("text/plain");
                       desc.setValue(sub);

                       SyndEntry entry = new SyndEntryImpl();
                       entry.setTitle(v.getString("customName"));
                       entry.setPublishedDate(v.getTimestamp
("createdStamp"));
                       entry.setDescription(desc);
                       entry.setLink(thisLink);

//entry.setAuthor((v.getString("createdByUserLogin")));

                       GeoRSSModule geoRSSModule = new
 W3CGeoModuleImpl();
                       Double lon = v.getDouble("longitude");
                       Double lat = v.getDouble("latitude");
                       //GeoRSSModule geoRSSModule = new
 SimpleModuleImpl();
                       if (lon != null && lat != null) {
                           Position pos = new Position(
 lat.doubleValue(),
lon.doubleValue());
                           geoRSSModule.setPosition(pos);
                           entry.getModules().add(geoRSSModule);
                           Debug.logInfo("generateEntryList(2) entry:"
 +
entry, module);
                           entries.add(entry);
                       }
                   }
               }

           return entries;
       }

I have added most of this email to JIRA-1208. I should mention that
 this
work was sponsored by HotWax.

-Al

On 11/26/07, Chris Howe <cj...@yahoo.com> wrote:
>
> From an OFBiz community perspective KML/Z would just be an output
 manner
> (simply done through freemarker templates) as there doesn't seem to
 be a
> whole lot of interest in storing data in XML (I floated the Xindice
> integration earlier in the year and while it works there doesn't seem
 to be
> much interest).  The storage seems to be better through adding
 geospatial
> tables or a secondary database and then linking it to a contentId.
>
> I need to do quite a bit of homework on the issue as a whole before I
> bloviate on the issue.  The topics that need to be decide on would
 be:
> 1) storage format
> 2) retrieval/output format(s)
> 3) miscellaneous tools (centroid, area, perimeter, etc calculations)
> 4) possibly rendering tools (if online map overlays are too limiting)
> Let me know if I'm missing areas while I get my reading list in order
 :-)
>
> ----- Original Message ----
> From: Al Byers <by...@automationgroups.com>
> To: dev@ofbiz.apache.org
> Sent: Monday, November 26, 2007 12:18:02 PM
> Subject: Re: GIS Tools/modeling
>
> Chris,
>
> I am not sure that KML and KMZ are not better ways to go. I went the
> "community" route because it just seems to fit in with OFBiz's
> philosophy
> and even Google should be  (and I think is) using open source
 standards
> in
> their work. I should be able to discuss the advantages and
> disadvantages of
> the Google vs. the Geoserver/MapBuilder approaches, but I would have
 to
> research the KML/Z tech more, first.
>
> The question to me answered is whether or not KML/Z are as good at
> accessing
> Geoserver servers as the MapBuilder product. If they don't do as good
 a
> job,
> then I think that developers may sometimes wish to access data that
 is
> not
> served up by Google Maps and won't be able to.
>
> The other test for KML/Z is if you can do custom rollover popups with
> KML/Z.
> It is easy to do simple ones, but sometimes you may wish to do more
> complicated ones and I am not sure about the suitability of KML/Z for
> that -
> though I would guess it does fine.
>
> Please don't hesitate to discuss your issues here. Adding GIS to
 OFBiz
> would
> be a really cool add-on and the more people we can involve, the
 better.
>
> -Al
>
> On 11/26/07, Chris Howe <cj...@yahoo.com> wrote:
> >
> > Very interesting. My implementation is extremely crude in
 comparison.
>   I
> > was only outputting KML and KMZ for Google Earth. It seems I have
> quite a
> > bit of homework to do before being able to add very much to the
> discussion.
> >
> > ----- Original Message ----
> > From: Al Byers <by...@automationgroups.com>
> > To: dev@ofbiz.apache.org
> > Sent: Monday, November 26, 2007 10:46:31 AM
> > Subject: Re: GIS Tools/modeling
> >
> >
> > Hey Chris,
> >
> > Yes, I did some GIS work a few months ago. What I did was add a WFS
> > interface to OFBiz. It is WfsEventHandler class in webapp.event. I
> did
> > a lot
> > of work with GeoServer (http://docs.codehaus.org/display/GEOS/Home)
> >   and
> > MapBuilder  (http://docs.codehaus.org/display/MAInterstinP/Home)
 for
> the
> > client
> > side.
> > I used MySQL for a geo spatial DB. I think GeoServer is definitely
> the
> > way
> > to go for the server since it is Java based and I had no trouble
> > including
> > it in my ofbiz tomcat setup. There is an effort to consolidate many
> of
> > the
> > various client packages (such as OpenLayers) and MapBuilder seems
 to
> be
> > at
> > the forefront of that effort (it uses OpenLayers to render, but
 adds
> an
> > XML
> > syntax for implementing client frontends.
> >
> > It is a very exciting time for the GIS community as they are
 working
> > together to create products and mashups that are the same sort of
> > Goliath-killers in the GIS world that OFBiz is becoming in the ERP
> > world.
> >
> > I also did a GeoRSS interface so that I could add markers to Google
> > Maps,
> > but I did not see how to add that to the ofbiz base code. I would
 be
> > willing
> > to share that code if we can see where to add it. See
> > http://docs.codehaus.org/display/GEOSDOC/GeoRSS.
> >
> > I think the WFS interface is the critical part, as it lets you use
> > other
> > servers like GeoServer to server up the base GIS layers, but lets
 you
> > use
> > OFBiz to store and server the "points of interest". I only modeled
> > points
> > with my WfsEventHandler class. It needs to be extended to do a
> > rectangular
> > "find". One of the key things that I did was implement the
> "ogc:filter"
> > using FreeMarker templates. That is the part that needs to be
> extended
> > to
> > implement the rectangular find.
> >
> > If you are not familiar with the WFS, WMS and WCS standards, you
 need
> > to be.
> > They are what make all the synergy possible.
> >
> > It has been a few months since I have had a chance to work on it
> (which
> > might as well be a few years at my age) so you might want to google
> > "gis"
> > and "ofbiz" to see what else I had to say about it. I would be glad
> to
> > discuss and work on something more substantial for ofbiz, but I am
> not
> > actively working on GIS at the moment, so my time will be limited.
> >
> > -Al
> >
> > On 11/26/07, Chris Howe <cj...@yahoo.com> wrote:
> > >
> > > I just completed a rather remedial GIS implementation (very
 poorly
> > > designed, but works for it's purpose).  Anyone have any
> > > interest/experience/intelligent thought with this?
> > >
> > >
> > >
> >
> >
> >
> >
>
>
>
>




Re: GIS Tools/modeling

Posted by Al Byers <by...@automationgroups.com>.
Chris,

Sorry, I did not get around to implementing os geocoders. Here are some
links I came across, however:



http://www.ontok.com/geocode/compare
http://www.ontok.com/api


http://geocoder.us/

One possible alternative is to find the code for a geocoder and use some of
the free data that is available for it to operate on. I did not look into
that route, but it seems there should be plenty of examples out there and
tons of TIGER  data.

-Al

Re: GIS Tools/modeling

Posted by BJ Freeman <bj...@free-man.net>.
since there is only one set for an address, once in ofbiz you don't have
to ask for it again.


Chris Howe sent the following on 12/6/2007 8:53 PM:
> Al, others
> 
> I've been studying this a bit further and I'm running into a couple of limitations and I'm not sure if they're avoidable without purchasing subscriptions.  When geocoding the only free services I'm finding are webservices that don't allow batch processing so each request/response cycle takes about 2 seconds.  Have you come across anything that can batch the requests and response to retrieve the coordinates of the address?  And even better, one that doesn't limit the number of addresses.  I would simply do an overlay, but I'm needing to run calculations to test whether the coordinate pair is inside a polygon.
> 
> ----- Original Message ----
> From: Al Byers <by...@automationgroups.com>
> To: dev@ofbiz.apache.org
> Sent: Monday, November 26, 2007 2:22:17 PM
> Subject: Re: GIS Tools/modeling
> 
> Here is an interesting blog talking about some of the issues:
> http://radar.oreilly.com/archives/2006/05/where_20_standards_1.html
> This was written in 2006 and it could be that GeoRSS has come on
>  stronger
> since then.
> 
> You may well want to implement your app using GeoRSS. I forgot that I
>  added
> the RomeEventHandler. I see that JIRA issue OFBIZ-721 deals with RSS
>  and my
> issue is https://issues.apache.org/jira/browse/OFBIZ-1208. Maybe we
>  should
> use 1208 to capture discussion.
> 
> My controller.xml file has these:
> 
>     <!--handler name="wfs" type="view" class="
> org.ofbiz.webapp.view.WfsViewHandler"/-->
>     <handler name="rome" type="request" class="
> org.ofbiz.webapp.event.RomeEventHandler"/>
> ...
>     <request-map uri="ViewCustomRssFeed">
>         <security https="false" auth="false"/>
>         <event type="rome" invoke="generateCustomRssFeed"/>
>         <response name="success" type="none"/>
>         <response name="error" type="view" value="error"/>
>     </request-map>
> 
> Here is the code for generateCustomRssFeed:
> 
> 
>        public static Map generateCustomRssFeed(DispatchContext dctx,
>  Map
> context) {
>            Debug.logInfo("generateCustomCustomRssFeed(0) context:" +
> context, module);
>            GenericValue userLogin = (GenericValue)
>  context.get("userLogin");
>            String entryLink = (String) context.get("entryLink");
>            String feedType = (String) context.get("feedType");
>            Locale locale = (Locale) context.get("locale");
> 
>            // create the main link
>            String mainLink = (String) context.get("mainLink");
> 
>            LocalDispatcher dispatcher = dctx.getDispatcher();
>            GenericDelegator delegator = dctx.getDelegator();
> 
>            // get the main blog content
>            GenericValue content = null;
>              // create the feed
>            SyndFeed feed = new SyndFeedImpl();
>            feed.setFeedType(feedType);
>            feed.setLink(mainLink);
> 
>            feed.setTitle("Custom RSS Feed");
>            feed.setDescription("Custom RSS Feed");
>            Debug.logInfo("generateCustomRssFeed(1) feed:" + feed,
>  module);
>            feed.setEntries(generateEntryList(dispatcher, delegator,
> entryLink, locale, userLogin));
> 
>            Map resp = ServiceUtil.returnSuccess();
>            resp.put("wireFeed", feed.createWireFeed());
>            return resp;
>        }
> 
>        public static List generateEntryList(LocalDispatcher dispatcher,
> GenericDelegator delegator, String entryLink, Locale locale,
>  GenericValue
> userLogin) {
>            List entries = FastList.newInstance();
>            List customList = null;
>            Map nullMap = null;
>            try {
>                customList = delegator.findByAnd("CustomEntity",
>  nullMap);
>            } catch (GenericEntityException e) {
>                Debug.logError(e, module);
>            }
> 
>            if (UtilValidate.isEmpty(customList)) {
>                return entries;
>            }
> 
> 
>                Iterator i = customList.iterator();
>                while (i.hasNext()) {
>                    GenericValue v = (GenericValue) i.next();
>            Debug.logInfo("generateEntryList(1) v:" + v, module);
>                    String sub = v.getString("customName");
>                    if (sub != null) {
>                        String thisLink = entryLink + "?customId=" +
> v.getString("customId");
>                        SyndContent desc = new SyndContentImpl();
>                        desc.setType("text/plain");
>                        desc.setValue(sub);
> 
>                        SyndEntry entry = new SyndEntryImpl();
>                        entry.setTitle(v.getString("customName"));
>                        entry.setPublishedDate(v.getTimestamp
> ("createdStamp"));
>                        entry.setDescription(desc);
>                        entry.setLink(thisLink);
> 
> //entry.setAuthor((v.getString("createdByUserLogin")));
> 
>                        GeoRSSModule geoRSSModule = new
>  W3CGeoModuleImpl();
>                        Double lon = v.getDouble("longitude");
>                        Double lat = v.getDouble("latitude");
>                        //GeoRSSModule geoRSSModule = new
>  SimpleModuleImpl();
>                        if (lon != null && lat != null) {
>                            Position pos = new Position(
>  lat.doubleValue(),
> lon.doubleValue());
>                            geoRSSModule.setPosition(pos);
>                            entry.getModules().add(geoRSSModule);
>                            Debug.logInfo("generateEntryList(2) entry:"
>  +
> entry, module);
>                            entries.add(entry);
>                        }
>                    }
>                }
> 
>            return entries;
>        }
> 
> I have added most of this email to JIRA-1208. I should mention that
>  this
> work was sponsored by HotWax.
> 
> -Al
> 
> On 11/26/07, Chris Howe <cj...@yahoo.com> wrote:
>> From an OFBiz community perspective KML/Z would just be an output
>  manner
>> (simply done through freemarker templates) as there doesn't seem to
>  be a
>> whole lot of interest in storing data in XML (I floated the Xindice
>> integration earlier in the year and while it works there doesn't seem
>  to be
>> much interest).  The storage seems to be better through adding
>  geospatial
>> tables or a secondary database and then linking it to a contentId.
>>
>> I need to do quite a bit of homework on the issue as a whole before I
>> bloviate on the issue.  The topics that need to be decide on would
>  be:
>> 1) storage format
>> 2) retrieval/output format(s)
>> 3) miscellaneous tools (centroid, area, perimeter, etc calculations)
>> 4) possibly rendering tools (if online map overlays are too limiting)
>> Let me know if I'm missing areas while I get my reading list in order
>  :-)
>> ----- Original Message ----
>> From: Al Byers <by...@automationgroups.com>
>> To: dev@ofbiz.apache.org
>> Sent: Monday, November 26, 2007 12:18:02 PM
>> Subject: Re: GIS Tools/modeling
>>
>> Chris,
>>
>> I am not sure that KML and KMZ are not better ways to go. I went the
>> "community" route because it just seems to fit in with OFBiz's
>> philosophy
>> and even Google should be  (and I think is) using open source
>  standards
>> in
>> their work. I should be able to discuss the advantages and
>> disadvantages of
>> the Google vs. the Geoserver/MapBuilder approaches, but I would have
>  to
>> research the KML/Z tech more, first.
>>
>> The question to me answered is whether or not KML/Z are as good at
>> accessing
>> Geoserver servers as the MapBuilder product. If they don't do as good
>  a
>> job,
>> then I think that developers may sometimes wish to access data that
>  is
>> not
>> served up by Google Maps and won't be able to.
>>
>> The other test for KML/Z is if you can do custom rollover popups with
>> KML/Z.
>> It is easy to do simple ones, but sometimes you may wish to do more
>> complicated ones and I am not sure about the suitability of KML/Z for
>> that -
>> though I would guess it does fine.
>>
>> Please don't hesitate to discuss your issues here. Adding GIS to
>  OFBiz
>> would
>> be a really cool add-on and the more people we can involve, the
>  better.
>> -Al
>>
>> On 11/26/07, Chris Howe <cj...@yahoo.com> wrote:
>>> Very interesting. My implementation is extremely crude in
>  comparison.
>>   I
>>> was only outputting KML and KMZ for Google Earth. It seems I have
>> quite a
>>> bit of homework to do before being able to add very much to the
>> discussion.
>>> ----- Original Message ----
>>> From: Al Byers <by...@automationgroups.com>
>>> To: dev@ofbiz.apache.org
>>> Sent: Monday, November 26, 2007 10:46:31 AM
>>> Subject: Re: GIS Tools/modeling
>>>
>>>
>>> Hey Chris,
>>>
>>> Yes, I did some GIS work a few months ago. What I did was add a WFS
>>> interface to OFBiz. It is WfsEventHandler class in webapp.event. I
>> did
>>> a lot
>>> of work with GeoServer (http://docs.codehaus.org/display/GEOS/Home)
>>>   and
>>> MapBuilder  (http://docs.codehaus.org/display/MAInterstinP/Home)
>  for
>> the
>>> client
>>> side.
>>> I used MySQL for a geo spatial DB. I think GeoServer is definitely
>> the
>>> way
>>> to go for the server since it is Java based and I had no trouble
>>> including
>>> it in my ofbiz tomcat setup. There is an effort to consolidate many
>> of
>>> the
>>> various client packages (such as OpenLayers) and MapBuilder seems
>  to
>> be
>>> at
>>> the forefront of that effort (it uses OpenLayers to render, but
>  adds
>> an
>>> XML
>>> syntax for implementing client frontends.
>>>
>>> It is a very exciting time for the GIS community as they are
>  working
>>> together to create products and mashups that are the same sort of
>>> Goliath-killers in the GIS world that OFBiz is becoming in the ERP
>>> world.
>>>
>>> I also did a GeoRSS interface so that I could add markers to Google
>>> Maps,
>>> but I did not see how to add that to the ofbiz base code. I would
>  be
>>> willing
>>> to share that code if we can see where to add it. See
>>> http://docs.codehaus.org/display/GEOSDOC/GeoRSS.
>>>
>>> I think the WFS interface is the critical part, as it lets you use
>>> other
>>> servers like GeoServer to server up the base GIS layers, but lets
>  you
>>> use
>>> OFBiz to store and server the "points of interest". I only modeled
>>> points
>>> with my WfsEventHandler class. It needs to be extended to do a
>>> rectangular
>>> "find". One of the key things that I did was implement the
>> "ogc:filter"
>>> using FreeMarker templates. That is the part that needs to be
>> extended
>>> to
>>> implement the rectangular find.
>>>
>>> If you are not familiar with the WFS, WMS and WCS standards, you
>  need
>>> to be.
>>> They are what make all the synergy possible.
>>>
>>> It has been a few months since I have had a chance to work on it
>> (which
>>> might as well be a few years at my age) so you might want to google
>>> "gis"
>>> and "ofbiz" to see what else I had to say about it. I would be glad
>> to
>>> discuss and work on something more substantial for ofbiz, but I am
>> not
>>> actively working on GIS at the moment, so my time will be limited.
>>>
>>> -Al
>>>
>>> On 11/26/07, Chris Howe <cj...@yahoo.com> wrote:
>>>> I just completed a rather remedial GIS implementation (very
>  poorly
>>>> designed, but works for it's purpose).  Anyone have any
>>>> interest/experience/intelligent thought with this?
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
> 
> 
> 
> 
> 
>