Tracking vehicles

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Tracking vehicles

SenTnel
Hi!

I'm a new GeoServer user and I was wondering if someone could help me with the issue of plotting a point knowing the coordinates, this is so I could use the gps data that is updating constantly at a SQL database (I could use MySQL if necesary).

Thanks !
Reply | Threaded
Open this post in threaded view
|

Re: Tracking vehicles

Brent Owens
You can use a WFS insert request with geoserver to save the point to
your dataset. Geoserver comes with several demo requests under the
'demo' section of the web-admin gui. In those requests is an example for
inserting data (in this case a lineString). Here is the request:

<wfs:Transaction service="WFS" version="1.0.0"
  xmlns:wfs="http://www.opengis.net/wfs"
  xmlns:topp="http://www.openplans.org/topp"
  xmlns:gml="http://www.opengis.net/gml"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd 
http://www.openplans.org/topp 
http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:tasmania_roads">
  <wfs:Insert>
    <topp:tasmania_roads>
      <topp:the_geom>
        <gml:MultiLineString
srsName="http://www.opengis.net/gml/srs/epsg.xml#27354">
          <gml:lineStringMember>
            <gml:LineString>
              <gml:coordinates decimal="." cs="," ts=" ">
494475.71056415,5433016.8189323 494982.70115662,5435041.95096618
              </gml:coordinates>
            </gml:LineString>
          </gml:lineStringMember>
        </gml:MultiLineString>
      </topp:the_geom>
      <topp:TYPE>alley</topp:TYPE>
    </topp:tasmania_roads>
  </wfs:Insert>
</wfs:Transaction>

Once you have built up the request, just send it to your geoserver
instance, like this:
http://localhost:8080/geoserver/wfs

Hope that helps.

Brent Owens
(The Open Planning Project)



SenTnel wrote:
> Hi!
>
> I'm a new GeoServer user and I was wondering if someone could help me with
> the issue of plotting a point knowing the coordinates, this is so I could
> use the gps data that is updating constantly at a SQL database (I could use
> MySQL if necesary).
>
> Thanks !
>  

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Tracking vehicles

SenTnel
In reply to this post by SenTnel
Thank you Brent!

We tried to implement this as per your instructions but we see that the problem here is that we are not very familiar with this terms.

How do we tell geoserver the coordinates of the vehicle?  I mean, we are using MySQL server and we have created (for testing purpose)  a table with just four fields: ID, VehID, Lat and Long

The lat long fields are being updated every minute.

Basically what we dont know is how we tell geoserve to plot a point a these lat long every minute.

Thanks a lot!

Reply | Threaded
Open this post in threaded view
|

Re: Tracking vehicles

Gérald Estadieu-4
If I understand well you have a database that include the long/lat values from GPS receivers and you want to use it through GeoServer to plot on a map.
In that case, you must have a geometry field in your database (for MySQL only after 4.1 version) according to the OGC standards. Your 2 columns long and lat cannot be used directly. Either you write an external program to transform them into a geometry field or you can maybe do it in a MySQL function. Once you have this, you will be able to simply connect to it with Geoserver and show a map.
To recap: you must create a new column in your table let's call it 'the_geom' with a type 'geometry'. Everytime you update your long/lat you must update your the_geom as a POINT(x,y). Geoserver cannot read directly your long/lat column but it will use the_geom.
I hope it helps you.

Gerald

On 7/7/06, SenTnel <[hidden email]> wrote:

Thank you Brent!

We tried to implement this as per your instructions but we see that the
problem here is that we are not very familiar with this terms.

How do we tell geoserver the coordinates of the vehicle?  I mean, we are
using MySQL server and we have created (for testing purpose)  a table with
just four fields: ID, VehID, Lat and Long

The lat long fields are being updated every minute.

Basically what we dont know is how we tell geoserve to plot a point a these
lat long every minute.

Thanks a lot!


--
View this message in context: http://www.nabble.com/Tracking-vehicles-tf1863719.html#a5219347
Sent from the GeoServer - User forum at Nabble.com.


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Tracking vehicles

SenTnel
Thanks a lot!

Worked for us!   we already have the point plotted on the map. Now we have two more tricks to learn:

1> how do we select an specific vehicle?  in our table we have different vehicles, when we ran the application it showed all of them at once... we want to be able to select wich vehicle we want to display.

2> how do i tell geoserver to go and refresh the position periodically

Thanks again
Reply | Threaded
Open this post in threaded view
|

Re: Tracking vehicles

Chris Holmes-2


SenTnel wrote:
> Thanks a lot!
>
> Worked for us!   we already have the point plotted on the map. Now we have
> two more tricks to learn:
>
> 1> how do we select an specific vehicle?  in our table we have different
> vehicles, when we ran the application it showed all of them at once... we
> want to be able to select wich vehicle we want to display.
You can use a FILTER in your SLD file (SLD is how you specify what the
map should look like).  You'll have to dig in to the docs a bit, but you
can make different filters for your different vehicle names/numbers.

