我在 sql server 中有一个地理类型的表。我使用实体框架和 EntitySetController 返回包含地理列的实体的 [Queryable] 列表。
以下是返回数据的示例:
{
"d":{
"__count":"19534",
"results":[
{
"__metadata":{
"id":"http://localhost:2663/odata/Airports(1)",
"uri":"http://localhost:2663/odata/Airports(1)",
"type":"AirportDB.Airport"
},
"Id":1,
"SiteNumber":"50009.*A",
"Abbrev":"ADK",
"Name":"Adak",
"Type":"AIRPORT",
"GeoLocation":{
"__metadata":{
"type":"System.Data.Spatial.DbGeography"
},
"WellKnownValue":{
"__metadata":{
"type":"System.Data.Spatial.DbGeographyWellKnownValue"
},
"CoordinateSystemId":4326,
"WellKnownText":"POINT (-176.646 51.878)",
"WellKnownBinary":null
}
},
"LocationID":"'ADK",
"EffectiveDate":"\/Date(1367452800000)\/",
"Region":"AAL",
"DistrictOffice":"NONE",
"State":"AK",
"StateName":"ALASKA",
"County":"ALEUTIAN ISLANDS",
"CountyState":"AK",
"City":"ADAK ISLAND",
"FacilityName":"ADAK",
"Ownership":"PU",
"Use":"PU",
"Owner":"STATE OF ALASKA-DOTPF-CENTRAL RGN",
"OwnerAddress":"P O BOX 196900",
"OwnerCSZ":"\"ANCHORAGE, AK 99519\"",
"OwnerPhone":" 907-269-0751",
"Manager":"VINCE TUTIAKOFF",
"ManagerAddress":"P O BOX 1952",
"ManagerCSZ":"\"ADAK, AK 99546\"",
"ManagerPhone":" 907-592-8026",
"Latitude":51.877963888888893,
"Longitude":-176.64603055555554,
"ARPLatitude":"51-52-40.6700N",
"ARPLatitudeS":"186760.6700N",
"ARPLongitude":"176-38-45.7100W",
"ARPLongitudeS":"635925.7100W",
"ARPMethod":"E",
"ARPElevation":18,
"ARPElevationMethod":"S",
"MagneticVariation":"07E",
"MagneticVariationYear":2000,
"TrafficPatternAltitude":0,
"ChartName":"W ALEUTIAN ISLS",
"DistanceFromCBD":0,
"DirectionFromCBD":"W",
"LandAreaCoveredByAirport":0,
"BoundaryARTCCID":"ZAN",
"BoundaryARTCCComputerID":"ZAN",
"BoundaryARTCCName":"ANCHORAGE",
"ResponsibleARTCCID":"ZAP",
"ResponsibleARTCCComputerID":"ZAP",
"ResponsibleARTCCName":"ANCHORAGE OCEANIC",
"TieInFSS":"N",
"TieInFSSID":"CDB",
"TieInFSSName":"COLD BAY",
"AirportToFSSPhoneNumber":"907-532-2466",
"TieInFSSTollFreeNumber":"1-800-478-7250",
"AlternateFSSID":"ENA",
"AlternateFSSName":"KENAI",
"AlternateFSSTollFreeNumber":"1-866-864-1737",
"NOTAMFacilityID":"ADK",
"NOTAMService":"Y",
"ActiviationDate":"\/Date(-654912000000)\/",
"AirportStatusCode":"O",
"CertificationTypeDate":"I A S 04/2005",
"FederalAgreements":"N",
"AirspaceDetermination":"NO OBJECTION",
"CustomsAirportOfEntry":"N",
"CustomsLandingRights":"N",
"MilitaryJointUse":"N",
"MilitaryLandingRights":"Y",
"InspectionMethod":"F",
"InspectionGroup":"F",
"LastInspectionDate":9202012,
"LastOwnerInformationDate":1081991,
"FuelTypes":"A1",
"AirframeRepair":"NONE",
"PowerPlantRepair":"NONE",
"BottledOxygenType":"NONE",
"BulkOxygenType":"NONE",
"LightingSchedule":"SEE RMK",
"BeaconSchedule":"SS-SR",
"ATCT":"N",
"UNICOMFrequencies":0,
"CTAFFrequency":122.9,
"SegmentedCircle":"Y",
"BeaconColor":"CG",
"NonCommercialLandingFee":"",
"MedicalUse":"",
"SingleEngineGA":0,
"MultiEngineGA":0,
"JetEngineGA":0,
"HelicoptersGA":0,
"GlidersOperational":0,
"MilitaryOperational":0,
"Ultralights":0,
"OperationsCommercial":212,
"OperationsCommuter":0,
"OperationsAirTaxi":0,
"OperationsGALocal":0,
"OperationsGAItin":100,
"OperationsMilitary":28,
"OperationsDate":"\/Date(1325376000000)\/",
"AirportPositionSource":"",
"AirportPositionSourceDate":"",
"AirportElevationSource":"",
"AirportElevationSourceDate":"",
"ContractFuelAvailable":"",
"TransientStorage":"HGR",
"OtherServices":"CARGO",
"WindIndicator":"Y"
}
]
}
}
Jaydata 在工厂配置模式下抛出异常:“无法解析类型:System.Data.Spatial.DbGeography”。
我究竟做错了什么?如何以它喜欢的方式将地理列返回到 jaydata?
谢谢
编辑:
@robesz 根据您的 JayStorm Paas Open Edition 建议,我创建了一个帐户,创建了一个匹配的架构,创建了一个 .Net 控制台应用程序来添加一些数据,但它抱怨 GeoLocation 列中的格式无效。我该如何解决?此外,当我执行行 SaveChanges() 时,它首先抱怨需要 odata v3,但导入过程硬编码 V2,所以我手动编辑了生成的客户端存根(不理想) - 我将如何解决这个问题?而且,没有更简单的方法可以将数据导入 JayStorm 表吗?最后,我在哪里可以找到超过 100 万条记录的定价?
class Program
{
static void Main(string[] args)
{
var db = new AirportDB.mydatabaseService(new Uri("https://open.jaystack.net/c72e6c4b-27ba-49bb-9321-e167ed03d00b/6494690e-1d5f-418d-adca-0ac515b7b742/api/mydatabase/"));
var airport = new Airport.Airport();
airport.Abbrev = "Foo";
airport.Name = "Bar";
airport.GeoLocation = GeographyPoint.Create(51.8779638888889, -176.646030555556);
db.AddToAirport(airport);
db.SaveChanges();
}
}