# Extendingroutingsource function st\_asbinary(integer) does not exist

**URL:** <https://community.thinkgeo.com/t/extendingroutingsource-function-st-asbinary-integer-does-not-exist/7611>\
**Category:** Routing\
**Created:** [February 5, 2013, 8:16pm UTC](https://community.thinkgeo.com/t/extendingroutingsource-function-st-asbinary-integer-does-not-exist/7611 "2013-02-05T20:16:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niels1](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/niels1/32/18982_2.png) [@Niels1](https://community.thinkgeo.com/u/Niels1)\
**Post date:** [February 5, 2013, 8:16pm UTC](https://community.thinkgeo.com/t/extendingroutingsource-function-st-asbinary-integer-does-not-exist/7611/1 "2013-02-05T20:16:25Z")

</div>

&nbsp;Hi,&nbsp;I'm&nbsp;trying&nbsp;to&nbsp;use&nbsp;a&nbsp;postgis&nbsp;table&nbsp;instead&nbsp;of&nbsp;a&nbsp;shp&nbsp;file&nbsp;to&nbsp;story&nbsp;my&nbsp;roaddata.

(postgres&nbsp;9.2.2,&nbsp;postgis&nbsp;2.0.1)  
npgsql&nbsp;2.0.12  
&nbsp;  
I'm&nbsp;using&nbsp;this&nbsp;sample:  
C:\Program&nbsp;Files&nbsp;(x86)\ThinkGeo\Map&nbsp;Suite&nbsp;Routing&nbsp;Full&nbsp;Edition&nbsp;6.0\HowDoISamples\CSharp&nbsp;HowDoISamples\CSharp&nbsp;Desktop&nbsp;HowDoISamples\Samples\ExtendingRoutingSource.cs  
&nbsp;  
&nbsp;  
But&nbsp;Im&nbsp;getting&nbsp;this&nbsp;exception:&nbsp;{"ERROR:&nbsp;42883:&nbsp;function&nbsp;st\_asbinary(integer)&nbsp;does&nbsp;not&nbsp;exist"}  
when&nbsp;i&nbsp;get&nbsp;to&nbsp;this&nbsp;line:  
Feature&nbsp;feature&nbsp;=&nbsp;featureSource.GetFeatureById(roadId,&nbsp;ReturningColumnsType.NoColumns);  
&nbsp;  
here:  
&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;override&nbsp;RouteSegment&nbsp;GetRouteSegmentByFeatureIdCore(string&nbsp;roadId)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Feature&nbsp;feature&nbsp;=&nbsp;featureSource.GetFeatureById(roadId,&nbsp;ReturningColumnsType.NoColumns);  
  
postgis&nbsp;doesn't&nbsp;have&nbsp;st\_asbinary(int)&nbsp;postgis.refractions.net/docs/ST\_AsBinary.html  
&nbsp;  
Any&nbsp;idea&nbsp;how&nbsp;to&nbsp;fix&nbsp;this?  
&nbsp;  
-&nbsp;Niels

---

<div class="post-metadata">

**Author:** ![Gary2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/49beb7/32.png) [@Gary2](https://community.thinkgeo.com/u/Gary2)\
**Post date:** [February 6, 2013, 4:30am UTC](https://community.thinkgeo.com/t/extendingroutingsource-function-st-asbinary-integer-does-not-exist/7611/2 "2013-02-06T04:30:56Z")

</div>

Hello&nbsp;Niels,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Here&nbsp;are&nbsp;something&nbsp;I&nbsp;cannot&nbsp;confirm&nbsp;for&nbsp;your&nbsp;issue:&nbsp;  
&nbsp;I&nbsp;have&nbsp;a&nbsp;postgis&nbsp;table&nbsp;named&nbsp;“rail”&nbsp;and&nbsp;the&nbsp;column&nbsp;name&nbsp;of&nbsp;feature&nbsp;is&nbsp;“oid”.&nbsp;In&nbsp;&nbsp;psogreSQL,&nbsp;I&nbsp;use&nbsp;the&nbsp;below&nbsp;string&nbsp;to&nbsp;query&nbsp;when&nbsp;get&nbsp;feature&nbsp;by&nbsp;id,&nbsp;can&nbsp;you&nbsp;check&nbsp;it&nbsp;on&nbsp;your&nbsp;table&nbsp;to&nbsp;make&nbsp;sure&nbsp;the&nbsp;string&nbsp;or&nbsp;your&nbsp;table&nbsp;is&nbsp;correct?&nbsp;  
&nbsp;&nbsp;  
&nbsp;“select&nbsp;st\_asbinary("shape")&nbsp;from&nbsp;"rail"&nbsp;where&nbsp;"oid"&nbsp;in&nbsp;(‘1’);”&nbsp;  
&nbsp;&nbsp;  
&nbsp;And&nbsp;I&nbsp;use&nbsp;the&nbsp;below&nbsp;code&nbsp;to&nbsp;do&nbsp;the&nbsp;work&nbsp;of&nbsp;postgis&nbsp;in&nbsp;postgre,&nbsp;it&nbsp;works&nbsp;well&nbsp;on&nbsp;desktop&nbsp;edition.&nbsp;can&nbsp;you&nbsp;check&nbsp;the&nbsp;code&nbsp;on&nbsp;your&nbsp;environment?&nbsp;  
&nbsp;&nbsp;  
&nbsp;“PostgreSqlFeatureSource&nbsp;source&nbsp;=&nbsp;new&nbsp;PostgreSqlFeatureSource(connectionString,&nbsp;“rail”,&nbsp;“oid”);&nbsp;  
&nbsp;source.Srid&nbsp;=&nbsp;4326;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;source.Open();&nbsp;  
&nbsp;Feature&nbsp;feature&nbsp;=&nbsp;&nbsp;source.GetFeatureById("1",&nbsp;ReturningColumnsType.NoColumns);”&nbsp;  
&nbsp;&nbsp;  
&nbsp;If&nbsp;there&nbsp;are&nbsp;still&nbsp;anything&nbsp;errors,&nbsp;please&nbsp;let&nbsp;us&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Gary&nbsp;

---

<div class="post-metadata">

**Author:** ![Niels1](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/niels1/32/18982_2.png) [@Niels1](https://community.thinkgeo.com/u/Niels1)\
**Post date:** [February 6, 2013, 7:24am UTC](https://community.thinkgeo.com/t/extendingroutingsource-function-st-asbinary-integer-does-not-exist/7611/3 "2013-02-06T07:24:43Z")

</div>

Sorry&nbsp;my&nbsp;fault&nbsp;…copy&nbsp;pasting…,&nbsp;I&nbsp;had&nbsp;set&nbsp;the&nbsp;FeatureIdColumn&nbsp;to&nbsp;the&nbsp;wrong&nbsp;name…

---

<div class="post-metadata">

**Author:** ![Gary2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/49beb7/32.png) [@Gary2](https://community.thinkgeo.com/u/Gary2)\
**Post date:** [February 6, 2013, 9:36pm UTC](https://community.thinkgeo.com/t/extendingroutingsource-function-st-asbinary-integer-does-not-exist/7611/4 "2013-02-06T21:36:47Z")

</div>

Hello&nbsp;Niels,&nbsp;  
&nbsp;&nbsp;  
&nbsp;No&nbsp;problem,&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know&nbsp;your&nbsp;problems.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Gary
