querybypoint using c++

sch visualj at SOHU.COM
Fri Sep 22 05:51:43 EDT 2006


sch wrote:
> 
> hi,
> in my project, i want to query road name from shape file using c++ and
> mapserver 4.8.4's lib, but i get Segment fault error every time, does
> anybody have an example?
> the code i used is here:
> 
> int main()
> {
>     printf("main function.\n");
> 
>     mapObj  *map = NULL;
>     char    *mapfile = "/home/www/mapserver/gmap/htdocs/china_pg.map";
> 
>     map = msLoadMap(mapfile, NULL);
>     if(!map) {
>         printf("msLoadMap error.\n");
>         msWriteError(stderr);
>         exit(0);
>     }
> 
>     int status = msMapSetExtent(map, 73.81367424697862,
> 17.620038368633608, 134.3885088548217, 55.14595792129112);
>     pointObj point = {111.12, 34.76};
> 
>    msQueryByPoint(map, -1, MS_SINGLE, point, -1);
> 
>     msFreeMap(map);
>     msCleanup();
> 
>     return 1;
> }
> 
> by the way, the os i used is Redhat3.0. when i use php-mapscript to query,
> it's ok.
> 

-- 
View this message in context: http://www.nabble.com/querybypoint-using-c%2B%2B-tf2285326.html#a6444166
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list