convert

Java: Convert lat/lon from EPSG:4236 to EPSG: 3857

匿名 (未验证) 提交于 2019-12-03 09:05:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How would I convert my lat lon to EPSG 3857 projection using geotools or another java library? I'm having trouble finding the proper methods to use. I know OpenLayers (javascript) can do it easily, but I don't see a clear path to getting these coordinates transformed. I would like to see this transformation source lon, lat: -71.017942, 42.366662 destination lon, lat: -71 1.25820, 42 22.0932 So I have created my CRS final CoordinateReferenceSystem source = CRS.decode( "EPSG:4236" ); final CoordinateReferenceSystem dest = CRS.decode("EPSG:3857

Convert Bazaar repo to SVN

匿名 (未验证) 提交于 2019-12-03 09:05:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have written some python scripts that take advantage of pysvn to analyze a project. I would like to run these on a project that is now in a bazaar repo so I was wondering how I could get a copy of the bazaar repo on my machine and then translate it to a svn standard so pysvn can use it. I found some documentation on going SVN to Bazaar but not the other way around. Is it possible? 回答1: You say the scripts are in Python? You're in luck as Bazaaar is written in Python, so bzrlib can be used to analyse a repository. That said, with bzr-svn

Cannot convert type 'double' to 'string' for Excel values

匿名 (未验证) 提交于 2019-12-03 09:05:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm loading an Excel file as indicated in many places over the web. OpenFileDialog chooseFile = new OpenFileDialog(); chooseFile.Filter = "Excel files (*.xls,*.xlsl)|*.xls;*.xlsx"; if (chooseFile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { selectedFileName = chooseFile.FileName; textBox1.Text = selectedFileName; Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); Workbook wb = excel.Workbooks.Open(selectedFileName); Sheets excelSheets = wb.Worksheets; string currentSheet = "Sheet 1

How to convert class into Dictionary<string,string>?

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Now again I am explaining one of my eagerness about Dictionary ! This question is popuped in my mind from answer of my previous question !! Now the actual point is Can I convert Class into Dictionary ? In Dictionary I want my class properties as KEY and value of particular property as VALUE Suppose my class is public class Location { public string city { get; set; } public string state { get; set; } public string country { get; set; } Now suppose my data is city = Delhi state = Delhi country = India Now you can understand my point easily ! I

Determining UTM zone (to convert) from longitude/latitude

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm writing a program which expects a number of lat/long points, and I convert them internally to UTM in order to do some calculations in metres. The range of the lat/long points themselves is quite small -- about 200m x 200m. They can be relied on almost always to be within a single UTM zone (unless you get unlucky and are across the border of a zone). However, the zone that the lat/longs are in is unrestricted. One day the program might be run for people in Australia (and oh, how many zones does even a single state lie across, and how much

Convert RGBA PNG to RGB with PIL

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using PIL to convert a transparent PNG image uploaded with Django to a JPG file. The output looks broken. Source file Code Image.open(object.logo.path).save('/tmp/output.jpg', 'JPEG') or Image.open(object.logo.path).convert('RGB').save('/tmp/output.png') Result Both ways, the resulting image looks like this: Is there a way to fix this? I'd like to have white background where the transparent background used to be. Solution Thanks to the great answers, I've come up with the following function collection: import Image import numpy as np def

“TypeError: Can't convert 'NoneType' object to str implicitly” when var should have a value

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: import sys from tkinter import * def print(): print("Encoded " + message + " with " + offset) gui = Tk() gui.title("Caesar Cypher Encoder") Button(gui, text="Encode", command=encode).grid(row = 2, column = 2) Label(gui, text = "Message").grid(row = 1, column =0) Label(gui, text = "Offset").grid(row = 1, column =1) message = Entry(gui).grid(row=2, column=0) offset = Scale(gui, from_=0, to=25).grid(row=2, column=1) mainloop( ) When i run this code with an input in both the input box and a value on the slider - it comes up with the error >>

Split string, convert ToList<int>() in one line

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a string that has numbers string sNumbers = "1,2,3,4,5"; I can split it then convert it to List sNumbers.Split( new[] { ',' } ).ToList (); How can I convert string array to integer list? So that I'll be able to convert string[] to IEnumerable 回答1: var numbers = sNumbers.Split(',').Select(Int32.Parse).ToList(); 回答2: You can also do it this way without the need of Linq: List numbers = new List ( Array.ConvertAll(sNumbers.Split(','), int.Parse) ); // Uses Linq var numbers = Array.ConvertAll(sNumbers.Split(','), int.Parse).ToList(); 回答3:

Converting JDE Julian date to Gregorian

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to convert JDE dates , and have amassed a large quantity of information and figured I'd try to do an SQL conversion function to simplify some tasks. Here's the function I came up with, which I simply call "ToGregorian" CREATE FUNCTION [dbo].[ToGregorian](@julian varchar(6)) RETURNS datetime AS BEGIN DECLARE @datetime datetime SET @datetime = CAST(19+CAST(SUBSTRING(@julian, 1, 1) as int) as varchar(4))+SUBSTRING(@julian, 2,2)+'-01-01' SET @datetime = DATEADD(day, CAST(SUBSTRING(@julian, 4,3) as int)-1, @datetime) RETURN @datetime

How to convert a list<string> or list<object> to a ListView.ListViewItemCollection in one line

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can we transform a list of string or a list of object to a ListViewItemCollection in one line with linq, where object is for example a person with Name property that will be displayed to the ListViewItem. Here is my current code : foreach (string word in sf.lstWords) { lvWords.Items.Add(new ListViewItem(word)); } 回答1: Use ListView.ListViewItemCollection.AddRange and the Linq method Select lvWords.Items.AddRange(sf.lstWords.Select(t => new ListViewItem(t)).ToArray()); I use ToArray() because the signature of AddRange is void AddRange