>
> 2> how do i tell geoserver to go and refresh the position periodically
Well, if you're database updates, then you just have to make a request
to GeoServer again.  You'll have to do the calls to refresh on the
client side, add some code to whatever client you're using.

Chris

>
> Thanks again

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

cholmes.vcf (281 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Tracking vehicles

Brent Owens
In reply to this post by SenTnel
1) This one is a little tricky but doable. It involves putting a filter
into your SLD file that will render only vehicles with the specified ID.
Now this isn't hard if you always want to render the same vehicle. But
if you want the user to be able to select which vehicle to render, then
you will have to do a WMS request with SLD POST (passing a custom SLD
along with the WMS request). There are several examples on the geoserver
docs page on SLDs and SLD post.

2) This depends on what client you are requesting the map with. If you
are using MapBuilder or OpenLayers, you can just just use a javascript
setInterval() function to refresh every few seconds. But as long as the
data is being updated in geoserver, it will always render everything you
ask it to. So just keep making getMap requests.

Brent Owens
(The Open Planning Project)



SenTnel wrote:

> Thanks a lot!
>
> Worked for us!   we already have the point plotted on the map. Now we have
> two more tricks to learn:
>
> 1> how do we select an specific vehicle?  in our table we have different
> vehicles, when we ran the application it showed all of them at once... we
> want to be able to select wich vehicle we want to display.
>
> 2> how do i tell geoserver to go and refresh the position periodically
>
> Thanks again
>  

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Tracking vehicles

SenTnel
In reply to this post by SenTnel
Thanks guys!  you are great!  I can't believe that you are wiling and able to help people this way, without knowing the people nor charging for it...

I was going to say "my last question", but rethinking, when you are working on a project you can never say that...

One more: I would like to apply the styles dinamically, without using the GUI, can I load the styles externally?

Thanks again
Reply | Threaded
Open this post in threaded view
|

Re: Tracking vehicles

Brent Owens
We are always here to help =)

For applying the style dynamically, yes you can with the recent version
of geoserver. It has a pseudo implementation of PutStyles where you can
submit an SLD file over WMS using POST. Just send an XML document to
http://localhost:8080/geoserver/sld
(of course fill in the proper server URL).
The body of the SLD needs to have a 'named layer' tag (your feature type
you are setting the SLD for) and a 'user style' (the SLD).
Here is an example one:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
        xmlns:gml="http://www.opengis.net/gml"
        xmlns:ogc="http://www.opengis.net/ogc"
        xmlns="http://www.opengis.net/sld">
        <NamedLayer>
                <Name>states</Name>
                <UserStyle>
                        <Name>states_style</Name>
                        <Title>geoserver style</Title>
                        <Abstract>Generated by GeoServer</Abstract>
                        <FeatureTypeStyle>
                        <Rule>
                                <PolygonSymbolizer>
                                        <Fill>
                                                <CssParameter name="fill">#EEEE55</CssParameter>
                                                <CssParameter name="fill-opacity">1</CssParameter>
                                        </Fill>
                                        <Stroke>
                                                <CssParameter name="stroke">#FF0000</CssParameter>
                                                <CssParameter name="stroke-opacity">1</CssParameter>
                                        </Stroke>
                                </PolygonSymbolizer>
                                <TextSymbolizer>
                                        <Label>
                                                <ogc:PropertyName>STATE_FIPS</ogc:PropertyName>
                                        </Label>
                                                <Font>
                                                        <CssParameter name="font-family">Times New Roman</CssParameter>
                                                        <CssParameter name="font-style">Normal</CssParameter>
                                                        <CssParameter name="font-size">12</CssParameter>
                                                </Font>
                                        <Fill>
                                                <CssParameter name="fill">#775577</CssParameter>
                                                <CssParameter name="fill-opacity">1</CssParameter>
                                        </Fill>
                                </TextSymbolizer>
                        </Rule>
                        </FeatureTypeStyle>
                </UserStyle>
        </NamedLayer>
</StyledLayerDescriptor>


Brent Owens
(The Open Planning Project)



SenTnel wrote:

> Thanks guys!  you are great!  I can't believe that you are wiling and able to
> help people this way, without knowing the people nor charging for it...
>
> I was going to say "my last question", but rethinking, when you are working
> on a project you can never say that...
>
> One more: I would like to apply the styles dinamically, without using the
> GUI, can I load the styles externally?
>
> Thanks again
>  

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Tracking vehicles

SenTnel
In reply to this post by SenTnel

How do I use the setInterval function? I can't find any reference about the use of it...

needless to say thanks again?  no way...   Thanks again!